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

Correct path direction for mark glyphs #87

Merged
merged 9 commits into from
Dec 4, 2020
Merged

Correct path direction for mark glyphs #87

merged 9 commits into from
Dec 4, 2020

Conversation

m4rc1e
Copy link
Collaborator

@m4rc1e m4rc1e commented Nov 17, 2020

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
Copy link
Contributor

mikedug commented Nov 17, 2020

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

@m4rc1e
Copy link
Collaborator Author

m4rc1e commented Nov 17, 2020

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

@mikedug
Copy link
Contributor

mikedug commented Nov 17, 2020

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

@m4rc1e
Copy link
Collaborator Author

m4rc1e commented Nov 17, 2020

@mikedug
Copy link
Contributor

mikedug commented Nov 17, 2020

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
Copy link
Collaborator Author

m4rc1e commented Nov 17, 2020

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
Copy link
Contributor

mikedug commented Nov 17, 2020

old
new

@mikedug
Copy link
Contributor

mikedug commented Nov 17, 2020

Hi Marc, are you seeing something different to this?

@m4rc1e
Copy link
Collaborator Author

m4rc1e commented Nov 17, 2020

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
Copy link
Contributor

mikedug commented Nov 17, 2020

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
Copy link
Contributor

mikedug commented Nov 17, 2020

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
Copy link
Collaborator Author

m4rc1e commented Nov 17, 2020

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:

  • Iterate through all glyphs:
    • If a glyph isn't a composite, skip it
    • If a glyph is a composite and it has less than 2 composites, skip it as well
      • Decompose the composite glyph
      • Store all nodes in a list called before_points
      • Auto fix the path direction
      • Store all nodes again in another list called after_points
      • Compare before_points against after_points
        • If points are different, print out the name of the glyph that has changed

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
Copy link
Collaborator Author

m4rc1e commented Nov 18, 2020

@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
Copy link
Contributor

mikedug commented Nov 18, 2020

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
Copy link
Collaborator Author

m4rc1e commented Nov 18, 2020

That sounds great Mike. Thank you!

@mikedug
Copy link
Contributor

mikedug commented Nov 19, 2020

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
Copy link
Contributor

mikedug commented Nov 20, 2020

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
Copy link
Collaborator Author

m4rc1e commented Nov 23, 2020

@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
Copy link
Contributor

mikedug commented Nov 23, 2020

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
Copy link
Contributor

mikedug commented Nov 23, 2020

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
Copy link
Contributor

mikedug commented Nov 24, 2020

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
Copy link
Collaborator Author

m4rc1e commented Nov 24, 2020

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

@m4rc1e
Copy link
Collaborator Author

m4rc1e commented Nov 24, 2020

LGTM

glyphs_modified

Thanks Mike!

@m4rc1e m4rc1e merged commit 3852c00 into master Dec 4, 2020
@m4rc1e m4rc1e deleted the direction branch December 9, 2020 15:22
m4rc1e added a commit that referenced this pull request Jul 8, 2022
m4rc1e added a commit that referenced this pull request Jul 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mark glyphs with incorrect contour directions
2 participants