summaryrefslogtreecommitdiff
path: root/src/ui/text.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/text.c')
-rw-r--r--src/ui/text.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/ui/text.c b/src/ui/text.c
index b4b7fb0c..40956e29 100644
--- a/src/ui/text.c
+++ b/src/ui/text.c
@@ -48,6 +48,7 @@ iDeclareTypeConstructionArgs(Glyph, iChar ch)
48 48
49int gap_Text; /* cf. gap_UI in metrics.h */ 49int gap_Text; /* cf. gap_UI in metrics.h */
50int enableHalfPixelGlyphs_Text = iTrue; /* debug setting */ 50int enableHalfPixelGlyphs_Text = iTrue; /* debug setting */
51int enableKerning_Text = iTrue; /* looking up kern pairs is slow */
51 52
52struct Impl_Glyph { 53struct Impl_Glyph {
53 iHashNode node; 54 iHashNode node;
@@ -85,6 +86,7 @@ struct Impl_Font {
85 int baseline; 86 int baseline;
86 iHash glyphs; 87 iHash glyphs;
87 iBool isMonospaced; 88 iBool isMonospaced;
89 iBool manualKernOnly;
88 enum iFontId symbolsFont; /* font to use for symbols */ 90 enum iFontId symbolsFont; /* font to use for symbols */
89}; 91};
90 92
@@ -176,6 +178,9 @@ static void initFonts_Text_(iText *d) {
176 if (fontData[i].ttf == &fontFiraMonoRegular_Embedded) { 178 if (fontData[i].ttf == &fontFiraMonoRegular_Embedded) {
177 font->isMonospaced = iTrue; 179 font->isMonospaced = iTrue;
178 } 180 }
181 if (i == default_FontId || i == defaultMedium_FontId) {
182 font->manualKernOnly = iTrue;
183 }
179 } 184 }
180 gap_Text = iRound(gap_UI * d->contentFontSize); 185 gap_Text = iRound(gap_UI * d->contentFontSize);
181} 186}
@@ -511,9 +516,11 @@ static iRect run_Font_(iFont *d, enum iRunMode mode, iRangecc text, size_t maxLe
511 /* Manual kerning for double-slash. */ 516 /* Manual kerning for double-slash. */
512 xpos -= glyph->rect[hoff].size.x * 0.5f; 517 xpos -= glyph->rect[hoff].size.x * 0.5f;
513 } 518 }
514 else if (next) { 519#if defined (LAGRANGE_ENABLE_KERNING)
520 else if (enableKerning_Text && !d->manualKernOnly && next) {
515 xpos += d->scale * stbtt_GetCodepointKernAdvance(&d->font, ch, next); 521 xpos += d->scale * stbtt_GetCodepointKernAdvance(&d->font, ch, next);
516 } 522 }
523#endif
517 } 524 }
518 prevCh = ch; 525 prevCh = ch;
519 if (--maxLen == 0) { 526 if (--maxLen == 0) {