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

Unified Diff: src/ports/SkFontConfigParser_android.cpp

Issue 408143010: Revert of SkFontMgr for Android. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 5 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 | « src/ports/SkFontConfigParser_android.h ('k') | src/ports/SkFontMgr_android.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ports/SkFontConfigParser_android.cpp
diff --git a/src/ports/SkFontConfigParser_android.cpp b/src/ports/SkFontConfigParser_android.cpp
index fc8e9199c310ac438932631397c34103603bcc01..38a6ee652065cf25160d291065659125042a8d7a 100644
--- a/src/ports/SkFontConfigParser_android.cpp
+++ b/src/ports/SkFontConfigParser_android.cpp
@@ -7,14 +7,11 @@
#include "SkFontConfigParser_android.h"
#include "SkTDArray.h"
-#include "SkTSearch.h"
#include "SkTypeface.h"
#include <expat.h>
#include <stdio.h>
#include <sys/system_properties.h>
-
-#include <limits>
#define SYSTEM_FONTS_FILE "/system/etc/system_fonts.xml"
#define FALLBACK_FONTS_FILE "/system/etc/fallback_fonts.xml"
@@ -51,14 +48,13 @@
* or file tag. The resulting strings are put into the fNames or FontFileInfo arrays.
*/
static void textHandler(void *data, const char *s, int len) {
- SkAutoAsciiToLC tolc(s);
FamilyData *familyData = (FamilyData*) data;
// Make sure we're in the right state to store this name information
if (familyData->currentFamily &&
(familyData->currentTag == NAMESET_TAG || familyData->currentTag == FILESET_TAG)) {
switch (familyData->currentTag) {
case NAMESET_TAG:
- familyData->currentFamily->fNames.push_back().set(tolc.lc(), len);
+ familyData->currentFamily->fNames.push_back().set(s, len);
break;
case FILESET_TAG:
if (familyData->currentFontInfo) {
@@ -70,28 +66,6 @@
break;
}
}
-}
-
-/** http://www.w3.org/TR/html-markup/datatypes.html#common.data.integer.non-negative-def */
-template <typename T> static bool parseNonNegativeInteger(const char* s, T* value) {
- SK_COMPILE_ASSERT(std::numeric_limits<T>::is_integer, T_must_be_integer);
- const T nMax = std::numeric_limits<T>::max() / 10;
- const T dMax = std::numeric_limits<T>::max() - (nMax * 10);
- T n = 0;
- for (; *s; ++s) {
- // Check if digit
- if (*s < '0' || '9' < *s) {
- return false;
- }
- int d = *s - '0';
- // Check for overflow
- if (n > nMax || (n == nMax && d > dMax)) {
- return false;
- }
- n = (n * 10) + d;
- }
- *value = n;
- return true;
}
/**
@@ -116,13 +90,6 @@
}
} else if (strncmp(attributeName, "lang", nameLength) == 0) {
newFileInfo.fPaintOptions.setLanguage(attributeValue);
- } else if (strncmp(attributeName, "index", nameLength) == 0) {
- int value;
- if (parseNonNegativeInteger(attributeValue, &value)) {
- newFileInfo.fIndex = value;
- } else {
- SkDebugf("---- SystemFonts index=%s (INVALID)", attributeValue);
- }
}
//each element is a pair of attributeName/attributeValue string pairs
currentAttributeIndex += 2;
« no previous file with comments | « src/ports/SkFontConfigParser_android.h ('k') | src/ports/SkFontMgr_android.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698