Difference between revisions of "Variable Fonts support"

From Inkscape Wiki
Jump to navigation Jump to search
Line 1: Line 1:
== references ==
 
== Overview ==
 
Fonts with '''Variations''' allow one to change the font appearance (weight, spacing, etc.) over a continuous range of values, all with just one font file. For an more information see this [https://webdesign.tutsplus.com/articles/how-to-use-variable-fonts-on-the-web--cms-30212 tutorial].
 
Our font rendering stack now includes support for font variations (harfbuzz (1.4), pango (1.41.1), freetype).
 
== References ==
 
=== Specifications ===
 
* [https://docs.microsoft.com/en-us/typography/opentype/spec/otvaroverview OpenType Font Variations Overview]
* [https://drafts.csswg.org/css-fonts-4/#propdef-font-variation-settings CSS Fonts Level 4 'font-variation-settings' property]
 
=== Browser Support ===
 
* Chrome: Supported
* Safari: Supported (haven't tested)
* Firefox: In Nightly but must be [https://www.axis-praxis.org/blog/2017-04-05/17/how-to-get-variable-fonts-working-in-safari-chrome-and-firefox-macos enabled].
* Edge: ?
 
[http://tavmjong.free.fr/SVG/font_weight/font_variation.svg Test file]
 
Firefox nightly does not support "named" variations.
 
Note: Chrome also supports 'font-weight' values that are not multiples of 100 (CSS Fonts Level 4 changes the allowed values of 'font-weight to include all integers from 1 to 1000):
 
[http://tavmjong.free.fr/SVG/font_weight/font_weight.svg Test file]
 
=== Google's FontView proof-of-concept ===
=== Google's FontView proof-of-concept ===
FontView is a demo program written by Google engineers to demonstrate the variable font technologies recently added to harfbuzz and freetype.  
FontView is a demo program written by Google engineers to demonstrate the variable font technologies recently added to harfbuzz and freetype.  
This is the same stuff we'll use in inkscape soon. The project sources are available at https://github.com/googlei18n/fontview
This is the same stuff we'll use in inkscape soon. The project sources are available at https://github.com/googlei18n/fontview
On Fedora: dnf install wxGTK3-devel
== Inkscape ==
Linked to recent libraries, Inkscape can use "named" variations out-of-the box (i.e., one font file provides multiple styles).
Reading of 'font-variation-settings' implemented. Needs fixing (incorrect parsing, parsing not robust against variations in white-space).
Pango uses a different mechanism for handling ''variations'' from 'font-feature-settings'. Variations are handled in the Pango font description while features are handled by setting attributes.
Hint: To compile and link with libraries in /usr/local execute:
  export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
before running ''cmake''.


== User Interface ==
== User Interface ==
   
   
On the UI, I've been thinking of sliders as the dumb-obvious solution to select values for a variable font axes, but I also think it would be cool to think of a user-defined "palette" of varfont instances. Because you have pretty much infinite variations that can be chosen in a varfont, but you'd want to pick some and use them on your document and then be able to tweak one of the instances and then see the change affecting all places where that was used. So, a varfont can have typedesigner-specified named instances, but I think we should also offer user-defined instances. And these should show up on the font selector just like nowadays we have a drop-down for Regular/Bold/Italics. [[User:Juca|Felipe "Juca" Sanches]] ([[User talk:Juca|talk]])
On the UI, I've been thinking of sliders as the dumb-obvious solution to select values for a variable font axes, but I also think it would be cool to think of a user-defined "palette" of varfont instances. Because you have pretty much infinite variations that can be chosen in a varfont, but you'd want to pick some and use them on your document and then be able to tweak one of the instances and then see the change affecting all places where that was used. So, a varfont can have typedesigner-specified named instances, but I think we should also offer user-defined instances. And these should show up on the font selector just like nowadays we have a drop-down for Regular/Bold/Italics. [[User:Juca|Felipe "Juca" Sanches]] ([[User talk:Juca|talk]])

Revision as of 13:18, 9 March 2018

Overview

Fonts with Variations allow one to change the font appearance (weight, spacing, etc.) over a continuous range of values, all with just one font file. For an more information see this tutorial.

Our font rendering stack now includes support for font variations (harfbuzz (1.4), pango (1.41.1), freetype).

References

Specifications

Browser Support

  • Chrome: Supported
  • Safari: Supported (haven't tested)
  • Firefox: In Nightly but must be enabled.
  • Edge: ?

Test file

Firefox nightly does not support "named" variations.

Note: Chrome also supports 'font-weight' values that are not multiples of 100 (CSS Fonts Level 4 changes the allowed values of 'font-weight to include all integers from 1 to 1000):

Test file

Google's FontView proof-of-concept

FontView is a demo program written by Google engineers to demonstrate the variable font technologies recently added to harfbuzz and freetype. This is the same stuff we'll use in inkscape soon. The project sources are available at https://github.com/googlei18n/fontview

On Fedora: dnf install wxGTK3-devel

Inkscape

Linked to recent libraries, Inkscape can use "named" variations out-of-the box (i.e., one font file provides multiple styles).

Reading of 'font-variation-settings' implemented. Needs fixing (incorrect parsing, parsing not robust against variations in white-space).

Pango uses a different mechanism for handling variations from 'font-feature-settings'. Variations are handled in the Pango font description while features are handled by setting attributes.

Hint: To compile and link with libraries in /usr/local execute:

 export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig

before running cmake.

User Interface

On the UI, I've been thinking of sliders as the dumb-obvious solution to select values for a variable font axes, but I also think it would be cool to think of a user-defined "palette" of varfont instances. Because you have pretty much infinite variations that can be chosen in a varfont, but you'd want to pick some and use them on your document and then be able to tweak one of the instances and then see the change affecting all places where that was used. So, a varfont can have typedesigner-specified named instances, but I think we should also offer user-defined instances. And these should show up on the font selector just like nowadays we have a drop-down for Regular/Bold/Italics. Felipe "Juca" Sanches (talk)