Skip to content

Commit

Permalink
Merge pull request #66 from googlefonts/varc-gvar-extended
Browse files Browse the repository at this point in the history
Optionally use GVAR instead of gvar
  • Loading branch information
justvanrossum authored Dec 15, 2024
2 parents 154ab6c + 03e6101 commit 216f73b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/fontra_compile/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ class Builder:
requestedGlyphNames: list = field(default_factory=list)
buildCFF2: bool = False
subroutinize: bool = True
useExtendedGvar: bool = False

async def setup(self) -> None:
self.glyphMap = await self.reader.getGlyphMap()
Expand Down Expand Up @@ -470,7 +471,10 @@ async def buildFont(self) -> TTFont:
builder.setupGlyf(getGlyphInfoAttributes(self.glyphInfos, "ttGlyph"))
gvarVariations = getGlyphInfoAttributes(self.glyphInfos, "gvarVariations")
if gvarVariations:
builder.setupGvar(gvarVariations)
if self.useExtendedGvar:
builder.setupGVAR(gvarVariations)
else:
builder.setupGvar(gvarVariations)
else:
charStrings = getGlyphInfoAttributes(self.glyphInfos, "charString")
charStringSupports = getGlyphInfoAttributes(
Expand Down
2 changes: 2 additions & 0 deletions src/fontra_compile/compile_varc_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class FontraCompileAction:
destination: str
input: ReadableFontBackend | None = field(init=False, default=None)
subroutinize: bool = True
useExtendedGvar: bool = False

@asynccontextmanager
async def connect(
Expand All @@ -37,6 +38,7 @@ async def process(
reader=self.input,
buildCFF2=outputFontPath.suffix.lower() == ".otf",
subroutinize=self.subroutinize,
useExtendedGvar=self.useExtendedGvar,
)
await builder.setup()
ttFont = await builder.build()
Expand Down

0 comments on commit 216f73b

Please sign in to comment.