Skip to content

Commit

Permalink
Add support for OpenType Font Collection (TTC) (#737)
Browse files Browse the repository at this point in the history
  • Loading branch information
SethWen authored Feb 26, 2025
1 parent 0743dd4 commit 3e576a6
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 0 deletions.
7 changes: 7 additions & 0 deletions core.js
Original file line number Diff line number Diff line change
Expand Up @@ -917,6 +917,13 @@ export class FileTypeParser {
};
}

if (this.checkString('ttcf')) {
return {
ext: 'ttc',
mime: 'font/collection',
};
}

if (this.check([0xCF, 0xFA, 0xED, 0xFE])) {
return {
ext: 'macho',
Expand Down
Binary file added fixture/fixture.ttc
Binary file not shown.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@
"eot",
"ttf",
"otf",
"ttc",
"ico",
"flv",
"ps",
Expand Down
1 change: 1 addition & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,7 @@ abortController.abort(); // Abort file-type reading from the Blob stream.
- [`swf`](https://en.wikipedia.org/wiki/SWF) - Adobe Flash Player file
- [`tar`](https://en.wikipedia.org/wiki/Tar_(computing)#File_format) - Tarball archive file
- [`tif`](https://en.wikipedia.org/wiki/Tagged_Image_File_Format) - Tagged Image file
- [`ttc`](https://en.wikipedia.org/wiki/TrueType#TrueType_Collection) - TrueType Collection font
- [`ttf`](https://en.wikipedia.org/wiki/TrueType) - TrueType font
- [`vcf`](https://en.wikipedia.org/wiki/VCard) - vCard
- [`voc`](https://wiki.multimedia.cx/index.php/Creative_Voice) - Creative Voice File
Expand Down
2 changes: 2 additions & 0 deletions supported.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export const extensions = [
'eot',
'ttf',
'otf',
'ttc',
'ico',
'flv',
'ps',
Expand Down Expand Up @@ -239,6 +240,7 @@ export const mimeTypes = [
'application/vnd.ms-fontobject',
'font/ttf',
'font/otf',
'font/collection',
'image/x-icon',
'video/x-flv',
'application/postscript',
Expand Down

0 comments on commit 3e576a6

Please sign in to comment.