afdko icon indicating copy to clipboard operation
afdko copied to clipboard

[makeotf] NameRecord `1, 0, 0, 4` becomes absent when localized names are given

Open takaakifuji opened this issue 3 years ago • 1 comments

$ python << EOS
import defcon
font = defcon.Font()
font.newGlyph('.notdef')
font.info.postscriptFontName = 'UntitledSans-Light'
font.save(path='UntitledSans-Light.ufo')
EOS

$ cat << EOS > FontMenuNameDB
[UntitledSans-Light]
	f=3,1,1041,\540d\79f0\672a\8a2d\5b9a\30b4\30b7\30c3\30af
	s=3,1,1041,Light
	l=3,1,1041,\540d\79f0\672a\8a2d\5b9a\30b4\30b7\30c3\30af Light
	f=Untitled Sans
	s=Light
	l=Untitled Sans Light
EOS

$ makeotf -r -f UntitledSans-Light.ufo -o UntitledSans-Light.otf

The shell commands above generate nameID=4 records as follows:

$ ttx -t 'name' -o - UntitledSans-Light.otf | grep -A2 'nameID="4"'
Dumping "UntitledSans-Light.otf" to "-"...
Dumping 'name' table...
    <namerecord nameID="4" platformID="1" platEncID="0" langID="0x0" unicode="True">
      Untitled Sans Light
    </namerecord>
--
    <namerecord nameID="4" platformID="3" platEncID="1" langID="0x409">
      Untitled Sans Light
    </namerecord>
--
    <namerecord nameID="4" platformID="3" platEncID="1" langID="0x411">
      名称未設定ゴシック Light
    </namerecord>

However, adding localised names for platformID=1 seems to discard the 1, 0, 0, 4 record, as shown below:

$ cat << EOS > FontMenuNameDB
[UntitledSans-Light]
	f=3,1,1041,\540d\79f0\672a\8a2d\5b9a\30b4\30b7\30c3\30af
	s=3,1,1041,Light
	l=3,1,1041,\540d\79f0\672a\8a2d\5b9a\30b4\30b7\30c3\30af Light
	f=1,1,11,\96\bc\8f\cc\96\a2\90\dd\92\e8\83\53\83\56\83\62\83\4e
	s=1,1,11,Light
	l=1,1,11,\96\bc\8f\cc\96\a2\90\dd\92\e8\83\53\83\56\83\62\83\4e Light
	f=Untitled Sans
	s=Light
	l=Untitled Sans Light
EOS

$ makeotf -r -f UntitledSans-Light.ufo -o UntitledSans-Light.otf

$ ttx -t 'name' -o - UntitledSans-Light.otf | grep -A2 'nameID="4"'
Dumping "UntitledSans-Light.otf" to "-"...
Dumping 'name' table...
    <namerecord nameID="4" platformID="1" platEncID="1" langID="0xb" unicode="True">
      名称未設定ゴシック Light
    </namerecord>
--
    <namerecord nameID="4" platformID="3" platEncID="1" langID="0x409">
      Untitled Sans Light
    </namerecord>
--
    <namerecord nameID="4" platformID="3" platEncID="1" langID="0x411">
      名称未設定ゴシック Light
    </namerecord>

At the first sight I thought 1, 0, 0, 4 should be maintained regardless of localised names, but it wasn't. Is this an expected behaviour for the FontMenuNameDB v2 syntax?

takaakifuji avatar Jul 21 '22 02:07 takaakifuji