Skip to content

Instantly share code, notes, and snippets.

@madig
Last active November 6, 2019 23:41
Show Gist options
  • Save madig/434f771d5d847f5e072f2be4e167cfc4 to your computer and use it in GitHub Desktop.
Save madig/434f771d5d847f5e072f2be4e167cfc4 to your computer and use it in GitHub Desktop.
ascender: Option<f64>,
cap_height: Option<f64>,
copyright: Option<String>,
descender: Option<f64>,
family_name: Option<String>,
guidelines: Option<Vec<Guideline>,
italic_angle: Option<f64>,
macintosh_fond_family_id: Option<u32>,
macintosh_fond_name: Option<String>,
note: Option<String>,
open_type_gasp_range_records: Option<Vec<GaspRangeRecord>>,
open_type_head_created: Option<String>, // TODO: Validate string
open_type_head_flags: Option<Vec<u32>>,
open_type_head_lowest_rec_ppem: Option<u32>,
open_type_hhea_ascender: Option<i32>,
open_type_hhea_caret_offset: Option<i32>,
open_type_hhea_caret_slope_rise: Option<i32>,
open_type_hhea_caret_slope_run: Option<i32>,
open_type_hhea_descender: Option<i32>,
open_type_hhea_line_gap: Option<i32>,
open_type_name_compatible_full_name: Option<String>,
open_type_name_description: Option<String>,
open_type_name_designer_url: Option<String>,
open_type_name_designer: Option<String>,
open_type_name_license_url: Option<String>,
open_type_name_license: Option<String>,
open_type_name_manufacturer_url: Option<String>,
open_type_name_manufacturer: Option<String>,
open_type_name_preferred_family_name: Option<String>,
open_type_name_preferred_subfamily_name: Option<String>,
open_type_name_records: Option<Vec<NameRecord>>,
open_type_name_sample_text: Option<String>,
open_type_name_unique_id: Option<String>,
open_type_name_version: Option<String>,
open_type_name_wws_family_name: Option<String>,
open_type_name_wws_subfamily_name: Option<String>,
open_type_os2_code_page_ranges: Option<Vec<u8>>,
open_type_os2_family_class: Option<OS2FamilyClass>, // TODO: validate, de/serialize from list
open_type_os2_panose: Option<OS2Panose>, // TODO: validate, de/serialize from list
open_type_os2_selection: Option<Vec<u8>>, // TODO: validate
open_type_os2_strikeout_position: Option<i32>,
open_type_os2_strikeout_size: Option<i32>,
open_type_os2_subscript_x_offset: Option<i32>,
open_type_os2_subscript_x_size: Option<i32>,
open_type_os2_subscript_y_offset: Option<i32>,
open_type_os2_subscript_y_size: Option<i32>,
open_type_os2_superscript_x_offset: Option<i32>,
open_type_os2_superscript_x_size: Option<i32>,
open_type_os2_superscript_y_offset: Option<i32>,
open_type_os2_superscript_y_size: Option<i32>,
open_type_os2_type: Option<Vec<u8>>,
open_type_os2_typo_ascender: Option<i32>,
open_type_os2_typo_descender: Option<i32>,
open_type_os2_typo_line_gap: Option<i32>,
open_type_os2_unicode_ranges: Option<Vec<u8>>,
open_type_os2_vendor_id: Option<String>,
open_type_os2_weight_class: Option<u32>, // TODO: validate
open_type_os2_width_class: Option<u32>, // TODO: validate
open_type_os2_win_ascent: Option<u32>,
open_type_os2_win_descent: Option<u32>,
open_type_vhea_caret_offset: Option<i32>,
open_type_vhea_caret_slope_rise: Option<i32>,
open_type_vhea_caret_slope_run: Option<i32>,
open_type_vhea_vert_typo_ascender: Option<i32>,
open_type_vhea_vert_typo_descender: Option<i32>,
open_type_vhea_vert_typo_line_gap: Option<i32>,
postscript_blue_fuzz: Option<f64>,
postscript_blue_scale: Option<f64>,
postscript_blue_shift: Option<f64>,
postscript_blue_values: Option<Vec<f64>>,
postscript_default_character: Option<String>,
postscript_default_width_x: Option<f64>,
postscript_family_blues: Option<Vec<f64>>,
postscript_family_other_blues: Option<Vec<f64>>,
postscript_font_name: Option<String>,
postscript_force_bold: Option<bool>,
postscript_full_name: Option<String>,
postscript_is_fixed_pitch: Option<bool>,
postscript_nominal_width_x: Option<f64>,
postscript_other_blues: Option<Vec<f64>>,
postscript_slant_angle: Option<f64>,
postscript_stem_snap_h: Option<Vec<f64>>, // TODO: validate. (i32|f64)?
postscript_stem_snap_v: Option<Vec<f64>>, // TODO: validate. (i32|f64)?
postscript_underline_position: Option<f64>,
postscript_underline_thickness: Option<f64>,
postscript_unique_id: Option<i32>,
postscript_weight_name: Option<String>,
postscript_windows_character_set: Option<PostscriptWindowsCharacterSet>,
style_map_family_name: Option<String>,
style_map_style_name: Option<StyleMapStyle>,
style_name: Option<String>,
trademark: Option<String>,
units_per_em: Option<f64>,
version_major: Option<u32>,
version_minor: Option<u32>,
woff_major_version: Option<i32>,
woff_metadata_copyright: Option<WoffMetadataCopyright>,
woff_metadata_credits: Option<WoffMetadataCredits>,
woff_metadata_description: Option<WoffMetadataDescription>,
woff_metadata_extensions: Option<Vec<WoffMetadataExtensionRecord>>,
woff_metadata_license: Option<WoffMetadataLicense>,
woff_metadata_licensee: Option<WoffMetadataLicensee>,
woff_metadata_trademark: Option<WoffMetadataTrademark>,
woff_metadata_unique_id: Option<WoffMetadataUniqueID>,
woff_metadata_vendor: Option<WoffMetadataVendor>,
woff_minor_version: Option<i32>,
x_height: Option<f64>,
year: Option<u32>,
// TODO: validate!
// http://unifiedfontobject.org/versions/ufo3/fontinfo.plist/#guidelines
struct Guideline {
x: Option<f64>,
y: Option<f64>,
angle: Option<f64>,
name: String,
color: String,
identifier: String
}
// TODO: validate!
// http://unifiedfontobject.org/versions/ufo3/fontinfo.plist/#opentype-gasp-table-fields
struct GaspRangeRecord {
range_max_ppem: u16,
range_gasp_behavior: Vec<u8>,
}
struct NameRecord {
name_id: u16,
paltform_id: u16,
encoding_id: u16,
language_id: u16,
string: String,
}
struct OS2FamilyClass {
class_id: u8,
subclass_id: u8,
}
struct OS2Panose {
family_type: u8,
serif_style: u8,
weight: u8,
proportion: u8,
contrast: u8,
stroke_variation: u8,
arm_style: u8,
letterform: u8,
midline: u8,
x_height: u8,
}
enum PostscriptWindowsCharacterSet {
ANSI = 1,
Default = 2,
Symbol = 3,
Macintosh = 4,
Shift JIS = 5,
Hangul = 6,
HangulJohab = 7,
GB2312 = 8,
ChineseBIG5 = 9,
Greek = 10,
Turkish = 11,
Vietnamese = 12,
Hebrew = 13,
Arabic = 14,
Baltic = 15,
Bitstream = 16,
Cyrillic = 17,
Thai = 18,
EasternEuropean = 19,
OEM = 20,
}
struct WoffMetadataCopyright {
text: Vec<WoffMetadataTextRecord>,
}
struct WoffMetadataCredits {
credits: Vec<WoffMetadataCredit>
}
struct WoffMetadataCredit {
name: String,
url: Option<String>,
role: Option<String>,
dir: Option<String>,
class: Option<String>,
}
struct WoffMetadataDescription {
url: Option<String>,
text: Vec<WoffMetadataTextRecord>,
}
struct WoffMetadataTextRecord {
text: String,
language: Option<String>,
dir: Option<String>,
class: Option<String>,
}
struct WoffMetadataExtensionRecord {
id: Option<String>,
names: Vec<WoffMetadataExtensionNameRecord>,
items: Vec<WoffMetadataExtensionItemRecord>,
}
struct WoffMetadataExtensionNameRecord {
text: String,
language: Option<String>,
dir: Option<String>,
class: Option<String>,
}
struct WoffMetadataExtensionItemRecord {
id: Option<String>,
names: Vec<WoffMetadataExtensionNameRecord>,
values: Vec<WoffMetadataExtensionValueRecord>,
}
struct WoffMetadataExtensionValueRecord {
text: String,
language: Option<String>,
dir: Option<String>,
class: Option<String>,
}
struct WoffMetadataLicense {
url: Option<String>,
id: Option<String>,
text: Vec<WoffMetadataTextRecord>,
}
struct WoffMetadataLicensee {
name: String,
dir: Option<String>,
class: Option<String>,
}
struct WoffMetadataTrademark {
text: Vec<WoffMetadataTextRecord>,
}
struct WoffMetadataUniqueID {
id: String,
}
struct WoffMetadataVendor {
name: String,
url: String,
dir: Option<String>,
class: Option<String>,
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment