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

[comparefamily] [agd] trouble with five-digit code points #1207

Closed
frankrolf opened this issue Aug 11, 2020 · 0 comments · Fixed by #1208
Closed

[comparefamily] [agd] trouble with five-digit code points #1207

frankrolf opened this issue Aug 11, 2020 · 0 comments · Fixed by #1208

Comments

@frankrolf
Copy link
Member

I noticed the comparefamily report for some code points in Source Serif was suspicious:

	Warning. Font uses working name 'u1F16A' rather than Adobe final name 'u1F160'. SourceSerif4-Regular
	Warning. Font uses working name 'u1F16B' rather than Adobe final name 'u1F160'. SourceSerif4-Regular

The code points in question are

  • U+1F16A RAISED MC SIGN 🅪
  • U+1F16B RAISED MD SIGN 🅫

comparefamily suggests the final name (and hence the code point) should be U+1F160 NEGATIVE CIRCLED LATIN CAPITAL LETTER Q 🅠 – wrong, of course.

When investigating, I noticed that the method for getting the final glyph name returns false results for almost all five-digit code points:

import os
import unicodedata
from afdko import agd, fdkutils
print(agd.__file__)
resources_dir = fdkutils.get_resources_dir()
kAGD_TXTPath = os.path.join(resources_dir, "AGD.txt")
print('AGD file used:', kAGD_TXTPath)
fp = open(kAGD_TXTPath, "r")
agdTextPath = fp.read()
fp.close()
gAGDDict = agd.dictionary(agdTextPath)

codepoint_start = int('10000', 16)
codepoint_end = int('FFFFF', 16) + 1
for i in range(codepoint_start, codepoint_end):
    hex_value = '{0:5X}'.format(i)
    u_name = 'u' + hex_value

    if gAGDDict.glyph(u_name):
        print(u_name)
        try:
            ud_name = unicodedata.name(chr(i))
            print(ud_name)
        except ValueError:
            print('no unicode name')
        print(gAGDDict.glyph(u_name).name)
        print(gAGDDict.glyph(u_name).uni)  # gets truncated to 4 digits
        print()

(this code is mostly pulled from comparefamily.py)

Looking through agd.py it seems that five-digit Unicode names are simply not expected:

self.uni = re.compile(r'[0-9A-F]{4}').search(x).group() # Unicode value

u = re.compile(r'uni([0-9A-F]{4})$') # Unicode value regexp

I fixed this in my local agd.py, and will send a PR in a minute.

frankrolf added a commit that referenced this issue Aug 11, 2020
josh-hadley pushed a commit that referenced this issue Aug 22, 2020
1div0 pushed a commit to 1div0/afdko that referenced this issue Dec 29, 2020
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 a pull request may close this issue.

1 participant