Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public static function get_expected_font_mime_types_per_php_version( $php_versio
$php_7_ttf_mime_type = $php_version_id >= 70300 ? 'application/font-sfnt' : 'application/x-font-ttf';

return array(
'otf' => 'font/otf',
'otf' => 'application/vnd.ms-opentype',
'ttf' => $php_version_id >= 70400 ? 'font/sfnt' : $php_7_ttf_mime_type,
'woff' => $php_version_id >= 80100 ? 'font/woff' : 'application/font-woff',
'woff2' => $php_version_id >= 80100 ? 'font/woff2' : 'application/font-woff2',
Expand Down
Binary file added phpunit/tests/data/fonts/gilbert-color.otf
Binary file not shown.
28 changes: 28 additions & 0 deletions phpunit/tests/fonts/font-library/wpFontFamily/install.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@ public function test_should_move_local_fontfaces( $font_data, array $files_data,
copy( __DIR__ . '/../../../data/fonts/cooper-hewitt.woff', $file['tmp_name'] );
} elseif ( 'font/woff2' === $file['type'] ) {
copy( __DIR__ . '/../../../data/fonts/DMSans.woff2', $file['tmp_name'] );
} elseif ( 'application/vnd.ms-opentype' === $file['type'] ) {
copy( __DIR__ . '/../../../data/fonts/gilbert-color.otf', $file['tmp_name'] );
}
}

Expand Down Expand Up @@ -302,6 +304,32 @@ public function data_should_move_local_fontfaces() {
),
'expected' => array( 'dm-sans_regular_500.woff2' ),
),
// otf font type.
'otf local font' => array(
'font_data' => array(
'name' => 'Gilbert Color',
'slug' => 'gilbert-color',
'fontFamily' => 'Gilbert Color',
'fontFace' => array(
array(
'fontFamily' => 'Gilbert Color',
'fontStyle' => 'regular',
'fontWeight' => '500',
'uploadedFile' => 'files0',
),
),
),
'files_data' => array(
'files0' => array(
'name' => 'gilbert-color.otf',
'type' => 'application/vnd.ms-opentype',
'tmp_name' => wp_tempnam( 'Gilbert-' ),
'error' => 0,
'size' => 123,
),
),
'expected' => array( 'gilbert-color_regular_500.otf' ),
),
);
}

Expand Down
12 changes: 6 additions & 6 deletions phpunit/tests/fonts/font-library/wpFontLibrary/getMimeTypes.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function data_should_supply_correct_mime_type_for_php_version() {
'version 7.2' => array(
'php_version_id' => 70200,
'expected' => array(
'otf' => 'font/otf',
'otf' => 'application/vnd.ms-opentype',
'ttf' => 'application/x-font-ttf',
'woff' => 'application/font-woff',
'woff2' => 'application/font-woff2',
Expand All @@ -43,7 +43,7 @@ public function data_should_supply_correct_mime_type_for_php_version() {
'version 7.3' => array(
'php_version_id' => 70300,
'expected' => array(
'otf' => 'font/otf',
'otf' => 'application/vnd.ms-opentype',
'ttf' => 'application/font-sfnt',
'woff' => 'application/font-woff',
'woff2' => 'application/font-woff2',
Expand All @@ -52,7 +52,7 @@ public function data_should_supply_correct_mime_type_for_php_version() {
'version 7.4' => array(
'php_version_id' => 70400,
'expected' => array(
'otf' => 'font/otf',
'otf' => 'application/vnd.ms-opentype',
'ttf' => 'font/sfnt',
'woff' => 'application/font-woff',
'woff2' => 'application/font-woff2',
Expand All @@ -61,7 +61,7 @@ public function data_should_supply_correct_mime_type_for_php_version() {
'version 8.0' => array(
'php_version_id' => 80000,
'expected' => array(
'otf' => 'font/otf',
'otf' => 'application/vnd.ms-opentype',
'ttf' => 'font/sfnt',
'woff' => 'application/font-woff',
'woff2' => 'application/font-woff2',
Expand All @@ -70,7 +70,7 @@ public function data_should_supply_correct_mime_type_for_php_version() {
'version 8.1' => array(
'php_version_id' => 80100,
'expected' => array(
'otf' => 'font/otf',
'otf' => 'application/vnd.ms-opentype',
'ttf' => 'font/sfnt',
'woff' => 'font/woff',
'woff2' => 'font/woff2',
Expand All @@ -79,7 +79,7 @@ public function data_should_supply_correct_mime_type_for_php_version() {
'version 8.2' => array(
'php_version_id' => 80200,
'expected' => array(
'otf' => 'font/otf',
'otf' => 'application/vnd.ms-opentype',
'ttf' => 'font/sfnt',
'woff' => 'font/woff',
'woff2' => 'font/woff2',
Expand Down