summaryrefslogtreecommitdiff
path: root/src/ui
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-10-05 06:55:51 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-10-05 06:55:51 +0300
commit827951d2807b031d131b7fc05b1596550d258676 (patch)
tree836a6a1ceb07cfbc1867ef65fcc30331b0ad33ba /src/ui
parent88993e95e5ff9fecc5980b25e1778053ca23afe0 (diff)
Started working on font packs
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/text.c6
-rw-r--r--src/ui/text.h29
2 files changed, 6 insertions, 29 deletions
diff --git a/src/ui/text.c b/src/ui/text.c
index cbce4715..e3f7f7c4 100644
--- a/src/ui/text.c
+++ b/src/ui/text.c
@@ -385,8 +385,8 @@ static void initFonts_Text_(iText *d) {
385 { &fontSourceSans3Regular_Embedded, uiSize * 1.125f, 1.0f, uiMedium_FontSize }, 385 { &fontSourceSans3Regular_Embedded, uiSize * 1.125f, 1.0f, uiMedium_FontSize },
386 { &fontSourceSans3Regular_Embedded, uiSize * 1.333f, 1.0f, uiBig_FontSize }, 386 { &fontSourceSans3Regular_Embedded, uiSize * 1.333f, 1.0f, uiBig_FontSize },
387 { &fontSourceSans3Regular_Embedded, uiSize * 1.666f, 1.0f, uiLarge_FontSize }, 387 { &fontSourceSans3Regular_Embedded, uiSize * 1.666f, 1.0f, uiLarge_FontSize },
388 { &fontSourceSans3Regular_Embedded, uiSize * 0.900f, 1.0f, uiSmall_FontSize },
389 { &fontSourceSans3Semibold_Embedded, uiSize * 0.800f, 1.0f, uiTiny_FontSize }, 388 { &fontSourceSans3Semibold_Embedded, uiSize * 0.800f, 1.0f, uiTiny_FontSize },
389 { &fontSourceSans3Regular_Embedded, uiSize * 0.900f, 1.0f, uiSmall_FontSize },
390 /* UI fonts: bold weight */ 390 /* UI fonts: bold weight */
391 { &fontSourceSans3Bold_Embedded, uiSize, 1.0f, uiNormal_FontSize }, 391 { &fontSourceSans3Bold_Embedded, uiSize, 1.0f, uiNormal_FontSize },
392 { &fontSourceSans3Bold_Embedded, uiSize * 1.125f, 1.0f, uiMedium_FontSize }, 392 { &fontSourceSans3Bold_Embedded, uiSize * 1.125f, 1.0f, uiMedium_FontSize },
@@ -408,12 +408,12 @@ static void initFonts_Text_(iText *d) {
408 { &fontSourceSans3Regular_Embedded, textSize * 0.80f, scaling, contentRegular_FontSize }, 408 { &fontSourceSans3Regular_Embedded, textSize * 0.80f, scaling, contentRegular_FontSize },
409 /* symbols and scripts */ 409 /* symbols and scripts */
410#define DEFINE_FONT_SET(data, glyphScale) \ 410#define DEFINE_FONT_SET(data, glyphScale) \
411 { (data), uiSize * 0.800f, glyphScale, uiTiny_FontSize }, \
412 { (data), uiSize * 0.900f, glyphScale, uiSmall_FontSize }, \
411 { (data), uiSize, glyphScale, uiNormal_FontSize }, \ 413 { (data), uiSize, glyphScale, uiNormal_FontSize }, \
412 { (data), uiSize * 1.125f, glyphScale, uiMedium_FontSize }, \ 414 { (data), uiSize * 1.125f, glyphScale, uiMedium_FontSize }, \
413 { (data), uiSize * 1.333f, glyphScale, uiBig_FontSize }, \ 415 { (data), uiSize * 1.333f, glyphScale, uiBig_FontSize }, \
414 { (data), uiSize * 1.666f, glyphScale, uiLarge_FontSize }, \ 416 { (data), uiSize * 1.666f, glyphScale, uiLarge_FontSize }, \
415 { (data), uiSize * 0.900f, glyphScale, uiSmall_FontSize }, \
416 { (data), uiSize * 0.800f, glyphScale, uiTiny_FontSize }, \
417 { (data), textSize, glyphScale, contentRegular_FontSize }, \ 417 { (data), textSize, glyphScale, contentRegular_FontSize }, \
418 { (data), textSize * 1.200f, glyphScale, contentMedium_FontSize }, \ 418 { (data), textSize * 1.200f, glyphScale, contentMedium_FontSize }, \
419 { (data), textSize * 1.333f, glyphScale, contentBig_FontSize }, \ 419 { (data), textSize * 1.333f, glyphScale, contentBig_FontSize }, \
diff --git a/src/ui/text.h b/src/ui/text.h
index 35ae48f8..1b3200d4 100644
--- a/src/ui/text.h
+++ b/src/ui/text.h
@@ -25,34 +25,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
25#include <the_Foundation/rect.h> 25#include <the_Foundation/rect.h>
26#include <the_Foundation/string.h> 26#include <the_Foundation/string.h>
27#include <the_Foundation/vec2.h> 27#include <the_Foundation/vec2.h>
28
29#include <SDL_render.h> 28#include <SDL_render.h>
30 29
31/* Content sizes: regular (1x) -> medium (1.2x) -> big (1.33x) -> large (1.67x) -> huge (2x) */ 30#include "fontpack.h"
32
33enum iFontSize {
34 uiNormal_FontSize, /* 1.000 */
35 uiMedium_FontSize, /* 1.125 */
36 uiBig_FontSize, /* 1.333 */
37 uiLarge_FontSize, /* 1.666 */
38 uiSmall_FontSize, /* 0.900 */
39 uiTiny_FontSize, /* 0.800 */
40 contentRegular_FontSize,
41 contentMedium_FontSize,
42 contentBig_FontSize,
43 contentLarge_FontSize,
44 contentHuge_FontSize,
45 contentMonoSmall_FontSize,
46 contentMono_FontSize,
47 max_FontSize,
48};
49 31
50iLocalDef enum iFontSize larger_FontSize(enum iFontSize size) { 32/* Content sizes: regular (1x) -> medium (1.2x) -> big (1.33x) -> large (1.67x) -> huge (2x) */
51 if (size == uiLarge_FontSize || size == contentHuge_FontSize || size == contentMono_FontSize) {
52 return size; /* biggest available */
53 }
54 return size + 1;
55}
56 33
57enum iFontId { 34enum iFontId {
58 /* UI fonts: normal weight (1x, 1.125x, 1.33x, 1.67x) */ 35 /* UI fonts: normal weight (1x, 1.125x, 1.33x, 1.67x) */
@@ -60,8 +37,8 @@ enum iFontId {
60 defaultMedium_FontId, 37 defaultMedium_FontId,
61 defaultBig_FontId, 38 defaultBig_FontId,
62 defaultLarge_FontId, 39 defaultLarge_FontId,
63 defaultSmall_FontId,
64 defaultTiny_FontId, 40 defaultTiny_FontId,
41 defaultSmall_FontId,
65 /* UI fonts: bold weight */ 42 /* UI fonts: bold weight */
66 defaultBold_FontId, 43 defaultBold_FontId,
67 defaultMediumBold_FontId, 44 defaultMediumBold_FontId,