=> 0202d60daec076ceac6722f4b0f11eef5fddcd5a
[1mdiff --git a/src/ui/text.c b/src/ui/text.c[m [1mindex 4d445f53..95de986a 100644[m [1m--- a/src/ui/text.c[m [1m+++ b/src/ui/text.c[m [36m@@ -93,21 +93,35 @@[m [mstatic const float contentScale_Text_ = 1.3f;[m int gap_Text; /* cf. gap_UI in metrics.h */[m int enableHalfPixelGlyphs_Text = iTrue; /* debug setting */[m int enableKerning_Text = iTrue; /* looking up kern pairs is slow */[m [31m-int numOffsetSteps_Glyph = 4; /* subpixel offsets for glyphs */[m [31m-[m [31m-iLocalDef float offsetStep_Glyph_(void) {[m [31m- return 1.0f / (float) numOffsetSteps_Glyph;[m [31m-}[m [m enum iGlyphFlag {[m rasterized0_GlyphFlag = iBit(1), /* zero offset */[m rasterized1_GlyphFlag = iBit(2), /* quarter pixel offset */[m rasterized2_GlyphFlag = iBit(3), /* half-pixel offset */[m rasterized3_GlyphFlag = iBit(4), /* three quarters offset */[m [31m- rasterizedAll_GlyphFlag =[m [31m- rasterized0_GlyphFlag | rasterized1_GlyphFlag | rasterized2_GlyphFlag | rasterized3_GlyphFlag,[m };[m [m [32m+[m[32mstatic int numOffsetSteps_Glyph_ = 4; /* subpixel offsets for glyphs */[m [32m+[m[32mstatic int rasterizedAll_GlyphFlag_ = 0xf; /* updated with numOffsetSteps_Glyph */[m [32m+[m [32m+[m[32miLocalDef float offsetStep_Glyph_(void) {[m [32m+[m[32m return 1.0f / (float) numOffsetSteps_Glyph_;[m [32m+[m[32m}[m [32m+[m [32m+[m[32mstatic int makeRasterizedAll_GlyphFlag_(int n) {[m [32m+[m[32m int flag = rasterized0_GlyphFlag;[m [32m+[m[32m if (n > 1) {[m [32m+[m[32m flag |= rasterized1_GlyphFlag;[m [32m+[m[32m }[m [32m+[m[32m if (n > 2) {[m [32m+[m[32m flag |= rasterized2_GlyphFlag;[m [32m+[m[32m }[m [32m+[m[32m if (n > 3) {[m [32m+[m[32m flag |= rasterized3_GlyphFlag;[m [32m+[m[32m }[m [32m+[m[32m return flag;[m [32m+[m[32m}[m [32m+[m struct Impl_Glyph {[m iHashNode node;[m int flags;[m [36m@@ -139,7 +153,7 @@[m [miLocalDef iBool isRasterized_Glyph_(const iGlyph *d, int hoff) {[m }[m [m iLocalDef iBool isFullyRasterized_Glyph_(const iGlyph *d) {[m [31m- return (d->flags & rasterizedAll_GlyphFlag) == rasterizedAll_GlyphFlag;[m [32m+[m[32m return (d->flags & rasterizedAll_GlyphFlag_) == rasterizedAll_GlyphFlag_;[m }[m [m iLocalDef void setRasterized_Glyph_(iGlyph *d, int hoff) {[m [36m@@ -410,13 +424,15 @@[m [mstatic void initCache_Text_(iText *d) {[m init_Array(&d->cacheRows, sizeof(iCacheRow));[m const int textSize = d->contentFontSize * fontSize_UI;[m iAssert(textSize > 0);[m [31m- const iBool isLowResDisplay = get_Window()->pixelRatio <= 2.0f;[m [31m- numOffsetSteps_Glyph = isLowResDisplay ? 4 : 2;[m [31m-#if !defined (NDEBUG)[m [31m- printf("[Text] subpixel offsets: %d\n", numOffsetSteps_Glyph);[m [32m+[m[32m numOffsetSteps_Glyph_ = get_Window()->pixelRatio < 2.0f ? 4[m [32m+[m[32m : get_Window()->pixelRatio < 2.5f ? 3[m [32m+[m[32m : 2;[m [32m+[m[32m rasterizedAll_GlyphFlag_ = makeRasterizedAll_GlyphFlag_(numOffsetSteps_Glyph_);[m [32m+[m[32m#if !defined(NDEBUG)[m [32m+[m[32m printf("[Text] subpixel offsets: %d\n", numOffsetSteps_Glyph_);[m #endif[m [31m- const iInt2 cacheDims = init_I2(isLowResDisplay ? 32 : 16, 40);[m [31m- d->cacheSize = mul_I2(cacheDims, init1_I2(iMax(textSize, fontSize_UI)));[m [32m+[m[32m const iInt2 cacheDims = init_I2(8 * numOffsetSteps_Glyph_, 40);[m [32m+[m[32m d->cacheSize = mul_I2(cacheDims, init1_I2(iMax(textSize, fontSize_UI)));[m SDL_RendererInfo renderInfo;[m SDL_GetRendererInfo(d->render, &renderInfo);[m if (renderInfo.max_texture_height > 0 && d->cacheSize.y > renderInfo.max_texture_height) {[m [36m@@ -709,7 +725,7 @@[m [mstatic iGlyph *glyphByIndex_Font_(iFont *d, uint32_t glyphIndex) {[m glyph->font = d;[m /* New glyphs are always allocated at least. This reserves a position in the cache[m and updates the glyph metrics. */[m [31m- iForIndices(offsetIndex, glyph->rect) {[m [32m+[m[32m for (int offsetIndex = 0; offsetIndex < numOffsetSteps_Glyph_; offsetIndex++) {[m allocate_Font_(d, glyph, offsetIndex);[m }[m insert_Hash(&d->table->glyphs, &glyph->node);[m [36m@@ -1267,8 +1283,8 @@[m [mstatic void cacheGlyphs_Font_(iFont *d, const uint32_t *glyphIndices, size_t num[m SDL_SetSurfaceBlendMode(buf, SDL_BLENDMODE_NONE);[m SDL_SetSurfacePalette(buf, glyphPalette_());[m }[m [31m- SDL_Surface *surfaces[4];[m [31m- iForIndices(si, surfaces) {[m [32m+[m[32m SDL_Surface *surfaces[4] = { NULL, NULL, NULL, NULL };[m [32m+[m[32m for (int si = 0; si < numOffsetSteps_Glyph_; si++) {[m surfaces[si] = !isRasterized_Glyph_(glyph, si)[m ? rasterizeGlyph_Font_(glyph->font,[m index_Glyph_(glyph),[m
text/gemini; charset=utf-8
This content has been proxied by September (ba2dc).