=> ccb982160b68e08bebb92b6f244d4443dc7c133f
[1mdiff --git a/src/gmrequest.c b/src/gmrequest.c[m [1mindex aa55aca2..12d1e5e2 100644[m [1m--- a/src/gmrequest.c[m [1m+++ b/src/gmrequest.c[m [36m@@ -400,24 +400,6 @@[m [mstatic const iBlock *replaceVariables_(const iBlock *block) {[m if (equal_Rangecc(name, "APP_VERSION")) {[m repl = range_CStr(LAGRANGE_APP_VERSION);[m }[m [31m-#if 0[m [31m- else if (startsWith_Rangecc(name, "BT:")) { /* block text */[m [31m- repl = range_String(collect_String(renderBlockChars_Text([m [31m- &fontFiraSansRegular_Resources,[m [31m- 11, /* should be larger if shaded */[m [31m- quadrants_TextBlockMode,[m [31m- &(iString){ iBlockLiteral([m [31m- name.start + 3, size_Range(&name) - 3, size_Range(&name) - 3) })));[m [31m- }[m [31m- else if (startsWith_Rangecc(name, "ST:")) { /* shaded text */[m [31m- repl = range_String(collect_String(renderBlockChars_Text([m [31m- &fontSmolEmojiRegular_Resources,[m [31m- 20,[m [31m- shading_TextBlockMode,[m [31m- &(iString){ iBlockLiteral([m [31m- name.start + 3, size_Range(&name) - 3, size_Range(&name) - 3) })));[m [31m- }[m [31m-#endif[m else if (equal_Rangecc(name, "ALT")) {[m #if defined (iPlatformApple)[m repl = range_CStr("\u2325");[m [1mdiff --git a/src/ui/text.c b/src/ui/text.c[m [1mindex 048678ca..0de33619 100644[m [1m--- a/src/ui/text.c[m [1m+++ b/src/ui/text.c[m [36m@@ -2656,111 +2656,6 @@[m [mSDL_Texture *glyphCache_Text(void) {[m return activeText_->cache;[m }[m [m [31m-static void freeBitmap_(void *ptr) {[m [31m- stbtt_FreeBitmap(ptr, NULL);[m [31m-}[m [31m-[m [31m-iString *renderBlockChars_Text(const iBlock *fontData, int height, enum iTextBlockMode mode,[m [31m- const iString *text) {[m [31m- iBeginCollect();[m [31m- stbtt_fontinfo font;[m [31m- iZap(font);[m [31m- stbtt_InitFont(&font, constData_Block(fontData), 0);[m [31m- int ascent;[m [31m- stbtt_GetFontVMetrics(&font, &ascent, NULL, NULL);[m [31m- iDeclareType(CharBuf);[m [31m- struct Impl_CharBuf {[m [31m- uint8_t *pixels;[m [31m- iInt2 size;[m [31m- int dy;[m [31m- int advance;[m [31m- };[m [31m- iArray * chars = collectNew_Array(sizeof(iCharBuf));[m [31m- int pxRatio = (mode == quadrants_TextBlockMode ? 2 : 1);[m [31m- int pxHeight = height * pxRatio;[m [31m- const float scale = stbtt_ScaleForPixelHeight(&font, pxHeight);[m [31m- const float xScale = scale * 2; /* character aspect ratio */[m [31m- const int baseline = ascent * scale;[m [31m- int width = 0;[m [31m- size_t strRemain = length_String(text);[m [31m- iConstForEach(String, i, text) {[m [31m- if (!strRemain) break;[m [31m- if (isVariationSelector_Char(i.value) || isDefaultIgnorable_Char(i.value)) {[m [31m- strRemain--;[m [31m- continue;[m [31m- }[m [31m- iCharBuf buf = { .size = zero_I2() };[m [31m- buf.pixels = stbtt_GetCodepointBitmap([m [31m- &font, xScale, scale, i.value, &buf.size.x, &buf.size.y, 0, &buf.dy);[m [31m- stbtt_GetCodepointHMetrics(&font, i.value, &buf.advance, NULL);[m [31m- buf.advance *= xScale;[m [31m- if (!isSpace_Char(i.value)) {[m [31m- if (mode == quadrants_TextBlockMode) {[m [31m- buf.advance = (buf.size.x - 1) / 2 * 2 + 2;[m [31m- }[m [31m- else {[m [31m- buf.advance = buf.size.x + 1;[m [31m- }[m [31m- }[m [31m- pushBack_Array(chars, &buf);[m [31m- collect_Garbage(buf.pixels, freeBitmap_);[m [31m- width += buf.advance;[m [31m- strRemain--;[m [31m- }[m [31m- const size_t len = (mode == quadrants_TextBlockMode ? height * ((width + 1) / 2 + 1)[m [31m- : (height * (width + 1)));[m [31m- iChar *outBuf = iCollectMem(malloc(sizeof(iChar) * len));[m [31m- for (size_t i = 0; i < len; ++i) {[m [31m- outBuf[i] = 0x20;[m [31m- }[m [31m- iChar *outPos = outBuf;[m [31m- for (int y = 0; y < pxHeight; y += pxRatio) {[m [31m- const iCharBuf *ch = constData_Array(chars);[m [31m- int lx = 0;[m [31m- for (int x = 0; x < width; x += pxRatio, lx += pxRatio) {[m [31m- if (lx >= ch->advance) {[m [31m- ch++;[m [31m- lx = 0;[m [31m- }[m [31m- const int ly = y - baseline - ch->dy;[m [31m- if (mode == quadrants_TextBlockMode) {[m [31m- #define checkPixel_(offx, offy) \[m [31m- (lx + offx < ch->size.x && ly + offy < ch->size.y && ly + offy >= 0 ? \[m [31m- ch->pixels[(lx + offx) + (ly + offy) * ch->size.x] > 155 \[m [31m- : iFalse)[m [31m- const int mask = (checkPixel_(0, 0) ? 1 : 0) |[m [31m- (checkPixel_(1, 0) ? 2 : 0) |[m [31m- (checkPixel_(0, 1) ? 4 : 0) |[m [31m- (checkPixel_(1, 1) ? 8 : 0);[m [31m- #undef checkPixel_[m [31m- static const iChar blocks[16] = { 0x0020, 0x2598, 0x259D, 0x2580, 0x2596, 0x258C,[m [31m- 0x259E, 0x259B, 0x2597, 0x259A, 0x2590, 0x259C,[m [31m- 0x2584, 0x2599, 0x259F, 0x2588 };[m [31m- *outPos++ = blocks[mask];[m [31m- }[m [31m- else {[m [31m- static const iChar shades[5] = { 0x0020, 0x2591, 0x2592, 0x2593, 0x2588 };[m [31m- *outPos++ = shades[lx < ch->size.x && ly < ch->size.y && ly >= 0 ?[m [31m- ch->pixels[lx + ly * ch->size.x] * 5 / 256 : 0];[m [31m- }[m [31m- }[m [31m- *outPos++ = '\n';[m [31m- }[m [31m- /* We could compose the lines separately, but we'd still need to convert them to Strings[m [31m- individually to trim them. */[m [31m- iStringList *lines = split_String(collect_String(newUnicodeN_String(outBuf, len)), "\n");[m [31m- while (!isEmpty_StringList(lines) &&[m [31m- isEmpty_String(collect_String(trimmed_String(at_StringList(lines, 0))))) {[m [31m- popFront_StringList(lines);[m [31m- }[m [31m- while (!isEmpty_StringList(lines) && isEmpty_String(collect_String(trimmed_String([m [31m- at_StringList(lines, size_StringList(lines) - 1))))) {[m [31m- popBack_StringList(lines);[m [31m- }[m [31m- iEndCollect();[m [31m- return joinCStr_StringList(iClob(lines), "\n");[m [31m-}[m [31m-[m /*-----------------------------------------------------------------------------------------------*/[m [m iDefineTypeConstructionArgs(TextBuf, (iWrapText *wrapText, int font, int color), wrapText, font, color)[m [1mdiff --git a/src/ui/text.h b/src/ui/text.h[m [1mindex d86dbb16..88ab7dc2 100644[m [1m--- a/src/ui/text.h[m [1m+++ b/src/ui/text.h[m [36m@@ -218,11 +218,6 @@[m [mvoid resetMissing_Text (iText *);[m iBool checkMissing_Text (void); /* returns the flag, and clears it */[m SDL_Texture * glyphCache_Text (void);[m [m [31m-enum iTextBlockMode { quadrants_TextBlockMode, shading_TextBlockMode };[m [31m-[m [31m-iString * renderBlockChars_Text (const iBlock *fontData, int height, enum iTextBlockMode,[m [31m- const iString *text);[m [31m-[m iRegExp * makeAnsiEscapePattern_Text (iBool includeEscChar);[m [m /*-----------------------------------------------------------------------------------------------*/[m
text/gemini; charset=utf-8
This content has been proxied by September (3851b).