Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Noto Sans Mono CJK fonts have no spacing property #122

Closed
LionNatsu opened this issue Apr 10, 2018 · 16 comments
Closed

Noto Sans Mono CJK fonts have no spacing property #122

LionNatsu opened this issue Apr 10, 2018 · 16 comments

Comments

@LionNatsu
Copy link

Same as https://github.com/googlei18n/noto-fonts/issues/1128.

I also wrote somethings about the reason why KDE Konsole and other Qt application does not consider Noto Sans Mono (CJK) monospace fonts in https://github.com/googlei18n/noto-fonts/issues/1128#issuecomment-379988287.

@LionNatsu
Copy link
Author

I scanned a latest Mono font and fc-scan showed:

$ fc-scan NotoSansMonoCJKsc-Regular.otf 
Pattern has 24 elts (size 32)
        family: "Noto Sans Mono CJK SC"(s) "Noto Sans Mono CJK SC Regular"(s)
        familylang: "en"(s) "en"(s)
        style: "Regular"(s)
        stylelang: "en"(s)
        fullname: "Noto Sans Mono CJK SC Regular"(s)
        fullnamelang: "en"(s)
        slant: 0(i)(s)
        weight: 80(f)(s)
        width: 100(f)(s)
        foundry: "GOOG"(s)
        file: "NotoSansMonoCJKsc-Regular.otf"(s)
        index: 0(i)(s)
        outline: True(s)
        scalable: True(s)
        charset: 
        0000: 00000000 ffffffff ffffffff 7fffffff 00000000 ffffffff ffffffff ffffffff
        0001: ........
        02f9: 04008808 00000003 000000a0 00001000 00300000 10040000 c0110000 00100000
(s)
        lang: aa|.........za(s)
        fontversion: 65798(i)(s)
        capability: "otlayout:DFLT otlayout:cyrl otlayout:grek otlayout:hang otlayout:hani otlayout:kana otlayout:latn"(s)
        fontformat: "CFF"(s)
        decorative: False(s)
        postscriptname: "NotoSansMonoCJKsc-Regular"(s)
        color: False(s)
        symbol: False(s)
        variable: False(s)

Expected results: spacing: 100

@marekjez86
Copy link
Contributor

@behdad : you updated fc-scan man page last time, so you might know... how do we set spacing in the sources (this could be a source issue or a pipeline issue)?

@LionNatsu
Copy link
Author

Oh, not 100 (FC_MONO), it should be 90 (FC_DUAL).

@kenlunde
Copy link

Inquiring minds would like to know what particular table settings or font attributes trigger the fc-scan spacing value 90 (FC_DUAL). 🤔

@behdad
Copy link

behdad commented Apr 23, 2018

Inquiring minds would like to know what particular table settings or font attributes trigger the fc-scan spacing value 90 (FC_DUAL). thinking

It checks the advance widths of all cmap characters. If there's only two values and one is approximately twice the other, it sets FC_DUAL.

Now, checking the code, I don't think it ignores zero advance widths. That doesn't sound right to me.

@tagoh
Copy link

tagoh commented Jul 31, 2018

Any progress on this issue? apparently Noto Sans Mono CJK fonts has so many advance widths there. if checking the advance widths are the right way to figure out, that looks not monospaced fonts to me.

@behdad
Copy link

behdad commented Aug 1, 2018

Humm. What's Noto Sans Mono CJK? Do we even have such a font?

@kenlunde
Copy link

kenlunde commented Aug 1, 2018

Such fonts were built only for two weights, Regular and Bold, and differ from the standard (non-Mono) fonts by mapping the ASCII range to half-width glyphs.

One of my colleagues deployed Source Han Code JP, a derivative of Source Han Sans (Japanese) that used a different approach, but there are still issues with some environments, in terms of treating the font as monospaced. For example, see Issue notofonts/noto-fonts#14 in its repository.

Some of our testing even suggested that TrueType fonts might be special-cased for this.

@tagoh
Copy link

tagoh commented Aug 2, 2018

@behdad that is one of faces in NotoSansCJK-*.ttc.

@tagoh
Copy link

tagoh commented Aug 2, 2018

@kenlunde That's true. and FC_DUAL can be used to take care of such fonts though, Noto Sans Mono CJK isn't considered a monospaced font even so far, properly speaking, not considered FC_DUAL but FC_PROPOTIONAL.

@LionNatsu
Copy link
Author

LionNatsu commented Aug 2, 2018

Emmm... @behdad

Now, checking the code, I don't think it ignores zero advance widths. That doesn't sound right to me.

fontconfig: src/fcfreetype.c

bf4d440e (Behdad Esfahbod    2017-09-27 12:31:03 -0400 2392)        if (!FT_Get_Advance (face, glyph, load_flags, &advance) && advance)

I think && advance does ignore zero advance widths

@kenlunde
Copy link

kenlunde commented Aug 2, 2018

@tagoh I have seen references to FC_DUAL before, but what has never been clear to me, as a font developer, is where in the font that this flag is set, in terms of which 'sfnt' table and which specific table setting. The setting seems to be external to the font resource.

@behdad
Copy link

behdad commented Aug 3, 2018

I think && advance does ignore zero advance widths

Right. Thanks :)

@behdad
Copy link

behdad commented Aug 3, 2018

The setting seems to be external to the font resource.

Yes, fontconfig checks all the advances in the font, and if they only have two non-zero values, one double the other, it assigns FC_DUAL to the font.

@kenlunde
Copy link

kenlunde commented Aug 3, 2018

@behdad The Source Han Code JP fonts have two primary non-zero glyph advances: 1000 and 667. There are also a much smaller number of other glyph advances, such as 2000 and 3000 for U+2E3A and U+2E3B, respectively, 500 for a small number of genuine half-width glyphs, 920 for Compatibility Jamo (not sure why these glyphs are included in a Japanese-specific font), and 250 for two Korean-specific characters (again, not sure why these glyphs were included).

The "double the other" probably needs to be reconsidered as two different non-zero advances to cover the case of 667 and 1000.

cc @hatchzo

@davelab6
Copy link
Member

This seems out of scope to me, and like a bug to report in font-config.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants