diff options
author | agl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-10 09:41:32 +0000 |
---|---|---|
committer | agl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-10 09:41:32 +0000 |
commit | 3f1e7569c74e1d87c0038d4e3ddf4ee85511b9ff (patch) | |
tree | 34df02d7e3dda100a964914ab13b242a46d7c4ec /skia | |
parent | 44fcf79100e66ef18af6165db1665f9c28781ed0 (diff) | |
download | chromium_src-3f1e7569c74e1d87c0038d4e3ddf4ee85511b9ff.zip chromium_src-3f1e7569c74e1d87c0038d4e3ddf4ee85511b9ff.tar.gz chromium_src-3f1e7569c74e1d87c0038d4e3ddf4ee85511b9ff.tar.bz2 |
Linux: fix failure to find any fonts
When we are looking for a fallback font, we don't want the usual
family name matching to stop us from finding one. The only case where
we should fail to find a fallback is when fontconfig doesn't know
about /any/ fonts on the system.
This patch adds a flag argument to FontMatch which tells it when we're
in fallback mode.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9477 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'skia')
-rw-r--r-- | skia/ports/SkFontHost_fontconfig.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/skia/ports/SkFontHost_fontconfig.cpp b/skia/ports/SkFontHost_fontconfig.cpp index ddc025b..f58ff8e 100644 --- a/skia/ports/SkFontHost_fontconfig.cpp +++ b/skia/ports/SkFontHost_fontconfig.cpp @@ -95,7 +95,8 @@ public: // For example, FontMatchString(FC_FILE, FcTypeString, // "/usr/share/fonts/myfont.ttf", NULL); // ----------------------------------------------------------------------------- -static FcPattern* FontMatch(const char* type, FcType vtype, const void* value, +static FcPattern* FontMatch(bool is_fallback, + const char* type, FcType vtype, const void* value, ...) { va_list ap; @@ -179,7 +180,7 @@ static FcPattern* FontMatch(const char* type, FcType vtype, const void* value, FcPatternDestroy(pattern); - if (!family_names_match) { + if (!family_names_match && !is_fallback) { FcPatternDestroy(match); return NULL; } @@ -227,7 +228,8 @@ SkTypeface* SkFontHost::FindTypeface(const SkTypeface* familyFace, return NULL; FcInit(); - face_match = FontMatch(FC_FILE, FcTypeString, i->second.c_str(), NULL); + face_match = FontMatch(false, FC_FILE, FcTypeString, i->second.c_str(), + NULL); if (!face_match) return NULL; @@ -258,7 +260,8 @@ SkTypeface* SkFontHost::FindTypeface(const SkTypeface* familyFace, FC_WEIGHT_BOLD : FC_WEIGHT_NORMAL; const int italic = style & SkTypeface::kItalic ? FC_SLANT_ITALIC : FC_SLANT_ROMAN; - FcPattern* match = FontMatch(FC_FAMILY, FcTypeString, resolved_family_name, + FcPattern* match = FontMatch(false, + FC_FAMILY, FcTypeString, resolved_family_name, FC_WEIGHT, FcTypeInteger, bold, FC_SLANT, FcTypeInteger, italic, NULL); @@ -330,7 +333,7 @@ void SkFontHost::Serialize(const SkTypeface*, SkWStream*) { SkScalerContext* SkFontHost::CreateFallbackScalerContext (const SkScalerContext::Rec& rec) { - FcPattern* match = FontMatch(FC_FAMILY, FcTypeString, "serif", + FcPattern* match = FontMatch(true, FC_FAMILY, FcTypeString, "serif", NULL); // This will fail when we have no fonts on the system. |