google / google/fonts

Google Fonts standardized condensed style name

Open
#9,185 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
HTML
Stars
20.5k
Forks
2.9k
Avg merge
1d 21h
Merged PRs (30d)
95

Description

This proposal is to establish a standardized way to approach condensed font style names to ensure proper rendering in MS Office's GDI rendering environment.

**Why do we need a standard way to condense style names?**

The font dropdown in Microsoft Office on PC is driven by the older GDI font enumeration and rendering technology. GDI uses `LOGFONTA` (documented [here](https://learn.microsoft.com/en-us/windows/win32/api/wingdi/ns-wingdi-logfonta)) to define the attributes of a font, and `CHAR lfFaceName[LF_FACESIZE];` to define the font name. The problem, though, is that the string `lfFaceName` is restricted to 32 characters, including the terminating `NULL`.

While historically this wasn’t much of a problem in the standard RIBBI (Regular/Italic/Bold/Bold Italic) model, variable fonts introduce many more challenges. In particular, families with more axes and those with wider ranges can use up a significant amount of characters in the font name. And those with the default master at a particularly verbose location, (ex: ExtraLight, Condensed, etc.) will have even fewer characters available.

**Impact of exceeding 31 characters**
When a font name exceeds the 31 character limit (accounting for the required NULL character), various things can happen:

(1) Fonts fail to enumerate

If we have create three test fonts that have a very long family name, and attempt to load all three, only one will show up.

Image

```
Merriweather the ultimate family 7pt → Merriweather the ultimate famil
Merriweather the ultimate family 7pt Light → Merriweather the ultimate famil
Merriweather the ultimate family 7pt ExtraBold → Merriweather the ultimate famil
```
As we can see, from GDI’s perspective, all three of these have the exact same `lfFaceName`, so are failing to be differentiated from one another.

(2) Fonts without duplicates enumerate but certain letters fail to display

Image

Here we have a font name `Georama SemiCondensed ExtraLight` which exceeds the 31 character limit. While it does enumerate in the font menu, certain letters do not render properly. I expect this is due to limitations in the rendering path which causes it to fail to locate the font.

*Note* This problem is not resolved even in the word processing environment that is driven by the more contemporary DirectWrite engine as the GDI `lfFaceName` string is embedded into the document. So if the font name is not sufficiently differentiated within 31 characters, it will cause DirectWrite to fail as well.

**Solutions**
(1) Include name ID 16
In a variable font where the master location is at a location with a significant number of characters, say, “ExtraLight”, name ID 1 can become quite long (eg: “Chiron Hei HK ExtraLight”). However, in determining the font name, Microsoft will prioritize name ID 16 over name ID 1. So this lets one reduce the character count back to the standard font name (eg: “Chiron Hei HK”).

This approach definitely helps save space, but doesn’t provide a solution for all scenarios, like say “ExtraLight SemiCondensed Italic” which has 31 characters *by itself*.

(2) Abbreviate the style names
While not ideal from a user perspective, there are long-standing methods of condensing family style names to ensure that they remain under the 31 character limit.

|Weight name | Condensed | Compressed | Weight numerals|
|-- | -- | -- | --|
|Thin | Thin | T | W0|
|ExtraLight | ExLt | EL | W1|
|Light | Lt | L | W2|
|Medium | Med | M | W4|
|SemiBold | SmBd | SB / DB / D | W5|
|Bold | Bold | B | W6|
|ExtraBold | ExBd | EB | W7|
|Black | Black | BL | W8|
|UltraBold / ExtraBlack | ExBlk | UB | W9|

|Weight name | Condensed | Compressed | Width numerals|
|-- | -- | -- | --|
|UltraCondensed | UtCnd | UC | C4|
|ExtraCondensed | ExCnd | EC | C3|
|Condensed | Cnd | C | C2|
|SemiCondensed | SmCnd | SC | C1|
|SemiExpanded | SmExp | SE | E1|
|Expanded | Exp | E | E2|
|ExtraExpanded | ExExp | EE | E3|
|UltraExpanded | UtExp | UE | E4|

In these cases, I thought it makes sense to define both a “condensed” option where the style name is no more than 5 characters, and a compressed option which is no more than 2 characters, for more extreme scenarios. I’ve also included an alternate approach, which uses numerals, and might be worth considering. While it would represent a more significant divergence from the standard naming conventions, it allows for a nice degree of consistency to these fields.

Using the above methods, we can condense down a significantly-long style name, say “ExtraLight SemiCondensed Italic”, to “ExLt SmCnd Italic” (17 char) or “EL SC Italic” (12 char), both of which should leave sufficient room for a font family with a long name to properly enumerate.

Regardless of the method chosen, it is crucial to have a standardized approach for these scenarios.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.