diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-10-06 12:16:43 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-10-06 12:16:43 +0300 |
commit | 61a3dc017067be43472dadb7909094aa04d1fe9d (patch) | |
tree | 18b87895489844b4e516f79cd1588038f1d49494 /src/ui/mobile.c | |
parent | f6a54d5375aab9c41af3f7c8a5e8fcbd1e0c9287 (diff) |
Revised runtime font management
The built-in fonts are loaded via FontPack, and the font table is now constructed dynamically based on available fonts.
A full set of variants (style, size) are prepared for each font, but some of the data gets allocated lazily when needed.
GmRun needed a larger allocation for fonts, so now all the fields are combined into a single bit field.
TODO: Glyph scaling, vertical offsets, and symbol lookup are still not fully working.
Diffstat (limited to 'src/ui/mobile.c')
-rw-r--r-- | src/ui/mobile.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/ui/mobile.c b/src/ui/mobile.c index 3cb6e631..f11769f5 100644 --- a/src/ui/mobile.c +++ b/src/ui/mobile.c | |||
@@ -48,11 +48,11 @@ static iBool isSideBySideLayout_(void) { | |||
48 | } | 48 | } |
49 | 49 | ||
50 | static enum iFontId labelFont_(void) { | 50 | static enum iFontId labelFont_(void) { |
51 | return deviceType_App() == phone_AppDeviceType ? defaultBig_FontId : defaultMedium_FontId; | 51 | return deviceType_App() == phone_AppDeviceType ? uiLabelBig_FontId : uiLabelMedium_FontId; |
52 | } | 52 | } |
53 | 53 | ||
54 | static enum iFontId labelBoldFont_(void) { | 54 | static enum iFontId labelBoldFont_(void) { |
55 | return deviceType_App() == phone_AppDeviceType ? defaultBigBold_FontId : defaultMediumBold_FontId; | 55 | return deviceType_App() == phone_AppDeviceType ? uiLabelBigBold_FontId : uiLabelMediumBold_FontId; |
56 | } | 56 | } |
57 | 57 | ||
58 | static void updatePanelSheetMetrics_(iWidget *sheet) { | 58 | static void updatePanelSheetMetrics_(iWidget *sheet) { |
@@ -546,7 +546,7 @@ void makePanelItem_Mobile(iWidget *panel, const iMenuItem *item) { | |||
546 | updateSize_LabelWidget(button); | 546 | updateSize_LabelWidget(button); |
547 | } | 547 | } |
548 | setId_Widget(as_Widget(button), radId); | 548 | setId_Widget(as_Widget(button), radId); |
549 | setFont_LabelWidget(button, defaultMedium_FontId); | 549 | setFont_LabelWidget(button, uiLabelMedium_FontId); |
550 | addChildFlags_Widget(widget, iClob(button), flags); | 550 | addChildFlags_Widget(widget, iClob(button), flags); |
551 | } | 551 | } |
552 | } | 552 | } |
@@ -1056,7 +1056,7 @@ void initPanels_Mobile(iWidget *panels, iWidget *parentWidget, | |||
1056 | iForEach(ObjectList, sub, children_Widget(value)) { | 1056 | iForEach(ObjectList, sub, children_Widget(value)) { |
1057 | if (isInstance_Object(sub.object, &Class_LabelWidget)) { | 1057 | if (isInstance_Object(sub.object, &Class_LabelWidget)) { |
1058 | iLabelWidget *opt = sub.object; | 1058 | iLabelWidget *opt = sub.object; |
1059 | setFont_LabelWidget(opt, defaultMedium_FontId); | 1059 | setFont_LabelWidget(opt, uiLabelMedium_FontId); |
1060 | setFlags_Widget(as_Widget(opt), noBackground_WidgetFlag, iTrue); | 1060 | setFlags_Widget(as_Widget(opt), noBackground_WidgetFlag, iTrue); |
1061 | } | 1061 | } |
1062 | } | 1062 | } |