Skip to content

Commit fea10f0

Browse files
committed
feat(developer): add web font references to package
While a package supports a .ttf or .otf font for the OSK and Display fonts for use within the Keyman apps, on websites it also supports .woff and .woff2. This change makes it possible to specify a set of fonts for a package which will be provided through api.keyman.com to websites. This means that .woff and .woff2 fonts may also be included in the package and may not be used on target devices at this time, it further opens the pathway to deploying .kmp packages to web in the future. The deployment stage of keymanapp/keyboards will require a new phase to copy web fonts from packages to s.keyman.com.
1 parent 8a9243e commit fea10f0

File tree

16 files changed

+527
-45
lines changed

16 files changed

+527
-45
lines changed

common/schemas/kps/kps.xsd

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,8 @@
125125
<xs:element minOccurs="0" maxOccurs="1" name="DisplayFont" type="xs:string" />
126126
<xs:element minOccurs="0" maxOccurs="1" name="Languages" type="km-keyboard-languages" />
127127
<xs:element minOccurs="0" maxOccurs="1" name="Examples" type="km-keyboard-examples" />
128+
<xs:element minOccurs="0" maxOccurs="1" name="WebOSKFonts" type="km-keyboard-fonts" />
129+
<xs:element minOccurs="0" maxOccurs="1" name="WebDisplayFonts" type="km-keyboard-fonts" />
128130
</xs:all>
129131
</xs:complexType>
130132
</xs:element>
@@ -242,4 +244,14 @@
242244
</xs:sequence>
243245
</xs:complexType>
244246

247+
<xs:complexType name="km-keyboard-fonts">
248+
<xs:sequence>
249+
<xs:element minOccurs="0" maxOccurs="unbounded" name="Font">
250+
<xs:complexType>
251+
<xs:attribute name="Filename" type="xs:string" />
252+
</xs:complexType>
253+
</xs:element>
254+
</xs:sequence>
255+
</xs:complexType>
256+
245257
</xs:schema>

common/web/types/src/package/kmp-json-file.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,6 @@ export interface KmpJsonFileOptions {
2020
executeProgram?: string;
2121
msiFilename?: string;
2222
msiOptions?: string;
23-
/**
24-
* List of all font files, grouped by font family
25-
* Compiler extracts font metadata from .ttf,.otf,.woff,.woff2
26-
*/
27-
fonts?: {[family:string]: string[]};
2823
}
2924

3025
export interface KmpJsonFileInfo {
@@ -71,6 +66,14 @@ export interface KmpJsonFileKeyboard {
7166
rtl?: boolean;
7267
languages?: KmpJsonFileLanguage[];
7368
examples?: KmpJsonFileExample[];
69+
/**
70+
* array of web font alternatives for OSK. should be same font data as oskFont
71+
*/
72+
webOskFonts?: string[];
73+
/**
74+
* array of web font alternatives for display. should be same font data as displayFont
75+
*/
76+
webDisplayFonts?: string[];
7477
}
7578

7679
export interface KmpJsonFileStartMenu {

common/web/types/src/package/kps-file.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,24 @@ export interface KpsFileKeyboard {
116116
rTL?: string;
117117
languages?: KpsFileLanguages;
118118
examples?: KpsFileLanguageExamples;
119+
/**
120+
* array of web font alternatives for OSK. should be same font data as oskFont
121+
*/
122+
webOSKFonts?: KpsFileFonts;
123+
/**
124+
* array of web font alternatives for display. should be same font data as displayFont
125+
*/
126+
webDisplayFonts?: KpsFileFonts;
127+
}
128+
129+
export interface KpsFileFonts {
130+
font: KpsFileFont[] | KpsFileFont;
131+
}
132+
133+
export interface KpsFileFont {
134+
$: {
135+
Filename: string;
136+
}
119137
}
120138

121139
export interface KpsFileKeyboards {

common/windows/delphi/general/utilfiletypes.pas

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,15 @@ TKMFileTypeInfo = record
6262
Ext_LexicalModelPackageSource = '.model.kps';
6363
Ext_LexicalModelProject = '.model.kpj';
6464

65-
const ExtFileTypes: array[0..13] of TKMFileTypeInfo = (
65+
const ExtFileTypes: array[0..14] of TKMFileTypeInfo = (
6666
(Ext: Ext_KeymanSource; FileType: ftKeymanSource),
6767
(Ext: Ext_PackageSource; FileType: ftPackageSource),
6868
(Ext: Ext_KeymanFile; FileType: ftKeymanFile),
6969
(Ext: Ext_PackageFile; FileType: ftPackageFile),
7070
(Ext: '.ttf'; FileType: ftFont),
7171
(Ext: '.otf'; FileType: ftFont),
72-
(Ext: '.fon'; FileType: ftFont),
72+
(Ext: '.woff'; FileType: ftFont),
73+
(Ext: '.woff2'; FileType: ftFont),
7374
(Ext: '.ttc'; FileType: ftFont),
7475
(Ext: Ext_VisualKeyboard; FileType: ftVisualKeyboard),
7576
(Ext: Ext_VisualKeyboardSource; FileType: ftVisualKeyboardSource),

0 commit comments

Comments
 (0)