Remove SK_FONT_HOST_DOES_NOT_USE_FONTMGR and guarded code.

This define is no longer needed or set, so remove it from the code.

R=tomhudson@google.com, djsollen@google.com

Author: bungeman@google.com

Review URL: https://codereview.chromium.org/488083004
This commit is contained in:
bungeman 2014-08-20 08:01:35 -07:00 committed by Commit bot
parent 2c4352bb9d
commit f47dfed7a2
2 changed files with 0 additions and 56 deletions

View File

@ -210,21 +210,6 @@ SkFontMgr* SkFontMgr::RefDefault() {
//////////////////////////////////////////////////////////////////////////
#ifndef SK_FONTHOST_DOES_NOT_USE_FONTMGR
#if 0
static SkFontStyle TypefaceStyleBitsToFontStyle(SkTypeface::Style styleBits) {
SkFontStyle::Weight weight = (styleBits & SkTypeface::kBold) ?
SkFontStyle::kBold_Weight :
SkFontStyle::kNormal_Weight;
SkFontStyle::Width width = SkFontStyle::kNormal_Width;
SkFontStyle::Slant slant = (styleBits & SkTypeface::kItalic) ?
SkFontStyle::kUpright_Slant :
SkFontStyle::kItalic_Slant;
return SkFontStyle(weight, width, slant);
}
#endif
SkTypeface* SkFontHost::CreateTypeface(const SkTypeface* familyFace,
const char familyName[],
SkTypeface::Style style) {
@ -252,5 +237,3 @@ SkTypeface* SkFontHost::CreateTypefaceFromStream(SkStream* stream) {
SkAutoTUnref<SkFontMgr> fm(SkFontMgr::RefDefault());
return fm->createFromStream(stream);
}
#endif

View File

@ -120,45 +120,6 @@ SkTypeface* FontConfigTypeface::LegacyCreateTypeface(
return face;
}
#ifdef SK_FONTHOST_DOES_NOT_USE_FONTMGR
SkTypeface* SkFontHost::CreateTypeface(const SkTypeface* familyFace,
const char familyName[],
SkTypeface::Style style) {
return FontConfigTypeface::LegacyCreateTypeface(familyFace, familyName,
style);
}
SkTypeface* SkFontHost::CreateTypefaceFromStream(SkStream* stream) {
if (!stream) {
return NULL;
}
const size_t length = stream->getLength();
if (!length) {
return NULL;
}
if (length >= 1024 * 1024 * 1024) {
return NULL; // don't accept too large fonts (>= 1GB) for safety.
}
// ask freetype for reported style and if it is a fixed width font
SkTypeface::Style style = SkTypeface::kNormal;
bool isFixedWidth = false;
if (!SkTypeface_FreeType::ScanFont(stream, 0, NULL, &style, &isFixedWidth)) {
return NULL;
}
SkTypeface* face = SkNEW_ARGS(FontConfigTypeface, (style, isFixedWidth, stream));
return face;
}
SkTypeface* SkFontHost::CreateTypefaceFromFile(const char path[]) {
SkAutoTUnref<SkStream> stream(SkStream::NewFromFile(path));
return stream.get() ? CreateTypefaceFromStream(stream) : NULL;
}
#endif
///////////////////////////////////////////////////////////////////////////////
SkStream* FontConfigTypeface::onOpenStream(int* ttcIndex) const {