summaryrefslogtreecommitdiff
path: root/src/fontpack.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/fontpack.h')
-rw-r--r--src/fontpack.h16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/fontpack.h b/src/fontpack.h
index c5aa993b..e59154e3 100644
--- a/src/fontpack.h
+++ b/src/fontpack.h
@@ -50,9 +50,8 @@ enum iFontSize {
50 contentBig_FontSize, 50 contentBig_FontSize,
51 contentLarge_FontSize, 51 contentLarge_FontSize,
52 contentHuge_FontSize, 52 contentHuge_FontSize,
53 contentMonoSmall_FontSize, 53 contentTiny_FontSize,
54 contentMono_FontSize, 54 contentSmall_FontSize, /* e.g., preformatted block scaled smaller to fit */
55 contentSmall_FontSize,
56 max_FontSize 55 max_FontSize
57}; 56};
58 57
@@ -84,6 +83,7 @@ iDeclareType(FontFile)
84iDeclareTypeConstruction(FontFile) 83iDeclareTypeConstruction(FontFile)
85 84
86struct Impl_FontFile { 85struct Impl_FontFile {
86 iString id; /* for detecting when the same file is used in many places */
87 enum iFontStyle style; 87 enum iFontStyle style;
88 iBlock sourceData; 88 iBlock sourceData;
89 stbtt_fontinfo stbInfo; 89 stbtt_fontinfo stbInfo;
@@ -112,13 +112,19 @@ struct Impl_FontSpec {
112 iString name; /* human-readable label */ 112 iString name; /* human-readable label */
113 int flags; 113 int flags;
114 int priority; 114 int priority;
115 float scaling; 115 float heightScale[2]; /* overall height scaling; ui, document */
116 float vertOffset; 116 float glyphScale[2]; /* ui, document */
117 float vertOffsetScale[2]; /* ui, document */
117 const iFontFile *styles[max_FontStyle]; 118 const iFontFile *styles[max_FontStyle];
118}; 119};
120
121iLocalDef int scaleType_FontSpec(enum iFontSize sizeId) {
122 return sizeId / contentRegular_FontSize;
123}
119 124
120void init_Fonts (const char *userDir); 125void init_Fonts (const char *userDir);
121void deinit_Fonts (void); 126void deinit_Fonts (void);
122 127
123const iFontSpec * findSpec_Fonts (const char *fontId); 128const iFontSpec * findSpec_Fonts (const char *fontId);
129const iPtrArray * listSpecs_Fonts (iBool (*filterFunc)(const iFontSpec *));
124const iPtrArray * listSpecsByPriority_Fonts (void); 130const iPtrArray * listSpecsByPriority_Fonts (void);