Skip to content

The 'medium' is an incorrect font-weight and fonts with it doesn't preloaded #246

Closed
@TrueXakeP

Description

@TrueXakeP

First sorry for my english.

I have a font 'Merel'. I use it in my web-app in two weights 500 and 300.

With PreloadJS 1.0.0 this JS code:

var fldr = new createjs.FontLoader({
        src: [
            "/fonts/merel/Merel-Medium.woff2",
            "/fonts/merel/Merel-Light.woff2"
        ],
        type "font"
    }, true);
fldr.load();

produces this CSS:

@font-face {
    font-family: 'Merel';
    font-style: normal;
    font-weight: 300;
    src: local('Merel Light'), url('/fonts/merel/Merel-Light.woff2') format('woff2');
}
@font-face {
    font-family: 'Merel';
    font-style: normal;
    font-weight: medium;
    src: local('Merel Medium'), url('/fonts/merel/Merel-Medium.woff2') format('woff2');
}

But regarding to MDN the medium is an incorrect value for the font-weight property. And I see in the console of my Chromium 64.0.3254.0 and Firefox Nightly 59.0a1 that Merel-Medium is loaded only after I make a visible element that uses it. And also I see that "Flash Of Unstyled Text" in that moment.

This is also happened when I specify 'medium' as a weight in a css or object definition.

{
    src: [ {
        src: "url(/fonts/merel/Merel-Medium.woff2) format('woff2')",
        family: "Merel",
        weight: "medium",
        style: "normal"
    }, /*....*/ ],
    type: "font"
}

When I specify font-weight as the '500' then the font preloads correct. But in that case I can not use short array definition as a list of files.

The MDN says that correct font weights are: normal | bold | bolder | lighter | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900
Also the PHPStorm tells me that 'medium' is invalid value for the 'font-weight' property when I try to use it in my styles.

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