| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "Resources.h" | 8 #include "Resources.h" |
| 9 #include "SkEndian.h" | 9 #include "SkEndian.h" |
| 10 #include "SkFontStream.h" | 10 #include "SkFontStream.h" |
| 11 #include "SkOSFile.h" | 11 #include "SkOSFile.h" |
| 12 #include "SkPaint.h" | 12 #include "SkPaint.h" |
| 13 #include "SkStream.h" | 13 #include "SkStream.h" |
| 14 #include "SkTypeface.h" | 14 #include "SkTypeface.h" |
| 15 #include "Test.h" | 15 #include "Test.h" |
| 16 | 16 |
| 17 //#define DUMP_TABLES | 17 //#define DUMP_TABLES |
| 18 //#define DUMP_TTC_TABLES | 18 //#define DUMP_TTC_TABLES |
| 19 | 19 |
| 20 #define kFontTableTag_head SkSetFourByteTag('h', 'e', 'a', 'd') | 20 #define kFontTableTag_head SkSetFourByteTag('h', 'e', 'a', 'd') |
| 21 #define kFontTableTag_hhea SkSetFourByteTag('h', 'h', 'e', 'a') | 21 #define kFontTableTag_hhea SkSetFourByteTag('h', 'h', 'e', 'a') |
| 22 #define kFontTableTag_maxp SkSetFourByteTag('m', 'a', 'x', 'p') | 22 #define kFontTableTag_maxp SkSetFourByteTag('m', 'a', 'x', 'p') |
| 23 | 23 |
| 24 static const struct TagSize { | 24 static const struct TagSize { |
| 25 SkFontTableTag fTag; | 25 SkFontTableTag fTag; |
| 26 size_t fSize; | 26 size_t fSize; |
| 27 } gKnownTableSizes[] = { | 27 } gKnownTableSizes[] = { |
| 28 { kFontTableTag_head, 54 }, | 28 { kFontTableTag_head, 54 }, |
| 29 { kFontTableTag_hhea, 36 }, | 29 { kFontTableTag_hhea, 36 }, |
| 30 { kFontTableTag_maxp, 32 }, | |
| 31 }; | 30 }; |
| 32 | 31 |
| 33 // Test that getUnitsPerEm() agrees with a direct lookup in the 'head' table | 32 // Test that getUnitsPerEm() agrees with a direct lookup in the 'head' table |
| 34 // (if that table is available). | 33 // (if that table is available). |
| 35 static void test_unitsPerEm(skiatest::Reporter* reporter, SkTypeface* face) { | 34 static void test_unitsPerEm(skiatest::Reporter* reporter, SkTypeface* face) { |
| 36 int nativeUPEM = face->getUnitsPerEm(); | 35 int nativeUPEM = face->getUnitsPerEm(); |
| 37 | 36 |
| 38 int tableUPEM = -1; | 37 int tableUPEM = -1; |
| 39 size_t size = face->getTableSize(kFontTableTag_head); | 38 size_t size = face->getTableSize(kFontTableTag_head); |
| 40 if (size) { | 39 if (size) { |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 } | 299 } |
| 301 } | 300 } |
| 302 | 301 |
| 303 DEF_TEST(FontHost, reporter) { | 302 DEF_TEST(FontHost, reporter) { |
| 304 test_tables(reporter); | 303 test_tables(reporter); |
| 305 test_fontstream(reporter); | 304 test_fontstream(reporter); |
| 306 test_advances(reporter); | 305 test_advances(reporter); |
| 307 } | 306 } |
| 308 | 307 |
| 309 // need tests for SkStrSearch | 308 // need tests for SkStrSearch |
| OLD | NEW |