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

[AAT] No kerning for Times.ttc yet #1252

Closed
drott opened this issue Oct 15, 2018 · 10 comments
Closed

[AAT] No kerning for Times.ttc yet #1252

drott opened this issue Oct 15, 2018 · 10 comments
Labels
Chrome Chrome/Chromium project related issues and requests

Comments

@drott
Copy link
Collaborator

drott commented Oct 15, 2018

When bisecting the ~2900 Mac failures when rolling HarfBuzz in Chromium, even at the end of the investigation range of 339036d..fbbd926, at 1622ba5 I do not see the large number of failures yet (only the ~14 failures that have something to do with kerning in the range of db9600b..97e5913) as long as I do not remove compilation of hb-coretext.* - i.e. switch the shaper for Mac. I assume there is not anything in the last two commits from 1622ba5..fbbd926, so I think the difference comes from switch the Mac shaper from CoreText to OT:

Could it be there is an issue with default feature activation? Or is there an issue in the integration? But also, I have some findings from hb-view and hb-shape in HarfBuzz.

Testing locally with HarfBuzz at 8f3048a it looks like for /System/Library/Fonts/Times.ttc no kern is activated or computed:

$ ttx -l -y0 /System/Library/Fonts/Times.ttc 
Listing table info for "/System/Library/Fonts/Times.ttc":
    tag     checksum   length   offset
    ----  ----------  -------  -------
    OS/2  0xB05125F4       96     2472
    bsln  0x047F0816       72     2184
    cmap  0x344BC11E     6706   711560
    cvt   0x9B693F39     1054     8860
    fdsc  0x40192B36       48     1768
    feat  0x0005021E       28   711412
    fpgm  0x9C748D06     1416    15196
    glyf  0x039FCFD3   116680   476516
    hdmx  0x8FEE8772    23176   156556
    head  0x77382961       54     1960
    hhea  0x11FD0FC9       36     1624
    hmtx  0x9130EA17     5772    65596
    just  0x031801CA      120   711440
    kern  0xF953018D      708     3536
    loca  0xA6D38AE3     2888    35532
    maxp  0x0DEA07DD       32     1496
    meta  0xA7C67DEB     4624    51704
    morx  0x32AE1F71   199196   718268
    name  0xEAB2D8C2     1260     9916
    post  0xD364F808    16968    88684
    prep  0xEEC97ED7     1731    19572
    prop  0xC1FFA795      772     4996

So it has kern and morx.

Running

$ hb-view --shapers=coretext /System/Library/Fonts/Times.ttc "Text You" > text_you_coretext.png

results in

text_you_coretext

Running

hb-view --shapers=ot /System/Library/Fonts/Times.ttc "Text You" > text_you_ot.png

results in

text_you_ot

So, kerning is missing when shaping with ot. The e and o are not pulled in towards the T and Y respectively.

I've experimented with --features=+kern for ot, but that did not lead to a change.

When I disable kern in the CoreText shaper and compare against ot, I get an identical result.

$ hb-shape --shapers=coretext --features=-kern /System/Library/Fonts/Times.ttc "Text You" [T=0+1251|e=1+909|x=2+1024|t=3+569|space=4+512|Y=5+1479|o=6+1024|u=7+1024]

$ hb-shape --shapers=ot --features=-kern /System/Library/Fonts/Times.ttc "Text You" [T=0+1251|e=1+909|x=2+1024|t=3+569|space=4+512|Y=5+1479|o=6+1024|u=7+1024]

@drott drott added the Chrome Chrome/Chromium project related issues and requests label Oct 15, 2018
@drott drott added this to To do in AAT morx/kerx/trak support via automation Oct 15, 2018
@behdad
Copy link
Member

behdad commented Oct 15, 2018

Definitely kerns for me with master:

behdad:util 0$ ./hb-shape Times.ttc Yo --font-funcs=ot
[Y=0+1377|o=1@-102,0+922]
behdad:util 0$ ./hb-shape Times.ttc Yo --font-funcs=ot --features=-kern
[Y=0+1479|o=1+1024]

@drott
Copy link
Collaborator Author

drott commented Oct 15, 2018

Works for me on Linux as well.

./hb-shape ../Times.ttc "Yo"
[Y=0+1377|o=1@-102,0+922]

I'll experiment with --with/--without-coretext and check whether the Mac build has FT.

@drott
Copy link
Collaborator Author

drott commented Oct 15, 2018

On Mac:

Built with Coretext, with FreeType
$ ./configure --with-freetype=yes --with-coretext=yes
fails:

$ ./hb-shape --font-funcs=ot /System/Library/Fonts/Times.ttc "Yo"
[Y=0+1275|o=1+1024]

Built with
$./configure --with-freetype=yes --with-coretext=no
works:

$ ./hb-shape --font-funcs=ot /System/Library/Fonts/Times.ttc "Yo"
[Y=0+1377|o=1@-102,0+922]

Built with
$ ./configure --with-freetype=no --with-coretext=no
also succeeds:

$ ./hb-shape --font-funcs=ot /System/Library/Fonts/Times.ttc "Yo"
[Y=0+1377|o=1@-102,0+922]

which is all a bit odd, since in the initial attempt in Chrome, I did remote the two hb-coretext.* files and removed the HAVE_CORETEXT define.

Where is the kerning data retrieved, where could I set a breakpoint if I debug this within Chromium tomorrow?

@behdad
Copy link
Member

behdad commented Oct 15, 2018

So, that's inconsistent with your hb-view observation with --shaper=ot, no? What's going on?

@behdad
Copy link
Member

behdad commented Oct 15, 2018

You can breakpoint in hb-ot-kern.hh::hb_kern_machine_t::kern().

@drott
Copy link
Collaborator Author

drott commented Oct 15, 2018

Built with Coretext, with FreeType
$ ./configure --with-freetype=yes --with-coretext=yes
fails:

$ ./hb-shape --font-funcs=ot /System/Library/Fonts/Times.ttc "Yo"
[Y=0+1275|o=1+1024]

Okay, as discussed, this is as expected, CoreText adjusts the first glyph.

So, that's inconsistent with your hb-view observation with --shaper=ot, no? What's going on?

I probably made a mistake on my corp laptop, testing installed, vs. testing newly built versions. $ hb-shape vs $ ./hb-shape.

I'll test the San Francisco trak test that we have, as well making a kern example with Times.ttc.

@ebraminio
Copy link
Collaborator

The fact that the work here leads to better software quality and stability on Chrome makes me so happy. I wish Firefox also to follow the path also.

@behdad
Copy link
Member

behdad commented Oct 15, 2018

The fact that the work here leads to better software quality and stability on Chrome makes me so happy. I wish Firefox also to follow the path also.

Firefox was the first major adopter of HarfBuzz. Most of the Indic, USE, Myanmar, Khmer, Thai, etc shapers were written with me and @jfkthame sitting next to each other multiple days or weeks a year for the past ten years. I stopped counting a while back, but see: https://www.freedesktop.org/wiki/Software/HarfBuzz/Hackfests/

So, yeah, Firefox has been leading there. ;)

@behdad
Copy link
Member

behdad commented Oct 15, 2018

And morx/kerx was indeed motivated by Chrome's desire to use it instead of hb-coretext.

@drott
Copy link
Collaborator Author

drott commented Oct 16, 2018

It appears that KernTable::get_h_kerning is reached from hb-ot-kern.hh::hb_kern_machine_t::kern() and returns -204, which is then distributed as 102 and -102 for the "Yo" pair, but the resulting output still does not have kerning applied.

@brawer observes in issue #1255 that KERN table support appears broken in test case KERN-1, related?

@behdad behdad closed this as completed in 661340c Oct 16, 2018
AAT morx/kerx/trak support automation moved this from To do to Done Oct 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Chrome Chrome/Chromium project related issues and requests
Projects
No open projects
Development

No branches or pull requests

3 participants