Why certain fonts display wrong characters?

Symptoms

For some fonts like Gill Sans or Linux Libertine G, the displayed text can be completely wrong. The characters are displayed with the correct style, but they are the wrong characters.

This happens since V18.

Cause

This problem is not limited to BricsCAD, but also happens with other programs.

These are fonts which use many font files (such a bundle of files is called a font family) and programs implicitly look up the best matching font file in a font family for drawing a character. The display of the font would be fine even if a single font file would be used, but there are slight improvements when using more files for that font. Using a regular font file and saying draw this bold is fine but using the dedicated bold font file is better.

Larger font families can have small flaws in them which will cause ambiguities in which file of the family to use. The effect is that when drawing of a character one font file is used in an early stage of the calculations and in a later stage another font file of the same family is used.

It does not cause any problems in V17 but in V18 it can lead to a character being drawn which is completely wrong. Our new approach for calculation is actually correct and we cannot fix this.

Solution

The solution is to trim down the font family used for a single font, so that ambiguous choice of the file to use is avoided. In the case of Gill Sans this can be achieved by removing the files for:

  • Gill Sans Light
  • Gill Sans Light Italic
  • Gill Sans SemiBold
  • Gill Sans SemiBold Italic
  • Gill Sans UltraBold

The visual effects of using less fonts files are minimal.

Note:

A font that is distributed with many files does not automatically show this issue.

For example, the font Noto Sans has two font files with these styles: Italic, Light Italic. But when the two fonts are opened with Windows Font Viewer, one can see that the two fonts technically belong to two different font families:

  • Family Noto Sans (using style Italic)
  • Family Noto Sans Light (using style Italic)

Since the font families differ, the font is not affected by this issue.

Similarly, most fonts avoid this issue by using a different font family for 'extended' font styles. There are only a few fonts known by us that actually have this issue.

With extended styles, we mean font styles outside of these 4 styles:

  • Regular
  • Bold
  • Italic
  • Bold Italic

For more information, see https://docs.microsoft.com/en-us/typography/opentype/spec/name#name-ids, sections Font Family name and Font Subfamily name.