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.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/ui/text.c b/src/ui/text.c
index f947c4df..1e702eee 100644
--- a/src/ui/text.c
+++ b/src/ui/text.c
@@ -120,7 +120,7 @@ static void initFonts_Text_(iText *d) {
120 int symbolsFont; 120 int symbolsFont;
121 } fontData[max_FontId] = { 121 } fontData[max_FontId] = {
122 { &fontSourceSansProRegular_Embedded, fontSize_UI, defaultSymbols_FontId }, 122 { &fontSourceSansProRegular_Embedded, fontSize_UI, defaultSymbols_FontId },
123 { &fontSourceSansProRegular_Embedded, fontSize_UI * 1.666f, defaultLargeSymbols_FontId }, 123 { &fontSourceSansProRegular_Embedded, fontSize_UI * 1.150f, defaultMediumSymbols_FontId },
124 { &fontFiraMonoRegular_Embedded, fontSize_UI * 0.866f, defaultSymbols_FontId }, 124 { &fontFiraMonoRegular_Embedded, fontSize_UI * 0.866f, defaultSymbols_FontId },
125 { &fontFiraSansRegular_Embedded, textSize, symbols_FontId }, 125 { &fontFiraSansRegular_Embedded, textSize, symbols_FontId },
126 { &fontFiraMonoRegular_Embedded, textSize * 0.866f, smallSymbols_FontId }, 126 { &fontFiraMonoRegular_Embedded, textSize * 0.866f, smallSymbols_FontId },
@@ -133,14 +133,14 @@ static void initFonts_Text_(iText *d) {
133 { &fontFiraSansBold_Embedded, textSize * 2.000f, hugeSymbols_FontId }, 133 { &fontFiraSansBold_Embedded, textSize * 2.000f, hugeSymbols_FontId },
134 { &fontFiraSansLight_Embedded, textSize * 1.666f, largeSymbols_FontId }, 134 { &fontFiraSansLight_Embedded, textSize * 1.666f, largeSymbols_FontId },
135 { &fontSymbola_Embedded, fontSize_UI, defaultSymbols_FontId }, 135 { &fontSymbola_Embedded, fontSize_UI, defaultSymbols_FontId },
136 { &fontSymbola_Embedded, fontSize_UI * 1.666f, defaultLargeSymbols_FontId }, 136 { &fontSymbola_Embedded, fontSize_UI * 1.150f, defaultMediumSymbols_FontId },
137 { &fontSymbola_Embedded, textSize, symbols_FontId }, 137 { &fontSymbola_Embedded, textSize, symbols_FontId },
138 { &fontSymbola_Embedded, textSize * 1.333f, mediumSymbols_FontId }, 138 { &fontSymbola_Embedded, textSize * 1.333f, mediumSymbols_FontId },
139 { &fontSymbola_Embedded, textSize * 1.666f, largeSymbols_FontId }, 139 { &fontSymbola_Embedded, textSize * 1.666f, largeSymbols_FontId },
140 { &fontSymbola_Embedded, textSize * 2.000f, hugeSymbols_FontId }, 140 { &fontSymbola_Embedded, textSize * 2.000f, hugeSymbols_FontId },
141 { &fontSymbola_Embedded, textSize * 0.866f, smallSymbols_FontId }, 141 { &fontSymbola_Embedded, textSize * 0.866f, smallSymbols_FontId },
142 { &fontNotoEmojiRegular_Embedded, fontSize_UI, defaultSymbols_FontId }, 142 { &fontNotoEmojiRegular_Embedded, fontSize_UI, defaultSymbols_FontId },
143 { &fontNotoEmojiRegular_Embedded, fontSize_UI * 1.666f, defaultLargeSymbols_FontId }, 143 { &fontNotoEmojiRegular_Embedded, fontSize_UI * 1.150f, defaultMediumSymbols_FontId },
144 { &fontNotoEmojiRegular_Embedded, textSize, symbols_FontId }, 144 { &fontNotoEmojiRegular_Embedded, textSize, symbols_FontId },
145 { &fontNotoEmojiRegular_Embedded, textSize * 1.333f, mediumSymbols_FontId }, 145 { &fontNotoEmojiRegular_Embedded, textSize * 1.333f, mediumSymbols_FontId },
146 { &fontNotoEmojiRegular_Embedded, textSize * 1.666f, largeSymbols_FontId }, 146 { &fontNotoEmojiRegular_Embedded, textSize * 1.666f, largeSymbols_FontId },
@@ -306,10 +306,11 @@ static void cache_Font_(iFont *d, iGlyph *glyph, int hoff) {
306 } 306 }
307 /* Determine placement in the glyph cache texture, advancing in rows. */ 307 /* Determine placement in the glyph cache texture, advancing in rows. */
308 glRect->pos = assignCachePos_Text_(txt, glRect->size); 308 glRect->pos = assignCachePos_Text_(txt, glRect->size);
309 SDL_Texture *oldTarget = SDL_GetRenderTarget(render);
309 SDL_SetRenderTarget(render, txt->cache); 310 SDL_SetRenderTarget(render, txt->cache);
310 const SDL_Rect dstRect = sdlRect_(*glRect); 311 const SDL_Rect dstRect = sdlRect_(*glRect);
311 SDL_RenderCopy(render, tex, &(SDL_Rect){ 0, 0, dstRect.w, dstRect.h }, &dstRect); 312 SDL_RenderCopy(render, tex, &(SDL_Rect){ 0, 0, dstRect.w, dstRect.h }, &dstRect);
312 SDL_SetRenderTarget(render, NULL); 313 SDL_SetRenderTarget(render, oldTarget);
313 if (tex) { 314 if (tex) {
314 SDL_DestroyTexture(tex); 315 SDL_DestroyTexture(tex);
315 iAssert(surface); 316 iAssert(surface);
@@ -670,9 +671,10 @@ void init_TextBuf(iTextBuf *d, int font, const char *text) {
670 d->size.x, 671 d->size.x,
671 d->size.y); 672 d->size.y);
672 SDL_SetTextureBlendMode(d->texture, SDL_BLENDMODE_BLEND); 673 SDL_SetTextureBlendMode(d->texture, SDL_BLENDMODE_BLEND);
674 SDL_Texture *oldTarget = SDL_GetRenderTarget(render);
673 SDL_SetRenderTarget(render, d->texture); 675 SDL_SetRenderTarget(render, d->texture);
674 draw_Text_(font, zero_I2(), white_ColorId, range_CStr(text)); 676 draw_Text_(font, zero_I2(), white_ColorId, range_CStr(text));
675 SDL_SetRenderTarget(render, NULL); 677 SDL_SetRenderTarget(render, oldTarget);
676} 678}
677 679
678void deinit_TextBuf(iTextBuf *d) { 680void deinit_TextBuf(iTextBuf *d) {