From aeaf46c5ac708bc225ea4095b7ce8fc607c74867 Mon Sep 17 00:00:00 2001 From: Jaakko Keränen Date: Sat, 9 Oct 2021 12:50:40 +0300 Subject: Preferences: Selecting fonts to use Now all the available fonts are selectable in the dialog. Added preformatted and UI font settings and shuffled the order a bit to make more sense. --- src/ui/text.c | 5 +++-- src/ui/util.c | 39 ++++++++++++++++++++------------------- 2 files changed, 23 insertions(+), 21 deletions(-) (limited to 'src/ui') diff --git a/src/ui/text.c b/src/ui/text.c index 14b4e305..3ed5b327 100644 --- a/src/ui/text.c +++ b/src/ui/text.c @@ -472,7 +472,8 @@ static void deinitFonts_Text_(iText *d) { } static int maxGlyphHeight_Text_(const iText *d) { - return 2 * d->contentFontSize * fontSize_UI; + /* Huge size is 2 * contentFontSize. */ + return 4 * d->contentFontSize * fontSize_UI; } static void initCache_Text_(iText *d) { @@ -491,7 +492,7 @@ static void initCache_Text_(iText *d) { /* Allocate initial (empty) rows. These will be assigned actual locations in the cache once at least one glyph is stored. */ for (int h = d->cacheRowAllocStep; - h <= 2.5 * textSize + d->cacheRowAllocStep; + h <= 5 * textSize + d->cacheRowAllocStep; h += d->cacheRowAllocStep) { pushBack_Array(&d->cacheRows, &(iCacheRow){ .height = 0 }); } diff --git a/src/ui/util.c b/src/ui/util.c index 73193c7a..0e079efb 100644 --- a/src/ui/util.c +++ b/src/ui/util.c @@ -2523,8 +2523,6 @@ iWidget *makePreferences_Widget(void) { /* Fonts. */ { setId_Widget(appendTwoColumnTabPage_Widget(tabs, "${heading.prefs.fonts}", '4', &headings, &values), "prefs.page.fonts"); /* Fonts. */ { - addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.font.ui}"))); - addFontButtons_(values, "ui"); addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.font.heading}"))); addFontButtons_(values, "heading"); addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.font.body}"))); @@ -2532,41 +2530,44 @@ iWidget *makePreferences_Widget(void) { addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.font.mono}"))); addFontButtons_(values, "mono"); addDialogPadding_(headings, values); - addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.mono}"))); - iWidget *mono = new_Widget(); { + addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.boldlink}"))); + iWidget *boldLink = new_Widget(); { + /* TODO: Add a utility function for this type of toggles? (also for above) */ iWidget *tog; setTextCStr_LabelWidget( - addChild_Widget(mono, tog = iClob(makeToggle_Widget("prefs.mono.gemini"))), - "${prefs.mono.gemini}"); + addChild_Widget(boldLink, tog = iClob(makeToggle_Widget("prefs.boldlink.dark"))), + "${prefs.boldlink.dark}"); setFlags_Widget(tog, fixedWidth_WidgetFlag, iFalse); updateSize_LabelWidget((iLabelWidget *) tog); setTextCStr_LabelWidget( - addChild_Widget(mono, tog = iClob(makeToggle_Widget("prefs.mono.gopher"))), - "${prefs.mono.gopher}"); + addChild_Widget(boldLink, tog = iClob(makeToggle_Widget("prefs.boldlink.light"))), + "${prefs.boldlink.light}"); setFlags_Widget(tog, fixedWidth_WidgetFlag, iFalse); updateSize_LabelWidget((iLabelWidget *) tog); } - addChildFlags_Widget(values, iClob(mono), arrangeHorizontal_WidgetFlag | arrangeSize_WidgetFlag); - addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.font.monodoc}"))); - addFontButtons_(values, "monodoc"); + addChildFlags_Widget(values, iClob(boldLink), arrangeHorizontal_WidgetFlag | arrangeSize_WidgetFlag); addDialogPadding_(headings, values); - addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.boldlink}"))); - iWidget *boldLink = new_Widget(); { - /* TODO: Add a utility function for this type of toggles? (also for above) */ + addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.mono}"))); + iWidget *mono = new_Widget(); { iWidget *tog; setTextCStr_LabelWidget( - addChild_Widget(boldLink, tog = iClob(makeToggle_Widget("prefs.boldlink.dark"))), - "${prefs.boldlink.dark}"); + addChild_Widget(mono, tog = iClob(makeToggle_Widget("prefs.mono.gemini"))), + "${prefs.mono.gemini}"); setFlags_Widget(tog, fixedWidth_WidgetFlag, iFalse); updateSize_LabelWidget((iLabelWidget *) tog); setTextCStr_LabelWidget( - addChild_Widget(boldLink, tog = iClob(makeToggle_Widget("prefs.boldlink.light"))), - "${prefs.boldlink.light}"); + addChild_Widget(mono, tog = iClob(makeToggle_Widget("prefs.mono.gopher"))), + "${prefs.mono.gopher}"); setFlags_Widget(tog, fixedWidth_WidgetFlag, iFalse); updateSize_LabelWidget((iLabelWidget *) tog); } - addChildFlags_Widget(values, iClob(boldLink), arrangeHorizontal_WidgetFlag | arrangeSize_WidgetFlag); + addChildFlags_Widget(values, iClob(mono), arrangeHorizontal_WidgetFlag | arrangeSize_WidgetFlag); + addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.font.monodoc}"))); + addFontButtons_(values, "monodoc"); addDialogPadding_(headings, values); + addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.font.ui}"))); + addFontButtons_(values, "ui"); + // addDialogPadding_(headings, values); // /* Custom font. */ { // iInputWidget *customFont = new_InputWidget(0); // setHint_InputWidget(customFont, "${hint.prefs.userfont}"); -- cgit v1.2.3