satbyy / go-noto-universal

Noto fonts go universal! Download pan-Unicode, merged Noto fonts according to time of usage (current, ancient) or geographical region (South Asia, SE Asia, Africa-MiddleEast, Europe-Americas).
Other
157 stars 22 forks source link

Noto Sans Nandinagari Regular could not be merged #6

Closed satbyy closed 2 years ago

satbyy commented 2 years ago

Currently fonttools doesn't support merging when one of the inputs has different tables not present in the other. In the following example, NotoSans-Regular doesn't have vmtx.

pyftmerge --verbose NotoSansNandinagari-Regular.ttf  NotoSans-Regular.ttf
Merging 'cmap'.
Merged 'cmap'.
Merging 'GSUB'.
Merged 'GSUB'.
Merging 'GDEF'.
Merged 'GDEF'.
Merging 'head'.
Merged 'head'.
Merging 'cvt '.
Merged 'cvt '.
Merging 'gasp'.
Merged 'gasp'.
Merging 'DSIG'.
Don't know how to merge 'DSIG'.
Dropped 'DSIG'.
Merging 'loca'.
Merging 'vmtx'.
Traceback (most recent call last):
  File "/home/ubuntu/projects/go-noto-universal/venv_fonty/bin/pyftmerge", line 8, in <module>
    sys.exit(main())
  File "/home/ubuntu/projects/go-noto-universal/venv_fonty/lib/python3.8/site-packages/fontTools/misc/loggingTools.py", line 372, in wrapper
    return func(*args, **kwds)
  File "/home/ubuntu/projects/go-noto-universal/venv_fonty/lib/python3.8/site-packages/fontTools/merge.py", line 1276, in main
    font = merger.merge(fontfiles)
  File "/home/ubuntu/projects/go-noto-universal/venv_fonty/lib/python3.8/site-packages/fontTools/merge.py", line 1097, in merge
    table = clazz(tag).merge(self, tables)
  File "/home/ubuntu/projects/go-noto-universal/venv_fonty/lib/python3.8/site-packages/fontTools/merge.py", line 156, in merge
    return m.mergeObjects(self, self.mergeMap, tables)
  File "/home/ubuntu/projects/go-noto-universal/venv_fonty/lib/python3.8/site-packages/fontTools/merge.py", line 1154, in mergeObjects
    value = mergeLogic(getattr(table, key, NotImplemented) for table in tables)
  File "/home/ubuntu/projects/go-noto-universal/venv_fonty/lib/python3.8/site-packages/fontTools/merge.py", line 88, in sumDicts
    d.update(item)
TypeError: 'NotImplementedType' object is not iterable

Above is with fonttools 4.28.3

satbyy commented 2 years ago

Font merging succeeds with fonttools/fonttools#2473 when Noto Sans Regular is the first argument and vmtx is dropped explicitly (with Nandinagari as first argument, fails with above error):

fonttools merge --verbose --drop-tables+=vhea,vmtx \
    NotoSans-Regular.ttf  NotoSansNandinagari-Regular.ttf  

Merging 'cmap'.
Merged 'cmap'.
Merging 'GSUB'.
Merged 'GSUB'.
Merging 'cvt '.
Merged 'cvt '.
Merging 'maxp'.
Merged 'maxp'.
Merging 'DSIG'.
Don't know how to merge 'DSIG'.
Dropped 'DSIG'.
Merging 'name'.
Merged 'name'.
Merging 'post'.
Merged 'post'.
Merging 'gasp'.
Merged 'gasp'.
Merging 'GPOS'.
Merged 'GPOS'.
Merging 'prep'.
Merged 'prep'.
Merging 'hmtx'.
Merged 'hmtx'.
Merging 'STAT'.
Don't know how to merge 'STAT'.
Dropped 'STAT'.
Merging 'OS/2'.
Merged 'OS/2'.
Merging 'gasp'.
Merged 'gasp'.

However, the resulting glyphs of combining characters are shifted to the right and not to the attached to the base consonant:

image

Test sequence: 𑦮𑧖𑧌𑧠𑦼

dscorbett commented 2 years ago

When I try it, both NotoSansNandinagari-Regular.ttf and merged.ttf produce this output.

[Ka.Nnagari=0+848|MatraR.Nnagari=0@-273,0+0|SsaNna.Nnagari=2+725]

𑦮𑧖𑧌𑧠𑦼 That’s different from the expected output in your last comment. How did you generate that image?

satbyy commented 2 years ago

@dscorbett Ah, I just tried it in Libreoffice. Yours is certainly correct. It is very similar to Devanagari कृष्ण (as it should be). Which application did you use?

dscorbett commented 2 years ago

I used hb-view, HarfBuzz’s viewing utility. It should work in anything that uses HarfBuzz, including Chrome, Firefox, and LibreOffice.

satbyy commented 2 years ago

It seems that the cached Dogra font in git repo (cached_fonts/NotoSerifDogra-Regular.ttf) can be removed once fonttools/fonttools#2473 is resolved. Otherwise, it currently displays the same error msg as above for Nandinagari.

satbyy commented 2 years ago

Hmm. I was too quick in closing the issue.