fontations icon indicating copy to clipboard operation
fontations copied to clipboard

Variable Font PostScript instance name construction

Open bungeman opened this issue 10 months ago • 0 comments

A variable OpenType font's PostScript name is supposed to vary. This is documented in FreeType by FT_Get_Postscript_Name and implemented in sfnt_get_var_ps_name.

It would be quite useful to provide a means to combine a base PostScript name (from FontRef::localized_strings(POSTSCRIPT_NAME)) and a variation position (from FontRef::axes()) to create the PostScript instance name. Because of the PostScript name length limit and the non-trivial nature of creating the PostScript instance name it would be best to have this in the library instead of expecting users to re-implement this.

The most specific version of this would be to add a FontRef::postscript_name() -> Option<String> like call, or perhaps a more general utility like postscript_instance_name(LocalizedString, AxisCollection) -> String. Because there is a length limit on the PostScript name it would be quite awkward to be any more general than this.

bungeman avatar Apr 02 '24 18:04 bungeman