Skip to content

Commit

Permalink
Move helper func
Browse files Browse the repository at this point in the history
  • Loading branch information
justvanrossum committed Jul 15, 2024
1 parent a82fae4 commit a9e9bcc
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/fontra_compile/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,12 @@ def prepareXAdvanceVariations(glyph: VariableGlyph, glyphSources):
return [glyph.layers[source.layerName].glyph.xAdvance for source in glyphSources]


def computeLeftSideBearing(path: Path | PackedPath, useTightBounds: bool) -> int:
boundsPen = (BoundsPen if useTightBounds else ControlBoundsPen)(None)
path.drawPoints(PointToSegmentPen(boundsPen))
return otRound(boundsPen.bounds[0]) if boundsPen.bounds is not None else 0


def buildTTGlyph(glyph, glyphSources, defaultLayerGlyph, model):
ttGlyphPen = TTGlyphPointPen(None)
defaultLayerGlyph.path.drawPoints(ttGlyphPen)
Expand Down Expand Up @@ -781,12 +787,6 @@ def buildCharString(glyph, glyphSources, defaultLayerGlyph, model):
return charString, charStringSupports


def computeLeftSideBearing(path: Path | PackedPath, useTightBounds: bool) -> int:
boundsPen = (BoundsPen if useTightBounds else ControlBoundsPen)(None)
path.drawPoints(PointToSegmentPen(boundsPen))
return otRound(boundsPen.bounds[0]) if boundsPen.bounds is not None else 0


def prepareCFFVarData(charStrings, charStringSupports):
vsindexMap = {}
for supports in charStringSupports.values():
Expand Down

0 comments on commit a9e9bcc

Please sign in to comment.