From ba59a67f916f0909815d9a5b93e0a2af528f5791 Mon Sep 17 00:00:00 2001 From: mtklein Date: Mon, 4 Aug 2014 10:18:27 -0700 Subject: Remove dependency on std::string BUG=skia: R=bungeman@google.com, mtklein@google.com Author: mtklein@chromium.org Review URL: https://codereview.chromium.org/437253003 --- src/ports/SkFontConfigInterface_direct.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/ports/SkFontConfigInterface_direct.cpp b/src/ports/SkFontConfigInterface_direct.cpp index c0cfd8fdcf..10fbbcce1b 100644 --- a/src/ports/SkFontConfigInterface_direct.cpp +++ b/src/ports/SkFontConfigInterface_direct.cpp @@ -7,7 +7,6 @@ /* migrated from chrome/src/skia/ext/SkFontHost_fontconfig_direct.cpp */ -#include #include #include @@ -17,6 +16,7 @@ #include "SkFontConfigInterface.h" #include "SkLazyPtr.h" #include "SkStream.h" +#include "SkString.h" size_t SkFontConfigInterface::FontIdentity::writeToMemory(void* addr) const { size_t size = sizeof(fID) + sizeof(fTTCIndex); @@ -318,9 +318,9 @@ bool IsMetricCompatibleReplacement(const char* font_a, const char* font_b) // cases, the request either doesn't specify a font or is one of the // basic font names like "Sans", "Serif" or "Monospace". This function // tells you whether a given request is for such a fallback. -bool IsFallbackFontAllowed(const std::string& family) { +bool IsFallbackFontAllowed(const SkString& family) { const char* family_cstr = family.c_str(); - return family.empty() || + return family.isEmpty() || strcasecmp(family_cstr, "sans") == 0 || strcasecmp(family_cstr, "serif") == 0 || strcasecmp(family_cstr, "monospace") == 0; @@ -349,7 +349,7 @@ static bool valid_pattern(FcPattern* pattern) { // Find matching font from |font_set| for the given font family. FcPattern* MatchFont(FcFontSet* font_set, const char* post_config_family, - const std::string& family) { + const SkString& family) { // Older versions of fontconfig have a bug where they cannot select // only scalable fonts so we have to manually filter the results. FcPattern* match = NULL; @@ -441,8 +441,8 @@ bool SkFontConfigInterfaceDirect::matchFamilyName(const char familyName[], FontIdentity* outIdentity, SkString* outFamilyName, SkTypeface::Style* outStyle) { - std::string familyStr(familyName ? familyName : ""); - if (familyStr.length() > kMaxFontFamilyLength) { + SkString familyStr(familyName ? familyName : ""); + if (familyStr.size() > kMaxFontFamilyLength) { return false; } @@ -608,8 +608,8 @@ bool SkFontConfigInterfaceDirect::matchFamilySet(const char inFamilyName[], SkAutoMutexAcquire ac(mutex_); #if 0 - std::string familyStr(familyName ? familyName : ""); - if (familyStr.length() > kMaxFontFamilyLength) { + SkString familyStr(familyName ? familyName : ""); + if (familyStr.size() > kMaxFontFamilyLength) { return false; } -- cgit v1.2.3