From 05889d51e45ef2b5aa22308c6ad3a36fa3e8af46 Mon Sep 17 00:00:00 2001 From: Ryan Oldenburg Date: Wed, 5 May 2021 16:51:19 -0500 Subject: [PATCH] fixes --- src/pixie/fontformats/opentype.nim | 4 ++++ src/pixie/fonts.nim | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/pixie/fontformats/opentype.nim b/src/pixie/fontformats/opentype.nim index f0b5449..bb6353d 100644 --- a/src/pixie/fontformats/opentype.nim +++ b/src/pixie/fontformats/opentype.nim @@ -1479,6 +1479,10 @@ proc getAdvance*(opentype: OpenType, rune: Rune): float32 = result = opentype.hmtx.hMetrics[^1].advanceWidth.float32 proc getKerningAdjustment*(opentype: OpenType, left, right: Rune): float32 = + if left notin opentype.cmap.runeToGlyphId or + right notin opentype.cmap.runeToGlyphId: + return + let leftGlyphId = opentype.cmap.runeToGlyphId[left] rightGlyphId = opentype.cmap.runeToGlyphId[right] diff --git a/src/pixie/fonts.nim b/src/pixie/fonts.nim index 206bd97..e07b1c9 100644 --- a/src/pixie/fonts.nim +++ b/src/pixie/fonts.nim @@ -4,7 +4,7 @@ import pixie/fontformats/opentype, pixie/fontformats/svgfont, pixie/paths, const AutoLineHeight* = -1.float32 ## Use default line height for the font size type - Typeface = ref object + Typeface* = ref object opentype: OpenType svgFont: SvgFont