From: Michael D. Lowis Date: Thu, 12 Apr 2018 14:34:26 +0000 (-0400) Subject: Tweaked font handling logic to allow drawing proportional fonts. Selection boxes... X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=20bf07512e537bbdbdd6dc47c32a2188fee4e1aa;p=projs%2Ftide.git Tweaked font handling logic to allow drawing proportional fonts. Selection boxes are now busted if using a proportional font --- diff --git a/lib/config.c b/lib/config.c index 8d4acc2..5994fb5 100644 --- a/lib/config.c +++ b/lib/config.c @@ -64,17 +64,17 @@ int Palette[ClrCount] = { [Purple] = 0x000000, // Purple ??? [Aqua] = 0x000000, // Aqua ??? [Orange] = 0x000000, // Orange ??? - [EditBg] = 0xefefda, // Edit region background - [EditSel] = 0xdede8e, // Edit region selection + [EditBg] = 0xF0F0E5, // Edit region background + [EditSel] = 0xDFDF99, // Edit region selection [EditFg] = 0x000000, // Edit region text [EditCsr] = 0x000000, // Edit region cursor - [TagsBg] = 0xdaefef, // Tags region background - [TagsSel] = 0x8edede, // Tags region selection + [TagsBg] = 0xE5F0F0, // Tags region background + [TagsSel] = 0x99DFDF, // Tags region selection [TagsFg] = 0x000000, // Tags region text [TagsCsr] = 0x000000, // Tags region cursor - [ScrollBg] = 0x89893c, // Scroll region background - [ScrollFg] = 0xefefda, // Scroll region foreground - [VerBdr] = 0x89893c, // Vertical border + [ScrollBg] = 0x909047, // Scroll region background + [ScrollFg] = 0xF0F0E5, // Scroll region foreground + [VerBdr] = 0x909047, // Vertical border [HorBdr] = 0x000000, // Horizontal border }; #endif diff --git a/lib/x11.c b/lib/x11.c index 45409a0..2f99554 100644 --- a/lib/x11.c +++ b/lib/x11.c @@ -696,9 +696,11 @@ static void draw_glyphs(size_t x, size_t y, UGlyph* glyphs, size_t rlen, size_t if (glyphs[i].rune == '\n') glyphs[i].rune = ' ', eol = true; getglyph(CurrFont, &(specs[numspecs]), glyphs[i].rune); + XGlyphInfo extents; + XftTextExtents32(X.display, CurrFont->match, &(const FcChar32){glyphs[i].rune}, 1, &extents); specs[numspecs].x = x; specs[numspecs].y = y - x11_font_descent(CurrFont); - x += x11_font_width(CurrFont); + x += extents.xOff; numspecs++; i++; /* skip over null chars which mark multi column runes */