Skip to content

Commit c993057

Browse files
authored
Merge pull request #118 from smasty/woff-flavors-support
Add support for more WOFF/WOFF2 flavors (Alternative to #117)
2 parents 0bd1ff8 + 0f76dc5 commit c993057

File tree

1 file changed

+24
-8
lines changed

1 file changed

+24
-8
lines changed

filetype/types/font.py

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,18 @@ def match(self, buf):
2424
buf[1] == 0x4F and
2525
buf[2] == 0x46 and
2626
buf[3] == 0x46 and
27-
buf[4] == 0x00 and
28-
buf[5] == 0x01 and
29-
buf[6] == 0x00 and
30-
buf[7] == 0x00)
27+
((buf[4] == 0x00 and
28+
buf[5] == 0x01 and
29+
buf[6] == 0x00 and
30+
buf[7] == 0x00) or
31+
(buf[4] == 0x4F and
32+
buf[5] == 0x54 and
33+
buf[6] == 0x54 and
34+
buf[7] == 0x4F) or
35+
(buf[4] == 0x74 and
36+
buf[5] == 0x72 and
37+
buf[6] == 0x75 and
38+
buf[7] == 0x65)))
3139

3240

3341
class Woff2(Type):
@@ -49,10 +57,18 @@ def match(self, buf):
4957
buf[1] == 0x4F and
5058
buf[2] == 0x46 and
5159
buf[3] == 0x32 and
52-
buf[4] == 0x00 and
53-
buf[5] == 0x01 and
54-
buf[6] == 0x00 and
55-
buf[7] == 0x00)
60+
((buf[4] == 0x00 and
61+
buf[5] == 0x01 and
62+
buf[6] == 0x00 and
63+
buf[7] == 0x00) or
64+
(buf[4] == 0x4F and
65+
buf[5] == 0x54 and
66+
buf[6] == 0x54 and
67+
buf[7] == 0x4F) or
68+
(buf[4] == 0x74 and
69+
buf[5] == 0x72 and
70+
buf[6] == 0x75 and
71+
buf[7] == 0x65)))
5672

5773

5874
class Ttf(Type):

0 commit comments

Comments
 (0)