Skip to content

Incorrect handling of local fonts #66

Description

@damentomassi

The current implementation incorrectly processes local fonts through the Google Fonts API. This leads to attempts to load local fonts from Google's servers, which is not the intended behavior and will fail to load these fonts correctly.

Specifically:

  1. In the fonts useMemo, local fonts are added to the activeFonts array without any distinction from Google Fonts.

  2. The loadFontFromObject function assumes all fonts are Google Fonts and attempts to create a link element to load them from Google's CDN.

Proposed solution:

  1. Modify the Font interface to include an isLocal boolean property.

  2. Update the fonts useMemo to set isLocal: true when adding local fonts to the activeFonts array.

  3. Modify the loadFontFromObject function to handle local fonts differently:

    • For local fonts, implement a method to ensure the font is available (e.g., using @font-face rules if necessary).
    • Only create the Google Fonts link for non-local fonts.
  4. Review and update other functions that interact with fonts (e.g., autoLoadFont, font checking logic) to properly handle the distinction between local and Google Fonts.

This change will ensure that local fonts are correctly handled within the application and not mistakenly processed through the Google Fonts API.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions