Skip to content

Commit b308df4

Browse files
authored
Add font/{otf,woff,woff2}
1 parent 27fac74 commit b308df4

File tree

9 files changed

+30
-1
lines changed

9 files changed

+30
-1
lines changed

data/custom.xml

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
</mime-type>
6868

6969
<mime-type type="video/webm">
70-
<sub-class-of="application/x-matroska" />
70+
<sub-class-of type="application/x-matroska" />
7171

7272
<magic priority="50">
7373
<match value="0x1a45dfa3" type="string" offset="0">
@@ -77,4 +77,26 @@
7777
</match>
7878
</magic>
7979
</mime-type>
80+
81+
<mime-type type="font/woff">
82+
<alias type="application/font-woff"/>
83+
84+
<magic priority="50">
85+
<!-- Source: https://www.w3.org/TR/WOFF/#WOFFHeader -->
86+
<match value="0x774F4646" type="string" offset="0" />
87+
</magic>
88+
89+
<glob pattern="*.woff" />
90+
</mime-type>
91+
92+
<mime-type type="font/woff2">
93+
<alias type="application/font-woff2" />
94+
95+
<magic priority="50">
96+
<!-- Source https://www.w3.org/TR/WOFF2/#woff20Header -->
97+
<match value="0x774F4632" type="string" offset="0" />
98+
</magic>
99+
100+
<glob pattern="*.woff2" />
101+
</mime-type>
80102
</mime-info>

lib/marcel/mime_type/definitions.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
Marcel::MimeType.extend "video/mp4", magic: [[4, "ftypisom"], [4, "ftypM4V "]], extensions: %w( mp4 m4v )
3939

4040
Marcel::MimeType.extend "font/ttf", magic: [[0, "\x00\x01\x00\x00"]], extensions: %w( ttf ttc )
41+
Marcel::MimeType.extend "font/otf", magic: [[0, "OTTO"]], extensions: %w( otf ), parents: "font/ttf"
4142
Marcel::MimeType.extend "application/vnd.adobe.flash.movie", magic: [[0, "FWS"], [0, "CWS"]], extensions: %w( swf )
4243
Marcel::MimeType.extend "application/sql", extensions: %w( sql )
4344
Marcel::MimeType.extend "text/vcard", magic: [[0, "BEGIN:VCARD"]], extensions: %w( vcf ), parents: "text/plain"

lib/marcel/tables.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1139,6 +1139,8 @@ module Marcel
11391139
'wmv' => 'video/x-ms-wmv',
11401140
'wmx' => 'video/x-ms-wmx',
11411141
'wmz' => 'application/x-ms-wmz',
1142+
'woff' => 'font/woff',
1143+
'woff2' => 'font/woff2',
11421144
'wp' => 'application/vnd.wordperfect',
11431145
'wp5' => 'application/vnd.wordperfect',
11441146
'wp6' => 'application/vnd.wordperfect',
@@ -1908,6 +1910,8 @@ module Marcel
19081910
'chemical/x-csml' => [%w(csml), %w(), nil],
19091911
'chemical/x-pdb' => [%w(pdb), %w(), 'Brookhaven Protein Databank File'],
19101912
'chemical/x-xyz' => [%w(xyz), %w(), nil],
1913+
'font/woff' => [%w(woff), %w(), nil],
1914+
'font/woff2' => [%w(woff2), %w(), nil],
19111915
'image/aces' => [%w(exr), %w(), 'ACES Image Container File'],
19121916
'image/avif' => [%w(avif), %w(), 'AV1 Image File'],
19131917
'image/bmp' => [%w(bmp dib), %w(), 'Windows bitmap'],
@@ -2399,6 +2403,8 @@ module Marcel
23992403
['audio/x-ms-wma', [[0..8192, 'Windows Media Audio']]],
24002404
['audio/x-pn-realaudio', [[0, ".ra\375"]]],
24012405
['chemical/x-cdx', [[0, 'VjCD0100']]],
2406+
['font/woff', [[0, 'wOFF']]],
2407+
['font/woff2', [[0, 'wOF2']]],
24022408
['image/aces', [[0, "v/1\001\002\000\000\000"], [0, "v/1\001\002\004\000\000"]]],
24032409
['image/cgm', [[0, 'BEGMF']]],
24042410
['image/emf', [[0, "\001\000\000\000", [[40, ' EMF']]]]],

test/fixtures/magic/font/otf.otf

1.13 KB
Binary file not shown.

test/fixtures/magic/font/woff.woff

928 Bytes
Binary file not shown.
472 Bytes
Binary file not shown.

test/fixtures/name/font/otf.otf

1.13 KB
Binary file not shown.

test/fixtures/name/font/woff.woff

928 Bytes
Binary file not shown.
472 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)