[feaLib] "language dflt;" gets put into DFLT script
See original GitHub issuefoo.fea:
languagesystem latn dflt;
feature liga {
script latn;
sub a by x;
} liga;
feature liga {
script latn;
language dflt;
sub b by y;
} liga;
$ shape foo.ttf 'abc'
[x=0+1073|b=1+1255|c=2+975]
What?
<ScriptList>
<!-- ScriptCount=2 -->
<ScriptRecord index="0">
<ScriptTag value="DFLT"/>
<Script>
<DefaultLangSys>
<ReqFeatureIndex value="65535"/>
<!-- FeatureCount=1 -->
<FeatureIndex index="0" value="0"/>
</DefaultLangSys>
<!-- LangSysCount=0 -->
</Script>
</ScriptRecord>
<ScriptRecord index="1">
<ScriptTag value="latn"/>
<Script>
<DefaultLangSys>
<ReqFeatureIndex value="65535"/>
<!-- FeatureCount=1 -->
<FeatureIndex index="0" value="1"/>
</DefaultLangSys>
<!-- LangSysCount=0 -->
</Script>
</ScriptRecord>
</ScriptList>
<FeatureList>
<!-- FeatureCount=2 -->
<FeatureRecord index="0">
<FeatureTag value="liga"/>
<Feature>
<!-- LookupCount=1 -->
<LookupListIndex index="0" value="1"/>
</Feature>
</FeatureRecord>
<FeatureRecord index="1">
<FeatureTag value="liga"/>
<Feature>
<!-- LookupCount=1 -->
<LookupListIndex index="0" value="0"/>
</Feature>
</FeatureRecord>
</FeatureList>
<LookupList>
<!-- LookupCount=2 -->
<Lookup index="0">
<LookupType value="1"/>
<LookupFlag value="0"/>
<!-- SubTableCount=1 -->
<SingleSubst index="0">
<Substitution in="a" out="x"/>
</SingleSubst>
</Lookup>
<Lookup index="1">
<LookupType value="1"/>
<LookupFlag value="0"/>
<!-- SubTableCount=1 -->
<SingleSubst index="0">
<Substitution in="b" out="y"/>
</SingleSubst>
</Lookup>
</LookupList>
That’s right, even though we asked for it to go into latn/dflt
, it goes into DFLT/dflt
! I don’t know if this is a feaLib builder bug, or a bug in the AFDKO spec, but it certainly doesn’t seem right.
(This is significant because ufo2ft feature writers write into <script>/dflt
.)
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Source code for fontTools.feaLib.builder
feaLib.variableScalar import VariableScalar from fontTools. ... ScriptCount > 0 or table.FeatureList. ... b.i if script == "DFLT" and language == "dflt" and ...
Read more >fonttools/builder.py at main - GitHub
A library to manipulate font files from Python. Contribute to fonttools/fonttools development by creating an account on GitHub.
Read more >Introduction to OpenType Programming
In this chapter, we're going to begin to look at these instructions, how we get them into our font, and how they work;...
Read more >fonttools [python-library] - Occam :: Details
fontTools is a library for manipulating fonts, written in Python. ... [feaLib] Allow any languages other than dflt under DFLT script (#1278, #1292)....
Read more >PKG-INFO - platform/external/fonttools - android Git repositories
fontTools is a library for manipulating fonts, written in Python. The ... [feaLib] Allow any languages other than ``dflt`` under ``DFLT`` script.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes, it does. But this is still weird.
Okay, so maybe the problem is more a combination of this:
https://github.com/fonttools/fonttools/blob/31ba5e6b2428b088df6d0db029ac4e7d3d49bcd4/Lib/fontTools/feaLib/builder.py#L1024-L1026
and
https://github.com/fonttools/fonttools/blob/31ba5e6b2428b088df6d0db029ac4e7d3d49bcd4/Lib/fontTools/feaLib/builder.py#L1100-L1100
set_language
puts the lookup into(self.script_, language)
, andself.script_
is set toDFLT
if there is no otherscript
statement. There may not be aDFLT
script beforehand, but this combination (erroneously) creates one.