Skip to content

Commit bc1460b

Browse files
committed
Add capHeight to typeface.
1 parent a17c3fe commit bc1460b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/pixie/fonts.nim

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,11 @@ proc lineHeight*(typeface: Typeface): float32 {.inline, raises: [].} =
8585
# The descent is negative number, so this is really ascent + descent + lineGap.
8686
typeface.ascent - typeface.descent + typeface.lineGap
8787

88+
proc capHeight*(typeface: Typeface): float32 {.raises: [].} =
89+
## The font cap height value in font units.
90+
if typeface.opentype != nil:
91+
result = typeface.opentype.os2.sCapHeight.float32
92+
8893
proc underlinePosition(typeface: Typeface): float32 =
8994
if typeface.opentype != nil:
9095
result = typeface.opentype.post.underlinePosition.float32

0 commit comments

Comments
 (0)