diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-10-09 12:50:40 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-10-09 12:50:40 +0300 |
commit | aeaf46c5ac708bc225ea4095b7ce8fc607c74867 (patch) | |
tree | 43ba5f5f70504482da5a8e3b9210b50942ae818b /src/ui | |
parent | d197e02ae35d8439c80106db6ce1c561499e5629 (diff) |
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.
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/text.c | 5 | ||||
-rw-r--r-- | src/ui/util.c | 39 |
2 files changed, 23 insertions, 21 deletions
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) { | |||
472 | } | 472 | } |
473 | 473 | ||
474 | static int maxGlyphHeight_Text_(const iText *d) { | 474 | static int maxGlyphHeight_Text_(const iText *d) { |
475 | return 2 * d->contentFontSize * fontSize_UI; | 475 | /* Huge size is 2 * contentFontSize. */ |
476 | return 4 * d->contentFontSize * fontSize_UI; | ||
476 | } | 477 | } |
477 | 478 | ||
478 | static void initCache_Text_(iText *d) { | 479 | static void initCache_Text_(iText *d) { |
@@ -491,7 +492,7 @@ static void initCache_Text_(iText *d) { | |||
491 | /* Allocate initial (empty) rows. These will be assigned actual locations in the cache | 492 | /* Allocate initial (empty) rows. These will be assigned actual locations in the cache |
492 | once at least one glyph is stored. */ | 493 | once at least one glyph is stored. */ |
493 | for (int h = d->cacheRowAllocStep; | 494 | for (int h = d->cacheRowAllocStep; |
494 | h <= 2.5 * textSize + d->cacheRowAllocStep; | 495 | h <= 5 * textSize + d->cacheRowAllocStep; |
495 | h += d->cacheRowAllocStep) { | 496 | h += d->cacheRowAllocStep) { |
496 | pushBack_Array(&d->cacheRows, &(iCacheRow){ .height = 0 }); | 497 | pushBack_Array(&d->cacheRows, &(iCacheRow){ .height = 0 }); |
497 | } | 498 | } |
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) { | |||
2523 | /* Fonts. */ { | 2523 | /* Fonts. */ { |
2524 | setId_Widget(appendTwoColumnTabPage_Widget(tabs, "${heading.prefs.fonts}", '4', &headings, &values), "prefs.page.fonts"); | 2524 | setId_Widget(appendTwoColumnTabPage_Widget(tabs, "${heading.prefs.fonts}", '4', &headings, &values), "prefs.page.fonts"); |
2525 | /* Fonts. */ { | 2525 | /* Fonts. */ { |
2526 | addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.font.ui}"))); | ||
2527 | addFontButtons_(values, "ui"); | ||
2528 | addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.font.heading}"))); | 2526 | addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.font.heading}"))); |
2529 | addFontButtons_(values, "heading"); | 2527 | addFontButtons_(values, "heading"); |
2530 | addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.font.body}"))); | 2528 | addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.font.body}"))); |
@@ -2532,41 +2530,44 @@ iWidget *makePreferences_Widget(void) { | |||
2532 | addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.font.mono}"))); | 2530 | addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.font.mono}"))); |
2533 | addFontButtons_(values, "mono"); | 2531 | addFontButtons_(values, "mono"); |
2534 | addDialogPadding_(headings, values); | 2532 | addDialogPadding_(headings, values); |
2535 | addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.mono}"))); | 2533 | addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.boldlink}"))); |
2536 | iWidget *mono = new_Widget(); { | 2534 | iWidget *boldLink = new_Widget(); { |
2535 | /* TODO: Add a utility function for this type of toggles? (also for above) */ | ||
2537 | iWidget *tog; | 2536 | iWidget *tog; |
2538 | setTextCStr_LabelWidget( | 2537 | setTextCStr_LabelWidget( |
2539 | addChild_Widget(mono, tog = iClob(makeToggle_Widget("prefs.mono.gemini"))), | 2538 | addChild_Widget(boldLink, tog = iClob(makeToggle_Widget("prefs.boldlink.dark"))), |
2540 | "${prefs.mono.gemini}"); | 2539 | "${prefs.boldlink.dark}"); |
2541 | setFlags_Widget(tog, fixedWidth_WidgetFlag, iFalse); | 2540 | setFlags_Widget(tog, fixedWidth_WidgetFlag, iFalse); |
2542 | updateSize_LabelWidget((iLabelWidget *) tog); | 2541 | updateSize_LabelWidget((iLabelWidget *) tog); |
2543 | setTextCStr_LabelWidget( | 2542 | setTextCStr_LabelWidget( |
2544 | addChild_Widget(mono, tog = iClob(makeToggle_Widget("prefs.mono.gopher"))), | 2543 | addChild_Widget(boldLink, tog = iClob(makeToggle_Widget("prefs.boldlink.light"))), |
2545 | "${prefs.mono.gopher}"); | 2544 | "${prefs.boldlink.light}"); |
2546 | setFlags_Widget(tog, fixedWidth_WidgetFlag, iFalse); | 2545 | setFlags_Widget(tog, fixedWidth_WidgetFlag, iFalse); |
2547 | updateSize_LabelWidget((iLabelWidget *) tog); | 2546 | updateSize_LabelWidget((iLabelWidget *) tog); |
2548 | } | 2547 | } |
2549 | addChildFlags_Widget(values, iClob(mono), arrangeHorizontal_WidgetFlag | arrangeSize_WidgetFlag); | 2548 | addChildFlags_Widget(values, iClob(boldLink), arrangeHorizontal_WidgetFlag | arrangeSize_WidgetFlag); |
2550 | addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.font.monodoc}"))); | ||
2551 | addFontButtons_(values, "monodoc"); | ||
2552 | addDialogPadding_(headings, values); | 2549 | addDialogPadding_(headings, values); |
2553 | addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.boldlink}"))); | 2550 | addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.mono}"))); |
2554 | iWidget *boldLink = new_Widget(); { | 2551 | iWidget *mono = new_Widget(); { |
2555 | /* TODO: Add a utility function for this type of toggles? (also for above) */ | ||
2556 | iWidget *tog; | 2552 | iWidget *tog; |
2557 | setTextCStr_LabelWidget( | 2553 | setTextCStr_LabelWidget( |
2558 | addChild_Widget(boldLink, tog = iClob(makeToggle_Widget("prefs.boldlink.dark"))), | 2554 | addChild_Widget(mono, tog = iClob(makeToggle_Widget("prefs.mono.gemini"))), |
2559 | "${prefs.boldlink.dark}"); | 2555 | "${prefs.mono.gemini}"); |
2560 | setFlags_Widget(tog, fixedWidth_WidgetFlag, iFalse); | 2556 | setFlags_Widget(tog, fixedWidth_WidgetFlag, iFalse); |
2561 | updateSize_LabelWidget((iLabelWidget *) tog); | 2557 | updateSize_LabelWidget((iLabelWidget *) tog); |
2562 | setTextCStr_LabelWidget( | 2558 | setTextCStr_LabelWidget( |
2563 | addChild_Widget(boldLink, tog = iClob(makeToggle_Widget("prefs.boldlink.light"))), | 2559 | addChild_Widget(mono, tog = iClob(makeToggle_Widget("prefs.mono.gopher"))), |
2564 | "${prefs.boldlink.light}"); | 2560 | "${prefs.mono.gopher}"); |
2565 | setFlags_Widget(tog, fixedWidth_WidgetFlag, iFalse); | 2561 | setFlags_Widget(tog, fixedWidth_WidgetFlag, iFalse); |
2566 | updateSize_LabelWidget((iLabelWidget *) tog); | 2562 | updateSize_LabelWidget((iLabelWidget *) tog); |
2567 | } | 2563 | } |
2568 | addChildFlags_Widget(values, iClob(boldLink), arrangeHorizontal_WidgetFlag | arrangeSize_WidgetFlag); | 2564 | addChildFlags_Widget(values, iClob(mono), arrangeHorizontal_WidgetFlag | arrangeSize_WidgetFlag); |
2565 | addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.font.monodoc}"))); | ||
2566 | addFontButtons_(values, "monodoc"); | ||
2569 | addDialogPadding_(headings, values); | 2567 | addDialogPadding_(headings, values); |
2568 | addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.font.ui}"))); | ||
2569 | addFontButtons_(values, "ui"); | ||
2570 | // addDialogPadding_(headings, values); | ||
2570 | // /* Custom font. */ { | 2571 | // /* Custom font. */ { |
2571 | // iInputWidget *customFont = new_InputWidget(0); | 2572 | // iInputWidget *customFont = new_InputWidget(0); |
2572 | // setHint_InputWidget(customFont, "${hint.prefs.userfont}"); | 2573 | // setHint_InputWidget(customFont, "${hint.prefs.userfont}"); |