Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #1496716

    If Enfold were to read the fvar table during upload, the theme could automatically detect whether it is a variable font and change the @font-face rule from font-weight: 400; to font-weight: 100 900; (or the corresponding range).

    Uploading a varialble font works nice – but the @font-face rule is f.e.:

    @font-face {
      font-family:'montserrat-flex';
      src:url('https://webers-testseite.de/wp-content/uploads/dynamic_avia/avia_type_fonts/montserrat-flex/montserrat-flex.woff2') format('woff2');
      font-style:normal;
      font-weight:400;
      font-display:swap
    }

    here a font-weight: 100 900; will be nice to have.
    Because – i do not know what is used when setting it to 700
    Maybe it uses a “Faux Bold”:
    the browser often only artificially “boldens” the font when it thinks the only available weight is 400. With the correct range, it uses the actual vectors of the variable font.

    Edit:
    although the @font-face rule is not correct – it seems that even Safari uses the correct wght.
    But it would be nice to have the real ruleset for it.

    #1496717

    ok – i found that function: function scan_font_files and see the setting – so a nomenklatura of the variable fonts had to be – at the end by variablefont

    if( false === strpos( $style, 'variablefont' ) )
    {
    	$style_info = isset( $this->google_fonts_def[ $style ] ) ? $this->google_fonts_def[ $style ] : array( 400, 'normal' );
    }

    so naming f.e. the font: Montserrat-variablefont.woff2 will end in a @font-face rule :

    @font-face {
      font-family:'montserrat-variablefont';
      src:url('https://webers-testseite.de/wp-content/uploads/dynamic_avia/avia_type_fonts/montserrat-variablefont/montserrat-variablefont.woff2') format('woff2');
      font-style:normal;
      font-display:swap
    }

    and this might be better than to have font-weight : 400

    is there a way to get in that function scan_font_files the weight range given in the font?

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.