| Index: src/ports/SkFontConfigInterface_android.cpp
|
| diff --git a/src/ports/SkFontConfigInterface_android.cpp b/src/ports/SkFontConfigInterface_android.cpp
|
| index 94662f5d5949844ec9a77fee69dcfd924c73f1ff..3f169e137a136733215f29ac82b4d52cd14cb71c 100644
|
| --- a/src/ports/SkFontConfigInterface_android.cpp
|
| +++ b/src/ports/SkFontConfigInterface_android.cpp
|
| @@ -774,136 +774,3 @@ SkTypeface* SkGetTypefaceForGlyphID(uint16_t glyphID, const SkTypeface* origType
|
| return fontConfig->getTypefaceForGlyphID(glyphID, origTypeface, options,
|
| lowerBounds, upperBounds);
|
| }
|
| -
|
| -///////////////////////////////////////////////////////////////////////////////
|
| -
|
| -#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
|
| -
|
| -struct HB_UnicodeMapping {
|
| - hb_script_t script;
|
| - const SkUnichar unicode;
|
| -};
|
| -
|
| -/*
|
| - * The following scripts are not complex fonts and we do not expect them to be parsed by this table
|
| - * HB_SCRIPT_COMMON,
|
| - * HB_SCRIPT_GREEK,
|
| - * HB_SCRIPT_CYRILLIC,
|
| - * HB_SCRIPT_HANGUL
|
| - * HB_SCRIPT_INHERITED
|
| - */
|
| -
|
| -/* Harfbuzz (old) is missing a number of scripts in its table. For these,
|
| - * we include a value which can never happen. We won't get complex script
|
| - * shaping in these cases, but the library wouldn't know how to shape
|
| - * them anyway. */
|
| -#define HB_Script_Unknown HB_ScriptCount
|
| -
|
| -static HB_UnicodeMapping HB_UnicodeMappingArray[] = {
|
| - {HB_SCRIPT_ARMENIAN, 0x0531},
|
| - {HB_SCRIPT_HEBREW, 0x0591},
|
| - {HB_SCRIPT_ARABIC, 0x0600},
|
| - {HB_SCRIPT_SYRIAC, 0x0710},
|
| - {HB_SCRIPT_THAANA, 0x0780},
|
| - {HB_SCRIPT_NKO, 0x07C0},
|
| - {HB_SCRIPT_DEVANAGARI, 0x0901},
|
| - {HB_SCRIPT_BENGALI, 0x0981},
|
| - {HB_SCRIPT_GURMUKHI, 0x0A10},
|
| - {HB_SCRIPT_GUJARATI, 0x0A90},
|
| - {HB_SCRIPT_ORIYA, 0x0B10},
|
| - {HB_SCRIPT_TAMIL, 0x0B82},
|
| - {HB_SCRIPT_TELUGU, 0x0C10},
|
| - {HB_SCRIPT_KANNADA, 0x0C90},
|
| - {HB_SCRIPT_MALAYALAM, 0x0D10},
|
| - {HB_SCRIPT_SINHALA, 0x0D90},
|
| - {HB_SCRIPT_THAI, 0x0E01},
|
| - {HB_SCRIPT_LAO, 0x0E81},
|
| - {HB_SCRIPT_TIBETAN, 0x0F00},
|
| - {HB_SCRIPT_MYANMAR, 0x1000},
|
| - {HB_SCRIPT_GEORGIAN, 0x10A0},
|
| - {HB_SCRIPT_ETHIOPIC, 0x1200},
|
| - {HB_SCRIPT_CHEROKEE, 0x13A0},
|
| - {HB_SCRIPT_OGHAM, 0x1680},
|
| - {HB_SCRIPT_RUNIC, 0x16A0},
|
| - {HB_SCRIPT_KHMER, 0x1780},
|
| - {HB_SCRIPT_TAI_LE, 0x1950},
|
| - {HB_SCRIPT_NEW_TAI_LUE, 0x1980},
|
| - {HB_SCRIPT_TAI_THAM, 0x1A20},
|
| - {HB_SCRIPT_CHAM, 0xAA00},
|
| -};
|
| -
|
| -// returns 0 for "Not Found"
|
| -static SkUnichar getUnicodeFromHBScript(hb_script_t script) {
|
| - SkUnichar unichar = 0;
|
| - int numSupportedFonts = sizeof(HB_UnicodeMappingArray) / sizeof(HB_UnicodeMapping);
|
| - for (int i = 0; i < numSupportedFonts; i++) {
|
| - if (script == HB_UnicodeMappingArray[i].script) {
|
| - unichar = HB_UnicodeMappingArray[i].unicode;
|
| - break;
|
| - }
|
| - }
|
| - return unichar;
|
| -}
|
| -
|
| -struct TypefaceLookupStruct {
|
| - hb_script_t script;
|
| - SkTypeface::Style style;
|
| - SkPaintOptionsAndroid::FontVariant fontVariant;
|
| - SkTypeface* typeface;
|
| -};
|
| -
|
| -SK_DECLARE_STATIC_MUTEX(gTypefaceTableMutex); // This is the mutex for gTypefaceTable
|
| -static SkTDArray<TypefaceLookupStruct> gTypefaceTable; // This is protected by gTypefaceTableMutex
|
| -
|
| -static int typefaceLookupCompare(const TypefaceLookupStruct& first,
|
| - const TypefaceLookupStruct& second) {
|
| - if (first.script != second.script) {
|
| - return (first.script > second.script) ? 1 : -1;
|
| - }
|
| - if (first.style != second.style) {
|
| - return (first.style > second.style) ? 1 : -1;
|
| - }
|
| - if (first.fontVariant != second.fontVariant) {
|
| - return (first.fontVariant > second.fontVariant) ? 1 : -1;
|
| - }
|
| - return 0;
|
| -}
|
| -
|
| -SkTypeface* SkCreateTypefaceForScript(hb_script_t script, SkTypeface::Style style,
|
| - SkPaintOptionsAndroid::FontVariant fontVariant) {
|
| - SkAutoMutexAcquire ac(gTypefaceTableMutex);
|
| -
|
| - TypefaceLookupStruct key;
|
| - key.script = script;
|
| - key.style = style;
|
| - key.fontVariant = fontVariant;
|
| -
|
| - int index = SkTSearch<TypefaceLookupStruct>(
|
| - (const TypefaceLookupStruct*) gTypefaceTable.begin(),
|
| - gTypefaceTable.count(), key, sizeof(TypefaceLookupStruct),
|
| - typefaceLookupCompare);
|
| -
|
| - SkTypeface* retTypeface = NULL;
|
| - if (index >= 0) {
|
| - retTypeface = gTypefaceTable[index].typeface;
|
| - }
|
| - else {
|
| - SkUnichar unichar = getUnicodeFromHBScript(script);
|
| - if (!unichar) {
|
| - return NULL;
|
| - }
|
| -
|
| - SkFontConfigInterfaceAndroid* fontConfig = getSingletonInterface();
|
| - retTypeface = fontConfig->getTypefaceForChar(unichar, style, fontVariant);
|
| -
|
| - // add to the lookup table
|
| - key.typeface = retTypeface;
|
| - *gTypefaceTable.insert(~index) = key;
|
| - }
|
| -
|
| - // we ref(), the caller is expected to unref when they are done
|
| - return SkSafeRef(retTypeface);
|
| -}
|
| -
|
| -#endif
|
| -
|
|
|