IBM / plex

The package of IBM’s typeface, IBM Plex.
SIL Open Font License 1.1
9.6k stars 567 forks source link

Weird spacing issue: space changes width when used with BOX DRAWINGS characters? #423

Closed sdbbs closed 2 years ago

sdbbs commented 2 years ago

Just discovered this, I'm on Ubuntu 20.04 Mate, and can see this with IBM Plex in both scite and geany.

Basically, if I use normal characters, then when I type SPACE, it is a normal space - here scite, View/Whitespace is on, spaces are indicated by very small central dots, font size (via mouse scrollwheel) to the max:

image

Now, let's paste in , that is, BOX DRAWINGS LIGHT DOWN AND LEFT:

image

Well - now the spaces before the got reduced in width?! For a monospaced font?

Same happens also in geany - but I do not get the same behavior from other monospaced fonts ...

I assume this is a bug of some kind ... The font I use:

$ fc-scan ~/.fonts/IBM-Plex-Mono/IBMPlexMono-Regular.otf 
Pattern has 25 elts (size 32)
    family: "IBM Plex Mono"(s)
    familylang: "en"(s)
    style: "Regular"(s)
    stylelang: "en"(s)
    fullname: "IBM Plex Mono"(s)
    fullnamelang: "en"(s)
    slant: 0(i)(s)
    weight: 80(f)(s)
    width: 100(f)(s)
    spacing: 100(i)(s)
    foundry: "IBM "(s)
    file: "~/.fonts/IBM-Plex-Mono/IBMPlexMono-Regular.otf"(s)
    index: 0(i)(s)
    outline: True(s)
    scalable: True(s)
    charset: 
    0000: 00000000 ffffffff ffffffff 7fffffff 00000000 ffffffef ffffffff ffffffff
    0001: ffffffff ffffffff ffffffff 7fffffff 00048000 00018003 00000000 fc000000
    0002: 0f000000 00800000 02000000 00000000 00000000 18000000 3f0000c0 00000000
    0003: 08241fdf 000001c8 00000000 00000000 00000000 00000000 00000001 00000000
    0004: ffffffff ffffffff ffffffff 000c0000 3fff0000 0fcfcc3f f3ff8007 033fc3fc
    000e: 00000000 80000000 00000000 00000000 00000000 00000000 00000000 00000000
    001e: 00000000 00000000 00000000 00000000 4000003f ffffffff ffffffff 03ffffff
    0020: 77180000 06010047 00000010 03f10000 000003ff a7367f52 00000000 00000000
    0021: 00480000 00004044 7ffb0000 00000000 03ff0000 0ccf0600 00000050 00000000
    0022: 44068044 00000800 00000100 00000031 00000000 00000000 00000000 00000000
    0025: 00000000 00000000 00000000 00000000 00000000 00000000 00000400 00000000
    0027: 00080000 00000000 00001000 00000000 00000000 00000000 00000000 00000000
    002b: 0003c000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
    00f6: 00000000 00000000 00000000 00000000 00000000 00000000 01800000 00000000
    00fb: 00000006 00000000 00000000 00000000 00000000 00000000 00000000 00000000
(s)
    lang: aa|af|av|ay|az-az|ba|be|bg|bi|bin|br|bs|bua|ca|ce|ch|chm|co|cs|cv|cy|da|de|en|eo|es|et|eu|fi|fj|fo|fr|fur|fy|gd|gl|gn|gv|haw|ho|hr|hu|ia|ig|id|ie|ik|io|is|it|kaa|ki|kk|kl|kum|kv|ky|la|lb|lez|lt|lv|mg|mh|mk|mo|mt|nb|nds|nl|nn|no|nr|nso|ny|oc|om|os|pl|pt|rm|ro|ru|sah|se|sel|sh|sk|sl|sm|sma|smj|smn|so|sq|sr|ss|st|sv|sw|tg|tk|tl|tn|to|tr|ts|tt|tyv|uk|uz|vi|vo|vot|wa|wen|wo|xh|yap|zu|an|crh|csb|fil|hsb|ht|jv|kj|ku-tr|kwm|lg|li|mn-mn|ms|na|ng|pap-an|pap-aw|rn|rw|sc|sg|sn|su|ty|za(s)
    fontversion: 131137(i)(s)
    capability: "otlayout:DFLT otlayout:cyrl otlayout:latn"(s)
    fontformat: "CFF"(s)
    decorative: False(s)
    postscriptname: "IBMPlexMono"(s)
    color: False(s)
    symbol: False(s)
    variable: False(s)
BoldMonday commented 2 years ago

Is it possible you are using an older version of the fonts? In that case this might be a case of font substitution by the system and are the spaces from a different font perhaps.

Box drawing glyphs were added to IBM Plex Mono version 2.3 which was released in September last year.

I’m unfamiliar with the applications in question and don’t have access to a Linux installation to check if this issue can be reproduced.

sdbbs commented 2 years ago

Thanks, @BoldMonday :

Is it possible you are using an older version of the fonts?

Could be, I'm not sure; that is why I included the output of fc-scan - it only says: fontversion: 131137(i)(s), but I'm not sure how to translate/understand that; it doesn't look like the semver strings used here (e.g. latest release currently is tagged v6.0.0)

In that case this might be a case of font substitution by the system and are the spaces from a different font perhaps.

Box drawing glyphs were added to IBM Plex Mono version 2.3 which was released in September last year.

Indeed, there seems to be font substitution - I've found:

... Gucharmap will display the origin font when you right-click on a glyph.

... and this is what I get for BOX DRAWINGS LIGHT DOWN AND LEFT in IBM Plex Mono:

image

So yeah, in my case, that character's glyph is actually delivered by DejaVu Sans ...

Then again, I still don't see why that fact would have influence on the width of the spaces preceding that character ...

I thought there might exist "hidden font commands" that do this when a glyph is rendered, and so I suspected the IBM Plex Mono font - but it looks like, the problem originates somewhere else (maybe in the glyph substitution engine?)

In any case, if there are any other suggestions to debug this, I'd appreciate it!

BoldMonday commented 2 years ago

Could be, I'm not sure; that is why I included the output of fc-scan - it only says: fontversion: 131137(i)(s), but I'm not sure how to translate/understand that; it doesn't look like the semver strings used here (e.g. latest release currently is tagged v6.0.0)

I have no idea how to interpret that long version number either. It’s not how we define that field when developing fonts.

A note about versions: this repository uses release numbers (such as 6.0) everytime new fonts are added or when existing fonts are changed. The fonts themselves contain individual font version numbers (such as 2.3 for the latest Plex Mono). Because not all fonts change with every new release.

In any case, if there are any other suggestions to debug this, I'd appreciate it!

I recommend to get the latest version of Plex Mono from this repository. That should fix the problem. And perhaps file a bug report to the maintainers of the applications in question. It’s definitely font substitution that is creating unexpected results.