Skip to content

Commit

Permalink
Merge pull request #173 from googlefonts/rethink-upconvert
Browse files Browse the repository at this point in the history
Undo upconverting shadow axes: the solution was not correct
  • Loading branch information
justvanrossum authored Apr 19, 2024
2 parents 3c9b913 + e05bfff commit 54f23fc
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 24 deletions.
11 changes: 7 additions & 4 deletions src/fontra_rcjk/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,8 @@ def buildVariableGlyphFromLayerGlyphs(layerGlyphs, fontAxes) -> VariableGlyph:
layers=layers,
)

if not defaultGlyph.lib.get("robocjk.localAxes.behavior.2024", False):
upconvertShadowAxes(glyph, fontAxes)
# if not defaultGlyph.lib.get("robocjk.localAxes.behavior.2024", False):
# upconvertShadowAxes(glyph, fontAxes)

return glyph

Expand All @@ -239,6 +239,8 @@ def upconvertShadowAxes(glyph, fontAxes):
if fontAxisNames.isdisjoint(glyphAxisNames):
return

defaultLocation = {axis.name: axis.defaultValue for axis in fontAxes + glyph.axes}

glyphAxesByName = {axis.name: axis for axis in glyph.axes}

for fontAxis in fontAxes:
Expand All @@ -260,7 +262,8 @@ def upconvertShadowAxes(glyph, fontAxes):
)

for source in glyph.sources:
v = source.location.get(axisName)
sourceLocation = defaultLocation | source.location
v = sourceLocation.get(axisName)
if v is not None:
source.location[axisName] = piecewiseLinearMap(v, mapping)

Expand Down Expand Up @@ -400,7 +403,7 @@ def buildLayerGlyphsFromVariableGlyph(
defaultGlyph.lib.pop("fontra.layerNames", None)

# Mark that we shouldn't try to upconvert shadow axes
defaultGlyph.lib["robocjk.localAxes.behavior.2024"] = True
# defaultGlyph.lib["robocjk.localAxes.behavior.2024"] = True

return layerGlyphs

Expand Down
2 changes: 0 additions & 2 deletions tests/data/figArnaud.rcjk/characterGlyph/a.glif
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ some note
</outline>
<lib>
<dict>
<key>robocjk.localAxes.behavior.2024</key>
<true/>
<key>robocjk.status</key>
<integer>0</integer>
<key>robocjk.variationGlyphs</key>
Expand Down
2 changes: 0 additions & 2 deletions tests/data/figArnaud.rcjk/characterGlyph/uni0030.glif
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@
</dict>
</dict>
</array>
<key>robocjk.localAxes.behavior.2024</key>
<true/>
<key>robocjk.status</key>
<integer>0</integer>
<key>robocjk.variationGlyphs</key>
Expand Down
20 changes: 4 additions & 16 deletions tests/test_font.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,9 @@
(
"rcjk",
{
"axes": [],
"axes": [
{"defaultValue": 0.0, "maxValue": 1.0, "minValue": 0.0, "name": "wght"}
],
"name": "uni0031",
"sources": [
{
Expand All @@ -165,7 +167,7 @@
},
{
"name": "wght",
"location": {"wght": 700},
"location": {"wght": 1},
"layerName": "wght",
"customData": {"fontra.development.status": 0},
},
Expand Down Expand Up @@ -480,8 +482,6 @@ def writableTestFont(tmpdir):
" </outline>",
" <lib>",
" <dict>",
" <key>robocjk.localAxes.behavior.2024</key>",
" <true/>",
" <key>robocjk.status</key>",
" <integer>0</integer>",
" <key>robocjk.variationGlyphs</key>",
Expand Down Expand Up @@ -527,8 +527,6 @@ def writableTestFont(tmpdir):
" </outline>",
" <lib>",
" <dict>",
" <key>robocjk.localAxes.behavior.2024</key>",
" <true/>",
" <key>robocjk.status</key>",
" <integer>0</integer>",
" <key>robocjk.variationGlyphs</key>",
Expand Down Expand Up @@ -594,8 +592,6 @@ async def test_putGlyph(writableTestFont):
" </outline>",
" <lib>",
" <dict>",
" <key>robocjk.localAxes.behavior.2024</key>",
" <true/>",
" <key>robocjk.status</key>",
" <integer>0</integer>",
" <key>xyz.fontra.something.nothing</key>",
Expand Down Expand Up @@ -648,8 +644,6 @@ async def test_delete_source_layer(writableTestFont):
" <string>wght</string>",
" </dict>",
" </array>",
" <key>robocjk.localAxes.behavior.2024</key>",
" <true/>",
" <key>robocjk.status</key>",
" <integer>0</integer>",
" <key>robocjk.variationGlyphs</key>",
Expand Down Expand Up @@ -758,8 +752,6 @@ async def test_write_roundtrip(writableTestFont, glyphName):
" </outline>",
" <lib>",
" <dict>",
" <key>robocjk.localAxes.behavior.2024</key>",
" <true/>",
" <key>robocjk.status</key>",
" <integer>0</integer>",
" <key>robocjk.variationGlyphs</key>",
Expand Down Expand Up @@ -858,8 +850,6 @@ async def test_bad_layer_name(writableTestFont):
" <dict>",
" <key>public.markColor</key>",
" <string>1,0,0,1</string>",
" <key>robocjk.localAxes.behavior.2024</key>",
" <true/>",
" <key>robocjk.status</key>",
" <integer>0</integer>",
" <key>xyz.fontra.test</key>",
Expand Down Expand Up @@ -987,8 +977,6 @@ async def test_readMixClassicAndVariableComponents():
" </dict>",
" </dict>",
" </array>",
" <key>robocjk.localAxes.behavior.2024</key>",
" <true/>",
" <key>robocjk.status</key>",
" <integer>0</integer>",
" </dict>",
Expand Down

0 comments on commit 54f23fc

Please sign in to comment.