Skip to content

Standalone font loader doesn't load custom marketsans if @font-face definitions are not available #45

@dsathyakumar

Description

@dsathyakumar

Issue
Standalone font loader doesn't load custom marketsans font files, if @font-face definitions are not available in the parent page.

Context

  • eBay Inc., uses the widget platform that attempts to load market-sans font via the stand alone loader present in this repo.
  • Only if the parent page makes uses of ebay-font module, via their page rendered marko templates, in the <head/> section, the marketsans definitions from @ebay/Skin gets stamped.
  • If the page doesn't use this module, then, the stand-alone loader attempts to load the marketsans font files, but as the associated definitions via @font-face rules are not available, the custom font doesn't get downloaded, yet it adds an entry into the localstorage thereby also preventing future downloads.

Possible Solve:
Create a style element via JS and append it to the <head/> & Inline the market-sans definitions in it & before triggering the downloads. As this anyway happens via font-display: optional, after window load, this would most likely prevent FOUT and FOIT.

If the suggested solve looks okay, lmk & i'll open a PR. Thx!
@RajaRamu @senthilp

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions