summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-10-06 17:02:28 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-10-06 17:02:28 +0300
commitea8e703458f801075151b30d001d78ce3ba71ae2 (patch)
tree88bb5f83d829e7885b449032eca1405ba80e5814 /src
parent61a3dc017067be43472dadb7909094aa04d1fe9d (diff)
Fixed a couple of font issues
Scaling of monospace and symbols; cache reset.
Diffstat (limited to 'src')
-rw-r--r--src/ui/text.c22
-rw-r--r--src/ui/uploadwidget.c2
2 files changed, 12 insertions, 12 deletions
diff --git a/src/ui/text.c b/src/ui/text.c
index 86fdc084..65c95ef6 100644
--- a/src/ui/text.c
+++ b/src/ui/text.c
@@ -132,11 +132,13 @@ struct Impl_GlyphTable {
132 uint32_t indexTable[128 - 32]; /* quick ASCII lookup */ 132 uint32_t indexTable[128 - 32]; /* quick ASCII lookup */
133}; 133};
134 134
135static void clearGlyphs_Font_(iGlyphTable *d) { 135static void clearGlyphs_GlyphTable_(iGlyphTable *d) {
136 iForEach(Hash, i, &d->glyphs) { 136 if (d) {
137 delete_Glyph((iGlyph *) i.value); 137 iForEach(Hash, i, &d->glyphs) {
138 delete_Glyph((iGlyph *) i.value);
139 }
140 clear_Hash(&d->glyphs);
138 } 141 }
139 clear_Hash(&d->glyphs);
140} 142}
141 143
142static void init_GlyphTable(iGlyphTable *d) { 144static void init_GlyphTable(iGlyphTable *d) {
@@ -145,7 +147,7 @@ static void init_GlyphTable(iGlyphTable *d) {
145} 147}
146 148
147static void deinit_GlyphTable(iGlyphTable *d) { 149static void deinit_GlyphTable(iGlyphTable *d) {
148 clearGlyphs_Font_(d); 150 clearGlyphs_GlyphTable_(d);
149 deinit_Hash(&d->glyphs); 151 deinit_Hash(&d->glyphs);
150} 152}
151 153
@@ -457,11 +459,6 @@ static void initFonts_Text_(iText *d) {
457 setupFontVariants_Text_(d, spec, fontId); 459 setupFontVariants_Text_(d, spec, fontId);
458 } 460 }
459 } 461 }
460 /* test */ {
461 const iFont *h = font_Text_(preformatted_FontId); // FONT_ID(documentBody_FontId, regular_FontStyle, contentRegular_FontSize));
462 printf("{%s} %d sz:%d st:%d\n", cstr_String(&h->fontSpec->name), h->height, sizeId_Text_(h),
463 styleId_Text_(h));
464 }
465#if 0 462#if 0
466 iForIndices(i, fontData) { 463 iForIndices(i, fontData) {
467 iFont *font = font_Text_(i); 464 iFont *font = font_Text_(i);
@@ -608,7 +605,7 @@ void setContentFontSize_Text(iText *d, float fontSizeFactor) {
608static void resetCache_Text_(iText *d) { 605static void resetCache_Text_(iText *d) {
609 deinitCache_Text_(d); 606 deinitCache_Text_(d);
610 iForEach(Array, i, &d->fonts) { 607 iForEach(Array, i, &d->fonts) {
611 clearGlyphs_Font_(i.value); 608 clearGlyphs_GlyphTable_(((iFont *) i.value)->table);
612 } 609 }
613 initCache_Text_(d); 610 initCache_Text_(d);
614} 611}
@@ -720,6 +717,9 @@ iLocalDef iFont *characterFont_Font_(iFont *d, iChar ch, uint32_t *glyphIndex) {
720 continue; /* already checked this one */ 717 continue; /* already checked this one */
721 } 718 }
722 if ((*glyphIndex = glyphIndex_Font_(font, ch)) != 0) { 719 if ((*glyphIndex = glyphIndex_Font_(font, ch)) != 0) {
720 printf("using %s[%f] for %lc (%x) => %d\n",
721 cstr_String(&font->fontSpec->name), font->fontSpec->scaling,
722 (int) ch, ch, glyphIndex_Font_(font, ch));
723 return font; 723 return font;
724 } 724 }
725 } 725 }
diff --git a/src/ui/uploadwidget.c b/src/ui/uploadwidget.c
index ded8d7f8..3bd11cfb 100644
--- a/src/ui/uploadwidget.c
+++ b/src/ui/uploadwidget.c
@@ -255,7 +255,7 @@ void init_UploadWidget(iUploadWidget *d) {
255 setFlags_Widget(as_Widget(d->token), expand_WidgetFlag, iTrue); 255 setFlags_Widget(as_Widget(d->token), expand_WidgetFlag, iTrue);
256 setFocus_Widget(as_Widget(d->input)); 256 setFocus_Widget(as_Widget(d->input));
257 } 257 }
258 setFont_InputWidget(d->input, FONT_ID(monospace_FontId, regular_FontStyle, uiNormal_FontSize)); 258 setFont_InputWidget(d->input, FONT_ID(monospace_FontId, regular_FontStyle, uiSmall_FontSize));
259 setUseReturnKeyBehavior_InputWidget(d->input, iFalse); /* traditional text editor */ 259 setUseReturnKeyBehavior_InputWidget(d->input, iFalse); /* traditional text editor */
260 setLineLimits_InputWidget(d->input, 7, 20); 260 setLineLimits_InputWidget(d->input, 7, 20);
261 setHint_InputWidget(d->input, "${hint.upload.text}"); 261 setHint_InputWidget(d->input, "${hint.upload.text}");