Please add <group> → <match> → <style-prefix>
This is a part of: #200
Preamble
Because width
is the most recent of standard style facets, and the least likely to be supported by legacy applications, many font authors will split the width
declinations of their font families into separate font families, and move width
information from style
to family
.
However, for this same reason, the standard width
position in style
labels is leftwards (that keeps weight
and slant
rightmost in Name ID 4 regardless of naming policy choices).
Therefore, an obvious way to factor-out all the style
fixes, required modernize such a font family, is just to prefix all the original style
labels with the width
attribute.
Purpose
The style-prefix
element allows easy prefixing of all original style
labels with @style_name_prefix@
. As documented above, this is a common font assembly operation.
Proposed syntax
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<!-- SPDX-License-Identifier: MIT -->
<fontconfig>
<group>
<target>@canonical_family_name@</target>
<match>
<family>@technical_family_name@</family>
<style-prefix>@style_name_prefix@</style-prefix>
</match>
</group>
</fontconfig>
Behaviour
All the original style
values contained in the files affected by the match
block are rewritten into @style_name_prefix@
SPACE @original_style_name@
, except for Regular
, which is transformed by convention into @style_name_prefix@
.
The result is used to generate fullname
the usual group
way.
Past alternatives
The past alternative is to specify the prefixing style value by style value in separate match
+ edit
blocks.
However, that requires identifying beforehand all the style combinations, that will need this prefixing. Therefore, it is not robust against font changes.
The human must remember the Regular
and variable special cases.
It does not factor-out, the non-style part of the matching
It does not factor-out, post-style-fixing common operations.
Even with a motivated human, the number of declaration blocks required to list all the styles present in the font files limits its scaling to simple font families.
Minimal real-world example
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<!-- SPDX-License-Identifier: MIT -->
<fontconfig>
<group>
<target>IBM Plex Sans</family>
<match>
<family>IBM Plex Sans Condensed</family>
<style-prefix>Condensed</style-prefix>
</match>
</group>
</fontconfig>