Skip to content

fontPreloading check erroneously advises to preload a font which is a data: URL #1185

@westonruter

Description

@westonruter

When running Pixi on https://www.cu-camper.com/en/ I saw unexpected advice for Preload critical fonts:

image

Namely, the font is present on the page as a data: URL and thus it is irrelevant for preloading.

Interestingly, the font in question is coming from a page inside of an amp-iframe: https://cumagazin.cu-camper.com/en/magazine/map/?center=41.4825133,2.4863493&zoom=2&lightbox=1&language=en

I believe the logic here should be changed:

const fontface = pageData.fontFaces.get(font);
if (!fontface || !fontface.mainSrc) {
continue;
}

Namely to something like:

if (!fontface || !fontface.mainSrc || fontface.mainSrc.startsWith('data:')) { 

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