Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(160)

Unified Diff: Source/platform/exported/linux/WebFontInfo.cpp

Issue 323963002: Remove old functions in the process of renaming WebFontFamily to WebFallbackFont (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@ren_step1
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Source/platform/fonts/linux/FontCacheLinux.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/exported/linux/WebFontInfo.cpp
diff --git a/Source/platform/exported/linux/WebFontInfo.cpp b/Source/platform/exported/linux/WebFontInfo.cpp
index 23cbf1ee43c87bdf165f75359d45b51fc33820c4..74cf27e777fe1791627b5e81efc86fa7771053c1 100644
--- a/Source/platform/exported/linux/WebFontInfo.cpp
+++ b/Source/platform/exported/linux/WebFontInfo.cpp
@@ -47,83 +47,6 @@ void WebFontInfo::setSubpixelPositioning(bool subpixelPositioning)
useSubpixelPositioning = subpixelPositioning;
}
-// TODO(dro): Remove this legacy version, kept until renames on the Chromium side are done. crbug.com/382411
-void WebFontInfo::familyForChar(WebUChar32 c, const char* preferredLocale, WebFontFamily* family)
-{
- FcCharSet* cset = FcCharSetCreate();
- FcCharSetAddChar(cset, c);
- FcPattern* pattern = FcPatternCreate();
-
- FcValue fcvalue;
- fcvalue.type = FcTypeCharSet;
- fcvalue.u.c = cset;
- FcPatternAdd(pattern, FC_CHARSET, fcvalue, FcFalse);
-
- fcvalue.type = FcTypeBool;
- fcvalue.u.b = FcTrue;
- FcPatternAdd(pattern, FC_SCALABLE, fcvalue, FcFalse);
-
- if (preferredLocale) {
- FcLangSet* langset = FcLangSetCreate();
- FcLangSetAdd(langset, reinterpret_cast<const FcChar8 *>(preferredLocale));
- FcPatternAddLangSet(pattern, FC_LANG, langset);
- FcLangSetDestroy(langset);
- }
-
- FcConfigSubstitute(0, pattern, FcMatchPattern);
- FcDefaultSubstitute(pattern);
-
- FcResult result;
- FcFontSet* fontSet = FcFontSort(0, pattern, 0, 0, &result);
- FcPatternDestroy(pattern);
- FcCharSetDestroy(cset);
-
- if (!fontSet) {
- family->name = WebCString();
- family->isBold = false;
- family->isItalic = false;
- return;
- }
- // Older versions of fontconfig have a bug where they cannot select
- // only scalable fonts so we have to manually filter the results.
- for (int i = 0; i < fontSet->nfont; ++i) {
- FcPattern* current = fontSet->fonts[i];
- FcBool isScalable;
-
- if (FcPatternGetBool(current, FC_SCALABLE, 0, &isScalable) != FcResultMatch
- || !isScalable)
- continue;
-
- // fontconfig can also return fonts which are unreadable
- FcChar8* cFilename;
- if (FcPatternGetString(current, FC_FILE, 0, &cFilename) != FcResultMatch)
- continue;
-
- if (access(reinterpret_cast<char*>(cFilename), R_OK))
- continue;
-
- FcChar8* familyName;
- if (FcPatternGetString(current, FC_FAMILY, 0, &familyName) == FcResultMatch) {
- const char* charFamily = reinterpret_cast<char*>(familyName);
- family->name = WebCString(charFamily, strlen(charFamily));
- }
- int weight;
- if (FcPatternGetInteger(current, FC_WEIGHT, 0, &weight) == FcResultMatch)
- family->isBold = weight >= FC_WEIGHT_BOLD;
- else
- family->isBold = false;
- int slant;
- if (FcPatternGetInteger(current, FC_SLANT, 0, &slant) == FcResultMatch)
- family->isItalic = slant != FC_SLANT_ROMAN;
- else
- family->isItalic = false;
- FcFontSetDestroy(fontSet);
- return;
- }
-
- FcFontSetDestroy(fontSet);
-}
-
void WebFontInfo::fallbackFontForChar(WebUChar32 c, const char* preferredLocale, WebFallbackFont* fallbackFont)
{
FcCharSet* cset = FcCharSetCreate();
« no previous file with comments | « no previous file | Source/platform/fonts/linux/FontCacheLinux.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698