inline
This commit is contained in:
parent
cfb00b9b18
commit
c166183f35
1 changed files with 5 additions and 5 deletions
|
@ -51,35 +51,35 @@ proc lineGap(font: Font): float32 {.inline.} =
|
||||||
if font.opentype != nil:
|
if font.opentype != nil:
|
||||||
result = font.opentype.hhea.lineGap.float32
|
result = font.opentype.hhea.lineGap.float32
|
||||||
|
|
||||||
proc getGlyphPath*(font: Font, rune: Rune): Path =
|
proc getGlyphPath*(font: Font, rune: Rune): Path {.inline.} =
|
||||||
## The glyph path for the rune.
|
## The glyph path for the rune.
|
||||||
if font.opentype != nil:
|
if font.opentype != nil:
|
||||||
font.opentype.getGlyphPath(rune)
|
font.opentype.getGlyphPath(rune)
|
||||||
else:
|
else:
|
||||||
font.svgFont.getGlyphPath(rune)
|
font.svgFont.getGlyphPath(rune)
|
||||||
|
|
||||||
proc getGlyphAdvance(font: Font, rune: Rune): float32 =
|
proc getGlyphAdvance(font: Font, rune: Rune): float32 {.inline.} =
|
||||||
## The advance for the rune in pixels.
|
## The advance for the rune in pixels.
|
||||||
if font.opentype != nil:
|
if font.opentype != nil:
|
||||||
font.opentype.getGlyphAdvance(rune)
|
font.opentype.getGlyphAdvance(rune)
|
||||||
else:
|
else:
|
||||||
font.svgFont.getGlyphAdvance(rune)
|
font.svgFont.getGlyphAdvance(rune)
|
||||||
|
|
||||||
proc getKerningAdjustment(font: Font, left, right: Rune): float32 =
|
proc getKerningAdjustment(font: Font, left, right: Rune): float32 {.inline.} =
|
||||||
## The kerning adjustment for the rune pair, in pixels.
|
## The kerning adjustment for the rune pair, in pixels.
|
||||||
if font.opentype != nil:
|
if font.opentype != nil:
|
||||||
font.opentype.getKerningAdjustment(left, right)
|
font.opentype.getKerningAdjustment(left, right)
|
||||||
else:
|
else:
|
||||||
font.svgfont.getKerningAdjustment(left, right)
|
font.svgfont.getKerningAdjustment(left, right)
|
||||||
|
|
||||||
proc scale*(font: Font): float32 =
|
proc scale*(font: Font): float32 {.inline.} =
|
||||||
## The scale factor to transform font units into pixels.
|
## The scale factor to transform font units into pixels.
|
||||||
if font.opentype != nil:
|
if font.opentype != nil:
|
||||||
font.size / font.opentype.head.unitsPerEm.float32
|
font.size / font.opentype.head.unitsPerEm.float32
|
||||||
else:
|
else:
|
||||||
font.size / font.svgFont.unitsPerEm
|
font.size / font.svgFont.unitsPerEm
|
||||||
|
|
||||||
proc defaultLineHeight*(font: Font): float32 =
|
proc defaultLineHeight*(font: Font): float32 {.inline.} =
|
||||||
## The default line height in pixels for the current font size.
|
## The default line height in pixels for the current font size.
|
||||||
let fontUnits = (font.ascent + abs(font.descent) + font.lineGap)
|
let fontUnits = (font.ascent + abs(font.descent) + font.lineGap)
|
||||||
round(fontUnits * font.scale)
|
round(fontUnits * font.scale)
|
||||||
|
|
Loading…
Reference in a new issue