diff --git a/src/ui/text.c b/src/ui/text.c

index db922715..51865654 100644

--- a/src/ui/text.c

+++ b/src/ui/text.c

@@ -116,6 +116,7 @@ iDefineTypeConstructionArgs(Glyph, (iChar ch), ch)



struct Impl_Font {

 iBlock *       data;

+ enum iTextFont family;

 stbtt_fontinfo font;

 float          xScale, yScale;

 int            vertOffset; /* offset due to scaling */

@@ -134,6 +135,15 @@ static void init_Font(iFont *d, const iBlock *data, int height, float scale,

                   enum iFontSize sizeId, iBool isMonospaced) {

 init_Hash(&d->glyphs);

 d->data = NULL;

+ d->family = undefined_TextFont;

+ /* Note: We only use family currently for applying a kerning fix to Nunito. */

+ if (data == &fontNunitoRegular_Embedded ||

+ data == &fontNunitoBold_Embedded ||

+ data == &fontNunitoExtraBold_Embedded ||

+ data == &fontNunitoLightItalic_Embedded ||

+ data == &fontNunitoExtraLight_Embedded) {

+ d->family = nunito_TextFont;

+ }

 d->isMonospaced = isMonospaced;

 d->height = height;

 iZap(d->font);

@@ -1128,14 +1138,26 @@ static iRect run_Font_(iFont *d, const iRunArgs *args) {

         const iChar next = nextChar_(&peek, args->text.end);

         if (enableKerning_Text && !d->manualKernOnly && next) {

             const uint32_t nextGlyphIndex = glyphIndex_Font_(glyph->font, next);

- const int kern = stbtt_GetGlyphKernAdvance(

+ int kern = stbtt_GetGlyphKernAdvance(

                 &glyph->font->font, glyph->glyphIndex, nextGlyphIndex);

+ /* Nunito needs some kerning fixes. */

+ if (glyph->font->family == nunito_TextFont) {

+ if (ch == 'W' && (next == 'i' || next == 'h')) {

+ kern = -30;

+ }

+ else if (ch == 'T' && next == 'h') {

+ kern = -15;

+ }

+ else if (ch == 'V' && next == 'i') {

+ kern = -15;

+ }

+ }

             if (kern) {

// printf("%lc(%u) -> %lc(%u): kern %d (%f)\n", ch, glyph->glyphIndex, next,

// nextGlyphIndex,

// kern, d->xScale * kern);

- xpos += d->xScale * kern;

- xposExtend += d->xScale * kern;

+ xpos += glyph->font->xScale * kern;

+ xposExtend += glyph->font->xScale * kern;

             }

         }

     }

diff --git a/src/ui/text.h b/src/ui/text.h

index 2f2bcf3a..768713ee 100644

--- a/src/ui/text.h

+++ b/src/ui/text.h

@@ -116,7 +116,8 @@ iLocalDef iBool isJapanese_FontId(enum iFontId id) {

#define emojiVariationSelector_Char ((iChar) 0xfe0f)



enum iTextFont {

- nunito_TextFont,

+ undefined_TextFont = -1,

+ nunito_TextFont = 0,

 firaSans_TextFont,

 literata_TextFont,

 tinos_TextFont,

Proxy Information
Original URL
gemini://git.skyjake.fi/lagrange/work%2Fv1.6/pcdiff/dcf520652cd2279a1d4dd78361d589ede0c36eaf
Status Code
Success (20)
Meta
text/plain
Capsule Response Time
66.07163 milliseconds
Gemini-to-HTML Time
1.97397 milliseconds

This content has been proxied by September (3851b).