Skip to content

Commit

Permalink
Add Glyphs format support
Browse files Browse the repository at this point in the history
  • Loading branch information
mmalecot committed May 8, 2024
1 parent 2657994 commit 265f0bb
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

## New formats support

- Glyphs
- Sketch
- Sketch 43
- age encryption
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ identification.
- BMFont ASCII (FNT)
- BMFont Binary (FNT)
- Embedded OpenType (EOT)
- Glyphs
- OpenType (OTF)
- TrueType (TTF)
- Web Open Font Format (WOFF)
Expand Down
11 changes: 11 additions & 0 deletions fixtures/font/sample.glyphs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
.appVersion = "3179";
.formatVersion = 3;
axes = (
{
hidden = 1;
name = Weight;
tag = wght;
}
);

6 changes: 6 additions & 0 deletions src/formats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -915,6 +915,12 @@ formats! {
extension = "glb"
kind = Model

format = Glyphs
name = "Glyphs"
media_type = "font/x-glyphs"
extension = "glyphs"
kind = Font

format = GoogleChromeExtension
name = "Google Chrome Extension"
short_name = "CRX"
Expand Down
3 changes: 3 additions & 0 deletions src/signatures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,9 @@ signatures! {
value = b"%!PS-Adobe-", b" EPSF-" offset = 14
value = b"\xC5\xD0\xD3\xC6"

format = Glyphs
value = b"{\n.appVersion = \""

format = HypertextMarkupLanguage
value = b"\xEF\xBB\xBF<!DOCTYPE HTML"
value = b"\xEF\xBB\xBF<!DOCTYPE html"
Expand Down
6 changes: 6 additions & 0 deletions tests/font.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ fn test_embedded_opentype() {
assert_eq!(fmt, FileFormat::EmbeddedOpentype);
}

#[test]
fn test_glyphs() {
let fmt = FileFormat::from_file("fixtures/font/sample.glyphs").unwrap();
assert_eq!(fmt, FileFormat::Glyphs);
}

#[test]
fn test_opentype() {
let fmt = FileFormat::from_file("fixtures/font/sample.otf").unwrap();
Expand Down

0 comments on commit 265f0bb

Please sign in to comment.