This repository has been archived by the owner on Aug 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from googlefonts/glyph-fbs
schemas: add glyph.fbs and plist.fbs
- Loading branch information
Showing
26 changed files
with
4,207 additions
and
3,728 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/PropertyLists/ | ||
namespace FlatFont.Plist; | ||
|
||
union Type { | ||
Integer, | ||
Real, | ||
String, | ||
Boolean, | ||
Data, | ||
Date, | ||
Dict, | ||
Array, | ||
} | ||
|
||
// can't have vectors of unions in python or rust (only c++) so I define a table | ||
// that contains the union | ||
table Plist { | ||
value: Type (required); | ||
} | ||
|
||
// can't use struct because 'only tables can be union elements' in python flatbuffers | ||
table Integer { | ||
value: int; | ||
} | ||
|
||
table Real { | ||
value: float; | ||
} | ||
|
||
table String { | ||
value: string (required); | ||
} | ||
|
||
table Boolean { | ||
value: bool; | ||
} | ||
|
||
table Data { | ||
value: [ubyte] (required); | ||
} | ||
|
||
// xml plist date conforms to a subset of ISO 8601: | ||
// YYYY '-' MM '-' DD 'T' HH ':' MM ':' SS 'Z' | ||
table Date { | ||
value: string (required); | ||
} | ||
|
||
table Dict { | ||
value: [DictItem] (required); | ||
} | ||
|
||
table DictItem { | ||
key: string (required, key); | ||
value: Plist (required); | ||
} | ||
|
||
table Array { | ||
values: [Plist] (required); | ||
} | ||
|
||
root_type Plist; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
include "misc.fbs"; // for Guideline and Transform | ||
include "../plist.fbs"; | ||
|
||
namespace FlatFont.Ufo; | ||
|
||
/// https://unifiedfontobject.org/versions/ufo3/glyphs/glif/ | ||
table Glyph { | ||
name: string (required, key); | ||
width: float; | ||
height: float; | ||
unicodes: [uint]; | ||
image: Image; | ||
lib: Plist.Dict; | ||
note: string; | ||
anchors: [Anchor]; | ||
components: [Component]; | ||
contours: [Contour]; | ||
guidelines: [Guideline]; | ||
} | ||
|
||
/// https://unifiedfontobject.org/versions/ufo3/glyphs/glif/#image | ||
table Image { | ||
fileName: string; | ||
transformation: Transform; | ||
color: string; | ||
} | ||
|
||
/// https://unifiedfontobject.org/versions/ufo3/glyphs/glif/#anchor | ||
table Anchor { | ||
x: float; | ||
y: float; | ||
name: string; | ||
color: string; | ||
identifier: string; | ||
} | ||
|
||
/// https://unifiedfontobject.org/versions/ufo3/glyphs/glif/#component | ||
table Component { | ||
baseGlyph: string; | ||
transformation: Transform; | ||
identifier: string; | ||
} | ||
|
||
/// https://unifiedfontobject.org/versions/ufo3/glyphs/glif/#contour | ||
table Contour { | ||
points: [Point]; | ||
identifier: string; | ||
} | ||
|
||
/// https://unifiedfontobject.org/versions/ufo3/glyphs/glif/#point | ||
table Point { | ||
x: float; | ||
y: float; | ||
type: string; | ||
smooth: bool; | ||
name: string; | ||
identifier: string; | ||
} | ||
|
||
root_type Glyph; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
namespace FlatFont.Ufo; | ||
|
||
table Guideline { | ||
x: float; | ||
y: float; | ||
angle: float; | ||
name: string; | ||
color: string; | ||
identifier: string; | ||
} | ||
|
||
table Transform { | ||
xScale: float = 1; | ||
xyScale: float = 0; | ||
yxScale: float = 0; | ||
yScale: float = 1; | ||
xOffset: float = 0; | ||
yOffset: float = 0; | ||
} |
Oops, something went wrong.