summaryrefslogtreecommitdiff
path: root/src/fontpack.h
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-10-20 07:57:30 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-10-20 07:57:30 +0300
commit57cbcc6e864abd368bde93154b3580147936201c (patch)
tree157ecbb534f85d83ef39dcb68850e42d7cce6580 /src/fontpack.h
parent5b8c606183df3054c4691f89c97e346786947914 (diff)
Installing individual TTF files; generate fontpack.ini
Diffstat (limited to 'src/fontpack.h')
-rw-r--r--src/fontpack.h34
1 files changed, 18 insertions, 16 deletions
diff --git a/src/fontpack.h b/src/fontpack.h
index fb8d757e..5d592822 100644
--- a/src/fontpack.h
+++ b/src/fontpack.h
@@ -110,22 +110,23 @@ iDeclareType(FontSpec)
110iDeclareTypeConstruction(FontSpec) 110iDeclareTypeConstruction(FontSpec)
111 111
112enum iFontSpecFlags { 112enum iFontSpecFlags {
113 override_FontSpecFlag = iBit(1), 113 user_FontSpecFlag = iBit(1), /* user's standalone font, can be used for anything */
114 monospace_FontSpecFlag = iBit(2), /* can be used in preformatted content */ 114 override_FontSpecFlag = iBit(2),
115 auxiliary_FontSpecFlag = iBit(3), /* only used for looking up glyphs missing from other fonts */ 115 monospace_FontSpecFlag = iBit(3), /* can be used in preformatted content */
116 allowSpacePunct_FontSpecFlag = iBit(4), /* space/punctuation glyphs from this auxiliary font can be used */ 116 auxiliary_FontSpecFlag = iBit(4), /* only used for looking up glyphs missing from other fonts */
117 allowSpacePunct_FontSpecFlag = iBit(5), /* space/punctuation glyphs from this auxiliary font can be used */
117 fixNunitoKerning_FontSpecFlag = iBit(31), /* manual hardcoded kerning tweaks for Nunito */ 118 fixNunitoKerning_FontSpecFlag = iBit(31), /* manual hardcoded kerning tweaks for Nunito */
118}; 119};
119 120
120struct Impl_FontSpec { 121struct Impl_FontSpec {
121 iString id; /* unique ID */ 122 iString id; /* unique ID */
122 iString name; /* human-readable label */ 123 iString name; /* human-readable label */
123 iString sourcePath; /* file where the path was loaded, could be a .fontpack */ 124 iString sourcePath; /* file where the path was loaded, could be a .fontpack */
124 int flags; 125 int flags;
125 int priority; 126 int priority;
126 float heightScale[2]; /* overall height scaling; ui, document */ 127 float heightScale[2]; /* overall height scaling; ui, document */
127 float glyphScale[2]; /* ui, document */ 128 float glyphScale[2]; /* ui, document */
128 float vertOffsetScale[2]; /* ui, document */ 129 float vertOffsetScale[2]; /* ui, document */
129 const iFontFile *styles[max_FontStyle]; 130 const iFontFile *styles[max_FontStyle];
130}; 131};
131 132
@@ -158,25 +159,26 @@ iBool isDisabled_FontPack (const iFontPack *);
158iBool isReadOnly_FontPack (const iFontPack *); 159iBool isReadOnly_FontPack (const iFontPack *);
159const iPtrArray * listSpecs_FontPack (const iFontPack *); 160const iPtrArray * listSpecs_FontPack (const iFontPack *);
160iString * infoText_FontPack (const iFontPack *); 161iString * infoText_FontPack (const iFontPack *);
161const iArray * actions_FontPack (const iFontPack *); 162const iArray * actions_FontPack (const iFontPack *, iBool showInstalled);
162 163
163const iString * idFromUrl_FontPack (const iString *url); 164const iString * idFromUrl_FontPack (const iString *url);
164 165
165/*----------------------------------------------------------------------------------------------*/ 166/*----------------------------------------------------------------------------------------------*/
166 167
167iDeclareType(GmDocument)
168
169void init_Fonts (const char *userDir); 168void init_Fonts (const char *userDir);
170void deinit_Fonts (void); 169void deinit_Fonts (void);
171 170
171void enablePack_Fonts (const iString *packId, iBool enable);
172void updateActive_Fonts (void);
172const iFontPack * pack_Fonts (const char *packId); 173const iFontPack * pack_Fonts (const char *packId);
173const iFontPack * packByPath_Fonts (const iString *path); 174const iFontPack * packByPath_Fonts (const iString *path);
174const iFontSpec * findSpec_Fonts (const char *fontId); 175const iFontSpec * findSpec_Fonts (const char *fontId);
175const iPtrArray * listPacks_Fonts (void); 176const iPtrArray * listPacks_Fonts (void);
176const iPtrArray * listSpecs_Fonts (iBool (*filterFunc)(const iFontSpec *)); 177const iPtrArray * listSpecs_Fonts (iBool (*filterFunc)(const iFontSpec *));
177const iPtrArray * listSpecsByPriority_Fonts (void); 178const iPtrArray * listSpecsByPriority_Fonts (void);
178const iString * infoPage_Fonts (void); 179const iString * infoPage_Fonts (iRangecc query);
179void install_Fonts (const iString *fontId, const iBlock *data); 180void install_Fonts (const iString *fontId, const iBlock *data);
181void installFontFile_Fonts (const iString *fileName, const iBlock *data);
180void reload_Fonts (void); 182void reload_Fonts (void);
181 183
182iLocalDef iBool isInstalled_Fonts(const char *packId) { 184iLocalDef iBool isInstalled_Fonts(const char *packId) {