| Index: src/ports/SkFontHost_FreeType.cpp
|
| diff --git a/src/ports/SkFontHost_FreeType.cpp b/src/ports/SkFontHost_FreeType.cpp
|
| index e02e338cfc4578c6c7a2504a6c96868f947d80df..5c53b9d9136320973c3c63b81f8a822a048d1b84 100644
|
| --- a/src/ports/SkFontHost_FreeType.cpp
|
| +++ b/src/ports/SkFontHost_FreeType.cpp
|
| @@ -11,7 +11,6 @@
|
| #include "SkColorPriv.h"
|
| #include "SkDescriptor.h"
|
| #include "SkFDot6.h"
|
| -#include "SkFontDescriptor.h"
|
| #include "SkFontHost_FreeType_common.h"
|
| #include "SkGlyph.h"
|
| #include "SkMask.h"
|
| @@ -34,17 +33,12 @@
|
| #include FT_FREETYPE_H
|
| #include FT_LCD_FILTER_H
|
| #include FT_MODULE_H
|
| -#include FT_MULTIPLE_MASTERS_H
|
| #include FT_OUTLINE_H
|
| #include FT_SIZES_H
|
| #include FT_SYSTEM_H
|
| #include FT_TRUETYPE_TABLES_H
|
| #include FT_TYPE1_TABLES_H
|
| #include FT_XFREE86_H
|
| -
|
| -#if !defined(SK_BUILD_FOR_ANDROID) || defined(SK_ANDROID_FREETYPE_HAS_MM)
|
| -# define SK_FREETYPE_HAS_MM 1
|
| -#endif
|
|
|
| // FT_LOAD_COLOR and the corresponding FT_Pixel_Mode::FT_PIXEL_MODE_BGRA
|
| // were introduced in FreeType 2.5.0.
|
| @@ -279,39 +273,6 @@
|
| fFTStream.close = sk_ft_stream_close;
|
| }
|
|
|
| -#if SK_FREETYPE_HAS_MM
|
| -static void ft_face_setup_axes(FT_Face face, const SkFontData& data) {
|
| - if (!(face->face_flags & FT_FACE_FLAG_MULTIPLE_MASTERS)) {
|
| - return;
|
| - }
|
| -
|
| - SkDEBUGCODE(
|
| - FT_MM_Var* variations = NULL;
|
| - if (FT_Get_MM_Var(face, &variations)) {
|
| - SkDEBUGF(("INFO: font %s claims variations, but none found.\n", face->family_name));
|
| - return;
|
| - }
|
| - SkAutoFree autoFreeVariations(variations);
|
| -
|
| - if (static_cast<FT_UInt>(data.getAxisCount()) != variations->num_axis) {
|
| - SkDEBUGF(("INFO: font %s has %d variations, but %d were specified.\n",
|
| - face->family_name, variations->num_axis, data.getAxisCount()));
|
| - return;
|
| - }
|
| - )
|
| -
|
| - SkAutoSTMalloc<4, FT_Fixed> coords(data.getAxisCount());
|
| - for (int i = 0; i < data.getAxisCount(); ++i) {
|
| - coords[i] = data.getAxis()[i];
|
| - }
|
| - if (FT_Set_Var_Design_Coordinates(face, data.getAxisCount(), coords.get())) {
|
| - SkDEBUGF(("INFO: font %s has variations, but specified variations could not be set.\n",
|
| - face->family_name));
|
| - return;
|
| - }
|
| -}
|
| -#endif
|
| -
|
| // Will return 0 on failure
|
| // Caller must lock gFTMutex before calling this function.
|
| static SkFaceRec* ref_ft_face(const SkTypeface* typeface) {
|
| @@ -328,38 +289,34 @@
|
| rec = rec->fNext;
|
| }
|
|
|
| - SkAutoTDelete<SkFontData> data(typeface->createFontData());
|
| - if (NULL == data || !data->hasStream()) {
|
| + int face_index;
|
| + SkStreamAsset* stream = typeface->openStream(&face_index);
|
| + if (NULL == stream) {
|
| return NULL;
|
| }
|
|
|
| // this passes ownership of stream to the rec
|
| - rec = SkNEW_ARGS(SkFaceRec, (data->detachStream(), fontID));
|
| + rec = SkNEW_ARGS(SkFaceRec, (stream, fontID));
|
|
|
| FT_Open_Args args;
|
| memset(&args, 0, sizeof(args));
|
| - const void* memoryBase = rec->fSkStream->getMemoryBase();
|
| + const void* memoryBase = stream->getMemoryBase();
|
| if (memoryBase) {
|
| args.flags = FT_OPEN_MEMORY;
|
| args.memory_base = (const FT_Byte*)memoryBase;
|
| - args.memory_size = rec->fSkStream->getLength();
|
| + args.memory_size = stream->getLength();
|
| } else {
|
| args.flags = FT_OPEN_STREAM;
|
| args.stream = &rec->fFTStream;
|
| }
|
|
|
| - FT_Error err = FT_Open_Face(gFTLibrary->library(), &args, data->getIndex(), &rec->fFace);
|
| - if (err) {
|
| + FT_Error err = FT_Open_Face(gFTLibrary->library(), &args, face_index, &rec->fFace);
|
| + if (err) { // bad filename, try the default font
|
| SkDEBUGF(("ERROR: unable to open font '%x'\n", fontID));
|
| SkDELETE(rec);
|
| return NULL;
|
| }
|
| SkASSERT(rec->fFace);
|
| -
|
| -#if SK_FREETYPE_HAS_MM
|
| - ft_face_setup_axes(rec->fFace, *data);
|
| -#endif
|
| -
|
| rec->fNext = gFaceRecHead;
|
| gFaceRecHead = rec;
|
| return rec;
|
| @@ -1692,8 +1649,7 @@
|
|
|
| #include "SkTSearch.h"
|
| bool SkTypeface_FreeType::Scanner::scanFont(
|
| - SkStream* stream, int ttcIndex,
|
| - SkString* name, SkFontStyle* style, bool* isFixedPitch, AxisDefinitions* axes) const
|
| + SkStream* stream, int ttcIndex, SkString* name, SkFontStyle* style, bool* isFixedPitch) const
|
| {
|
| SkAutoMutexAcquire libraryLock(fLibraryMutex);
|
|
|
| @@ -1769,28 +1725,6 @@
|
| *isFixedPitch = FT_IS_FIXED_WIDTH(face);
|
| }
|
|
|
| -#if SK_FREETYPE_HAS_MM
|
| - if (axes && face->face_flags & FT_FACE_FLAG_MULTIPLE_MASTERS) {
|
| - FT_MM_Var* variations = NULL;
|
| - FT_Error err = FT_Get_MM_Var(face, &variations);
|
| - if (err) {
|
| - SkDEBUGF(("INFO: font %s claims to have variations, but none found.\n",
|
| - face->family_name));
|
| - return false;
|
| - }
|
| - SkAutoFree autoFreeVariations(variations);
|
| -
|
| - axes->reset(variations->num_axis);
|
| - for (FT_UInt i = 0; i < variations->num_axis; ++i) {
|
| - const FT_Var_Axis& ftAxis = variations->axis[i];
|
| - (*axes)[i].fTag = ftAxis.tag;
|
| - (*axes)[i].fMinimum = ftAxis.minimum;
|
| - (*axes)[i].fDefault = ftAxis.def;
|
| - (*axes)[i].fMaximum = ftAxis.maximum;
|
| - }
|
| - }
|
| -#endif
|
| -
|
| FT_Done_Face(face);
|
| return true;
|
| }
|
|
|