googlefonts / roboto-classic

Development of a Roboto Variable font
SIL Open Font License 1.1
150 stars 15 forks source link

Correct path direction for mark glyphs #87

Closed m4rc1e closed 3 years ago

m4rc1e commented 3 years ago

Contour direction has been fixed for mark glyphs:

glyph_name, glyph_index
uni02BD 366
uni02BF 368
uni030C 445
uni030F 448
commasuprevnosp 453
tackrightsubnosp 458
ringlefthalfsubnosp 461
tackdownsubnosp 463
hooksubretronosp 467
bridgesubnosp 475
uni032C 477
seagullsubnosp 493
uni0346 503
uni0349 506
uni0350 513
uni1DFF 1064
uni1FFD 1096
uniA675 1553

Fixes #86

@mikedug would you be willing to inspect the above glyphs in VTT? if so, I'll make you a src VTT font.

mikedug commented 3 years ago

yes, I can inspect the glyphs. Is this the first step, prior to rehinting any composites that use those components?

m4rc1e commented 3 years ago

I guess it's the first step. All I have done is correct the contour direction. I haven't done anything in VTT.

mikedug commented 3 years ago

Ok, please prepare a src VTT font for me to inspect

m4rc1e commented 3 years ago

@mikedug here you go https://github.com/TypeNetwork/Roboto/blob/direction/sources/Roboto%5Bital%2Cwdth%2Cwght%5D_VTT.ttf

mikedug commented 3 years ago

hi Marc, before we go any further, I am wondering if its possible to address this issues for all effected glyphs, just by changing the winding direction in the composite. an example. In the font where you made the changes

uni0200 (GID 2864) Capital Latin A with Double Grave, now has the same winding direction for both Cap A and for Double Grave, (GID 448) whereas in the previous font the winding direction was different between the Cap A and double grave

but

uni0201 (GID 2865) Latin small letter a with Double Grave, now has a different winding direction for small 'a' and for Double Grave, (GID 448) whereas in the previous font the winding direction the same

m4rc1e commented 3 years ago

uni0201 (GID 2865) Latin small letter a with Double Grave, now has a different winding direction for small 'a' and for Double Grave, (GID 448) whereas in the previous font the winding direction the same

Got a screenshot? I don't see it in the vtt source I provided.

mikedug commented 3 years ago

old new

mikedug commented 3 years ago

Hi Marc, are you seeing something different to this?

m4rc1e commented 3 years ago

Hey Mike, I'm seeing the same thing which is good. However, I believe every contour in the last image is clockwise which is what we want. Look at the top right corner of the "a". Nodes 15, 16, 17, 18, 19 show that it is indeed clockwise in direction.

mikedug commented 3 years ago

apologies for that, yes you are correct.

Let me double check all of the accented glyphs that use the components with the corrected winding direction. Will report back, will most likely be tomorrow.

mikedug commented 3 years ago

ok, looks good

GID 448 and GID 1096 are referenced in the glyph program for a number of composites. All of these composites now have the same winding order for base glyph and for accent.

the other glyphs listed now all have clockwise direction, but none of these are referenced in the glyph program for any accented glyphs.

Glyphs needing attention to ensure hinting is updated to reference the correct points = All glyphs that had winding direction changed, and all composites that reference those glyphs.

m4rc1e commented 3 years ago

Let me double check all of the accented glyphs that use the components with the corrected winding direction. Will report back, will most likely be tomorrow.

No need. I just wrote a script script to check this

from glob import glob
import defcon

def get_points(glyph):
    res = []
    for path in glyph:
        for node in path:
            res.append((node.x, node.y))
    return res

srcs = glob("sources/*.ufo")

f = defcon.Font(srcs[0])
for glyph in f:
    if glyph.components and len(glyph.components) > 1:
        assert glyph.components
        glyph.decomposeAllComponents()
        before_points = get_points(glyph)
        glyph.correctContourDirection()
        after_points = get_points(glyph)

        if before_points != after_points:
            print(glyph.name)

Script heuristic:

when I run the script, on this PR, we've got issues with the following glyphs

glyph_name, glyph_gid
uni04E2.smcp 881
uni0356 1118
uni042B.smcp 1993
uni0419.smcp 2816

I'll fix the contour direction for these glyphs tomorrow.

m4rc1e commented 3 years ago

@mikedug I've just updated the contour directions for

uni0418.smcp 1918
uni02F2 419 
uni042C.smcp 1928

Changing the direction for these glyphs will fix the contour direction for the glyphs I listed in my previous post.

I've also regenerated the src VTT file, https://github.com/TypeNetwork/Roboto/blob/direction/sources/Roboto%5Bital%2Cwdth%2Cwght%5D_VTT.ttf

Could you take a look? I'm guess since I've just changed the direction of some base glyphs that the hinting is now broken. Would you be able to paste the VTT code here or update the VTT src?

mikedug commented 3 years ago

hi Marc thanks. I can take the VTT src you provided, review the changes, and re-hint all necessary glyphs. This will a few days, probably will have the file ready by Friday 20th? does that sound ok. I will keep you updated if I run into any issues.

m4rc1e commented 3 years ago

That sounds great Mike. Thank you!

mikedug commented 3 years ago

hi Marc

The re-hinting, testing, proofing, is completed. I want to do some further testing and proofing on the font tomorrow, before sharing. please find enclosed a report on the work completed. Please let me know how you would like me to share the updated VTT src with you tomorrow.

thanks Mike RobotoWindingDirectionReHint.pdf

mikedug commented 3 years ago

I opened a PR, Marc, please let me know if you get the file. I will follow up to ensure with you that the fixes correct the issue. Font hinting has been updated per the report I sent earlier. Font complies in VTT with no errors. Proofing and Hinting for all glyphs completed. additional proofing to ensure no other errors completed.

m4rc1e commented 3 years ago

@mikedug thanks it looks excellent!

Here's what I gave you:

glyphs_modified

After your corrections:

glyphs_modified

It looks like unia675 (gid 1553) has moved a tiny amount, is it possible to avoid this or are we stuck with it?

mikedug commented 3 years ago

thanks

I had hinted 1553 in a slightly different way, as good, but the rounding is slightly different.

If you want the same rounding behavior / positioning as before, you can use the following hints for GID 1553 (unia675)

/ VTTTalk glyph 1553, char 0xa675 / / GUI generated Mon Nov 23 16:26:43 2020 /

/ Y direction / YAnchor(7) YShift(7,5) YAnchor(5) YShift(5,0,3) YShift(5,9) YShift(7,11) YShift(11,1) YShift(11,2)

/ X direction /

Smooth()

mikedug commented 3 years ago

code above is the VTT Talk, this is the compiled glyph program code for GID 1553, char 0xa675

/ TT glyph 1553, char 0xa675 / / VTT 6.33 compiler Mon Nov 23 16:27:37 2020 / SVTCA[Y] MDAP[R], 7 SHP[1], 5 MDAP[R], 5 SHP[1], 0 SHP[1], 3 SHP[1], 9 SRP1[], 7 SHP[1], 11 SRP1[], 11 SHP[1], 1 SHP[1], 2 IUP[Y] IUP[X]

mikedug commented 3 years ago

the font has been updated, and a new PR opened. Please let me know, if your testing can confirm all ok, and that the original problem has been addressed by this update.

m4rc1e commented 3 years ago

Thanks, I've just added the instructions you've posted above. I'll inspect the fonts once they've finished generating.

m4rc1e commented 3 years ago

LGTM

glyphs_modified

Thanks Mike!