summaryrefslogtreecommitdiff
path: root/src/ui/text.h
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-03-26 11:12:49 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-03-26 11:12:49 +0200
commitb2fe00b9c596e82e405798358077643bdc7a8df0 (patch)
tree3ae908654bc3acb07c8ca596843af34c9d7cd348 /src/ui/text.h
parent00ae4a19262ea84a1fbb8f788f7d64823b80d1b0 (diff)
Added Noto Sans SC; font table cleanup
Added the Noto Sans Simplified Chinese font. This adds another ~10 MB to resources.lgr, increasing the urgency of distributing fonts via separate downloads. The font table was getting difficult to manage, so now the sizes are broken out into a separate enum, and the table is reordered to match the FontSize order.
Diffstat (limited to 'src/ui/text.h')
-rw-r--r--src/ui/text.h97
1 files changed, 38 insertions, 59 deletions
diff --git a/src/ui/text.h b/src/ui/text.h
index 136e14e9..d86754cc 100644
--- a/src/ui/text.h
+++ b/src/ui/text.h
@@ -27,80 +27,59 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
27 27
28#include <SDL_render.h> 28#include <SDL_render.h>
29 29
30/* Size names: regular (1x) -> medium (1.2x) -> big (1.33x) -> large (1.67x) -> huge (2x) */ 30/* Content sizes: regular (1x) -> medium (1.2x) -> big (1.33x) -> large (1.67x) -> huge (2x) */
31
32enum iFontSize {
33 uiNormal_FontSize, /* 1.000 */
34 uiMedium_FontSize, /* 1.125 */
35 uiBig_FontSize, /* 1.333 */
36 uiLarge_FontSize, /* 1.666 */
37 contentRegular_FontSize,
38 contentMedium_FontSize,
39 contentBig_FontSize,
40 contentLarge_FontSize,
41 contentHuge_FontSize,
42 contentMonoSmall_FontSize,
43 contentMono_FontSize,
44 max_FontSize,
45};
31 46
32enum iFontId { 47enum iFontId {
33 default_FontId, 48 /* UI fonts: normal weight (1x, 1.125x, 1.33x, 1.67x) */
34 defaultBold_FontId, 49 default_FontId = 0,
35 defaultMedium_FontId, 50 defaultMedium_FontId,
36 defaultMediumBold_FontId,
37 defaultBig_FontId, 51 defaultBig_FontId,
38 defaultBigBold_FontId,
39 defaultLarge_FontId, 52 defaultLarge_FontId,
53 /* UI fonts: bold weight */
54 defaultBold_FontId,
55 defaultMediumBold_FontId,
56 defaultBigBold_FontId,
40 defaultLargeBold_FontId, 57 defaultLargeBold_FontId,
41 defaultMonospace_FontId,
42 defaultContentSized_FontId,
43 /* content fonts */ 58 /* content fonts */
44 regular_FontId, 59 regular_FontId,
45 bold_FontId, 60 bold_FontId,
46 monospace_FontId, 61 italic_FontId,
47 monospaceSmall_FontId,
48 medium_FontId, 62 medium_FontId,
49 big_FontId, 63 big_FontId,
50 italic_FontId,
51 largeBold_FontId, 64 largeBold_FontId,
52 hugeBold_FontId,
53 largeLight_FontId, 65 largeLight_FontId,
54 /* monospace content fonts */ 66 hugeBold_FontId,
67 monospaceSmall_FontId,
68 monospace_FontId,
69 /* extra content fonts */
70 defaultContentSized_FontId, /* UI font but sized to regular_FontId */
55 regularMonospace_FontId, 71 regularMonospace_FontId,
56 /* symbol fonts */ 72 /* symbols and scripts */
57 defaultSymbols_FontId,
58 defaultMediumSymbols_FontId,
59 defaultBigSymbols_FontId,
60 defaultLargeSymbols_FontId,
61 symbols_FontId, 73 symbols_FontId,
62 mediumSymbols_FontId, 74 emoji_FontId = symbols_FontId + max_FontSize,
63 bigSymbols_FontId, 75 japanese_FontId = emoji_FontId + max_FontSize,
64 largeSymbols_FontId, 76 chineseSimplified_FontId = japanese_FontId + max_FontSize,
65 hugeSymbols_FontId, 77 korean_FontId = chineseSimplified_FontId + max_FontSize,
66 monospaceSymbols_FontId, 78 max_FontId = korean_FontId + max_FontSize,
67 monospaceSmallSymbols_FontId,
68 /* emoji fonts */
69 defaultEmoji_FontId,
70 defaultMediumEmoji_FontId,
71 defaultBigEmoji_FontId,
72 defaultLargeEmoji_FontId,
73 emoji_FontId,
74 mediumEmoji_FontId,
75 bigEmoji_FontId,
76 largeEmoji_FontId,
77 hugeEmoji_FontId,
78 monospaceEmoji_FontId,
79 monospaceSmallEmoji_FontId,
80 /* japanese script */
81 defaultJapanese_FontId,
82 monospaceSmallJapanese_FontId,
83 monospaceJapanese_FontId,
84 regularJapanese_FontId,
85 mediumJapanese_FontId,
86 bigJapanese_FontId,
87 largeJapanese_FontId,
88 hugeJapanese_FontId,
89 /* korean script */
90 defaultKorean_FontId,
91 monospaceSmallKorean_FontId,
92 monospaceKorean_FontId,
93 regularKorean_FontId,
94 mediumKorean_FontId,
95 bigKorean_FontId,
96 largeKorean_FontId,
97 hugeKorean_FontId,
98 max_FontId,
99 79
100 /* Meta: */ 80 /* Meta: */
101 fromSymbolsToEmojiOffset_FontId = 11, 81 mask_FontId = 0xffff,
102 mask_FontId = 0xffff, 82 alwaysVariableFlag_FontId = 0x10000,
103 alwaysVariableFlag_FontId = 0x10000,
104 83
105 /* UI fonts: */ 84 /* UI fonts: */
106 uiLabel_FontId = default_FontId, 85 uiLabel_FontId = default_FontId,
@@ -111,7 +90,7 @@ enum iFontId {
111 uiInput_FontId = defaultMedium_FontId, 90 uiInput_FontId = defaultMedium_FontId,
112 uiContent_FontId = defaultMedium_FontId, 91 uiContent_FontId = defaultMedium_FontId,
113 uiContentBold_FontId = defaultMediumBold_FontId, 92 uiContentBold_FontId = defaultMediumBold_FontId,
114 uiContentSymbols_FontId = defaultMediumSymbols_FontId, 93 uiContentSymbols_FontId = symbols_FontId + uiMedium_FontSize,
115 /* Document fonts: */ 94 /* Document fonts: */
116 paragraph_FontId = regular_FontId, 95 paragraph_FontId = regular_FontId,
117 firstParagraph_FontId = medium_FontId, 96 firstParagraph_FontId = medium_FontId,
@@ -125,7 +104,7 @@ enum iFontId {
125}; 104};
126 105
127iLocalDef iBool isJapanese_FontId(enum iFontId id) { 106iLocalDef iBool isJapanese_FontId(enum iFontId id) {
128 return id >= defaultJapanese_FontId && id <= hugeJapanese_FontId; 107 return id >= japanese_FontId && id < japanese_FontId + max_FontSize;
129} 108}
130iLocalDef iBool isVariationSelector_Char(iChar c) { 109iLocalDef iBool isVariationSelector_Char(iChar c) {
131 return (c >= 0xfe00 && c <= 0xfe0f) || (c >= 0xe0100 && c <= 0xe0121); 110 return (c >= 0xfe00 && c <= 0xfe0f) || (c >= 0xe0100 && c <= 0xe0121);