| Index: src/core/SkAdvancedTypefaceMetrics.cpp
|
| diff --git a/src/core/SkAdvancedTypefaceMetrics.cpp b/src/core/SkAdvancedTypefaceMetrics.cpp
|
| index 318f4a06bc23cbbb4801a76ea55b7f156360db75..559259e60e37313b3d613cd658308bdee629ba3c 100644
|
| --- a/src/core/SkAdvancedTypefaceMetrics.cpp
|
| +++ b/src/core/SkAdvancedTypefaceMetrics.cpp
|
| @@ -9,24 +9,6 @@
|
| #include "SkAdvancedTypefaceMetrics.h"
|
| #include "SkTypes.h"
|
|
|
| -#if defined(SK_BUILD_FOR_WIN)
|
| -#include <dwrite.h>
|
| -#endif
|
| -
|
| -// forward declare structs needed for getAdvanceData() template for freetype
|
| -struct FT_FaceRec_;
|
| -typedef struct FT_FaceRec_* FT_Face;
|
| -
|
| -#ifdef SK_BUILD_FOR_MAC
|
| -#import <ApplicationServices/ApplicationServices.h>
|
| -#endif
|
| -
|
| -#ifdef SK_BUILD_FOR_IOS
|
| -#include <CoreText/CoreText.h>
|
| -#include <CoreGraphics/CoreGraphics.h>
|
| -#include <CoreFoundation/CoreFoundation.h>
|
| -#endif
|
| -
|
| template <typename Data>
|
| static void unwind(SkAdvancedTypefaceMetrics::AdvanceMetric<Data>* ptr) {
|
| while (ptr) {
|
| @@ -137,13 +119,12 @@ void finishRange(
|
| zeroWildcardsInRange(range);
|
| }
|
|
|
| -template <typename Data, typename FontHandle>
|
| +template <typename Data>
|
| SkAdvancedTypefaceMetrics::AdvanceMetric<Data>* getAdvanceData(
|
| - FontHandle fontHandle,
|
| int num_glyphs,
|
| const uint32_t* subsetGlyphIDs,
|
| uint32_t subsetGlyphIDsLength,
|
| - bool (*getAdvance)(FontHandle fontHandle, int gId, Data* data)) {
|
| + std::function<bool(int gId, Data* data)> getAdvance) {
|
| // Assuming that on average, the ASCII representation of an advance plus
|
| // a space is 8 characters and the ASCII representation of a glyph id is 3
|
| // characters, then the following cut offs for using different range types
|
| @@ -187,7 +168,7 @@ SkAdvancedTypefaceMetrics::AdvanceMetric<Data>* getAdvanceData(
|
| if (!subsetGlyphIDs ||
|
| (subsetIndex < subsetGlyphIDsLength &&
|
| static_cast<uint32_t>(gId) == subsetGlyphIDs[subsetIndex])) {
|
| - SkAssertResult(getAdvance(fontHandle, gId, &advance));
|
| + SkAssertResult(getAdvance(gId, &advance));
|
| ++subsetIndex;
|
| } else {
|
| advance = kDontCareAdvance;
|
| @@ -269,33 +250,11 @@ SkAdvancedTypefaceMetrics::AdvanceMetric<Data>* getAdvanceData(
|
| // Make AdvanceMetric template functions available for linking with typename
|
| // WidthRange and VerticalAdvanceRange.
|
| template SkAdvancedTypefaceMetrics::WidthRange* getAdvanceData(
|
| - FT_Face face,
|
| int num_glyphs,
|
| - const uint32_t* subsetGlyphIDs,
|
| - uint32_t subsetGlyphIDsLength,
|
| - bool (*getAdvance)(FT_Face face, int gId, int16_t* data));
|
| + const uint32_t* glyphIDs,
|
| + uint32_t glyphIDsCount,
|
| + std::function<bool(int, int16_t*)> getAdvance);
|
|
|
| -#if defined(SK_BUILD_FOR_WIN)
|
| -template SkAdvancedTypefaceMetrics::WidthRange* getAdvanceData(
|
| - HDC hdc,
|
| - int num_glyphs,
|
| - const uint32_t* subsetGlyphIDs,
|
| - uint32_t subsetGlyphIDsLength,
|
| - bool (*getAdvance)(HDC hdc, int gId, int16_t* data));
|
| -template SkAdvancedTypefaceMetrics::WidthRange* getAdvanceData(
|
| - IDWriteFontFace* fontFace,
|
| - int num_glyphs,
|
| - const uint32_t* subsetGlyphIDs,
|
| - uint32_t subsetGlyphIDsLength,
|
| - bool (*getAdvance)(IDWriteFontFace* fontFace, int gId, int16_t* data));
|
| -#elif defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS)
|
| -template SkAdvancedTypefaceMetrics::WidthRange* getAdvanceData(
|
| - CTFontRef ctFont,
|
| - int num_glyphs,
|
| - const uint32_t* subsetGlyphIDs,
|
| - uint32_t subsetGlyphIDsLength,
|
| - bool (*getAdvance)(CTFontRef ctFont, int gId, int16_t* data));
|
| -#endif
|
| template void resetRange(
|
| SkAdvancedTypefaceMetrics::WidthRange* range,
|
| int startId);
|
| @@ -319,12 +278,4 @@ template void finishRange<SkAdvancedTypefaceMetrics::VerticalMetric>(
|
| int endId,
|
| SkAdvancedTypefaceMetrics::VerticalAdvanceRange::MetricType type);
|
|
|
| -// additional declaration needed for testing with a face of an unknown type
|
| -template SkAdvancedTypefaceMetrics::WidthRange* getAdvanceData(
|
| - void* fontData,
|
| - int num_glyphs,
|
| - const uint32_t* subsetGlyphIDs,
|
| - uint32_t subsetGlyphIDsLength,
|
| - bool (*getAdvance)(void* fontData, int gId, int16_t* data));
|
| -
|
| } // namespace skia_advanced_typeface_metrics_utils
|
|
|