Skip to content

Commit

Permalink
Replace glyf-1 test font with VARC test font
Browse files Browse the repository at this point in the history
  • Loading branch information
justvanrossum committed May 27, 2024
1 parent 7e5e71e commit bc75a06
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 47 deletions.
Binary file added test-py/data/mutatorsans/MutatorSans-VARC.ttf
Binary file not shown.
Binary file removed test-py/data/mutatorsans/MutatorSans-glyf1.ttf
Binary file not shown.
112 changes: 65 additions & 47 deletions test-py/test_font.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import contextlib
import pathlib
from dataclasses import asdict

import pytest

Expand All @@ -11,6 +10,7 @@
FontAxis,
VariableGlyph,
structure,
unstructure,
)

dataDir = pathlib.Path(__file__).resolve().parent / "data"
Expand Down Expand Up @@ -816,97 +816,115 @@
},
),
(
"ttf-glyf1",
"ttf-VARC",
{
"name": "varcotest1",
"axes": [],
"sources": [
{
"name": "<default>",
"layerName": "<default>",
"location": {"wdth": 0, "wght": 0, "V000": 0, "V001": 0},
"inactive": False,
"customData": {},
}
"location": {"V000": 0, "V001": 0, "wdth": 0, "wght": 0},
},
{
"name": "wght=1",
"layerName": "wght=1",
"location": {"V000": 0, "V001": 0, "wdth": 0, "wght": 1},
},
],
"layers": {
"<default>": {
"glyph": {
"path": {
"coordinates": [],
"pointTypes": [],
"contourInfo": [],
},
"components": [
{
"name": "A",
"transformation": {
"translateX": 0,
"translateY": 0,
"rotation": -10.01953125,
"scaleX": 1,
"scaleY": 1,
"skewX": 0,
"skewY": 19.9951171875,
"tCenterX": 250.0,
"tCenterY": 300.0,
"tCenterX": 250,
"tCenterY": 300,
},
"location": {"wght": 0.5},
},
{
"name": "varcotest2",
"transformation": {
"translateX": 527,
"translateY": 410,
"scaleX": 0.5,
"scaleY": 0.5,
"skewX": 19.9951171875,
},
"location": {
"wdth": 0,
"wght": 0.5,
"V000": 0,
"V001": 0,
"V000": 0.70001220703125,
"V001": 0.29998779296875,
},
},
{
"name": "varcotest2",
"transformation": {
"translateX": 527.0,
"translateY": 410.0,
"rotation": 0,
"translateX": 627,
"translateY": -175,
"rotation": 10.01953125,
"scaleX": 0.75,
"scaleY": 0.75,
"skewY": 19.9951171875,
},
"location": {
"V000": 0.20001220703125,
"V001": 0.79998779296875,
},
},
],
"xAdvance": 900,
}
},
"wght=1": {
"glyph": {
"components": [
{
"name": "A",
"transformation": {
"rotation": -10.01953125,
"skewY": 19.9951171875,
"tCenterX": 250,
"tCenterY": 300,
},
"location": {"wght": 0},
},
{
"name": "varcotest2",
"transformation": {
"translateX": 527,
"translateY": 410,
"scaleX": 0.5,
"scaleY": 0.5,
"skewX": -19.9951171875,
"skewY": 0,
"tCenterX": 0,
"tCenterY": 0,
"skewX": 19.9951171875,
},
"location": {
"wdth": 0,
"wght": 0,
"V000": 0.70001220703125,
"V001": 0.29998779296875,
},
},
{
"name": "varcotest2",
"transformation": {
"translateX": 627.0,
"translateY": -175.0,
"translateX": 627,
"translateY": -175,
"rotation": 10.01953125,
"scaleX": 0.75,
"scaleY": 0.75,
"skewX": 0,
"skewY": 19.9951171875,
"tCenterX": 0,
"tCenterY": 0,
},
"location": {
"wdth": 0,
"wght": 0,
"V000": 0.20001220703125,
"V001": 0.79998779296875,
},
},
],
"xAdvance": 900,
"yAdvance": None,
"verticalOrigin": None,
},
"customData": {},
}
}
},
},
"customData": {},
},
),
]
Expand All @@ -917,7 +935,7 @@
"ufo": dataDir / "mutatorsans" / "MutatorSansLightCondensed.ufo",
"ttf": dataDir / "mutatorsans" / "MutatorSans.ttf",
"otf": dataDir / "mutatorsans" / "MutatorSans.otf",
"ttf-glyf1": dataDir / "mutatorsans" / "MutatorSans-glyf1.ttf",
"ttf-VARC": dataDir / "mutatorsans" / "MutatorSans-VARC.ttf",
}


Expand Down Expand Up @@ -973,7 +991,7 @@ async def test_getGlyph(testFontName, expectedGlyph):
async with contextlib.aclosing(font):
glyph = await font.getGlyph(expectedGlyph.name)
assert glyph == expectedGlyph
assert asdict(glyph) == asdict(expectedGlyph)
assert unstructure(glyph) == unstructure(expectedGlyph)


getAxesTestData = [
Expand Down

0 comments on commit bc75a06

Please sign in to comment.