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

Side by Side Diff: src/ports/SkFontConfigInterface_android.cpp

Issue 23601041: Update Android's FontHost to return NULL if familyName does not match (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: addressing comments Created 7 years, 3 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2013 The Android Open Source Project 3 * Copyright 2013 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "SkFontConfigInterface.h" 9 #include "SkFontConfigInterface.h"
10 #include "SkTypeface_android.h" 10 #include "SkTypeface_android.h"
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 if (NULL != familyName) { 406 if (NULL != familyName) {
407 SkAutoAsciiToLC tolc(familyName); 407 SkAutoAsciiToLC tolc(familyName);
408 if (fFamilyNameDict.find(tolc.lc(), &familyRecID)) { 408 if (fFamilyNameDict.find(tolc.lc(), &familyRecID)) {
409 exactNameMatch = true; 409 exactNameMatch = true;
410 } 410 }
411 } else { 411 } else {
412 familyRecID = fDefaultFamilyRecID; 412 familyRecID = fDefaultFamilyRecID;
413 413
414 } 414 }
415 415
416 // If no matching family name is found then return false. This allows client s
417 // to be able to search for other fonts instead of forcing them to use the
418 // default font.
416 if (INVALID_FAMILY_REC_ID == familyRecID) { 419 if (INVALID_FAMILY_REC_ID == familyRecID) {
417 //TODO this ensures that we always return something 420 return false;
418 familyRecID = fDefaultFamilyRecID;
419 //return false;
420 } 421 }
421 422
422 FontRecID fontRecID = find_best_style(fFontFamilies[familyRecID], style); 423 FontRecID fontRecID = find_best_style(fFontFamilies[familyRecID], style);
423 FontRec& fontRec = fFonts[fontRecID]; 424 FontRec& fontRec = fFonts[fontRecID];
424 425
425 if (NULL != outFontIdentifier) { 426 if (NULL != outFontIdentifier) {
426 outFontIdentifier->fID = fontRecID; 427 outFontIdentifier->fID = fontRecID;
427 outFontIdentifier->fTTCIndex = 0; 428 outFontIdentifier->fTTCIndex = 0;
428 outFontIdentifier->fString.set(fontRec.fFileName); 429 outFontIdentifier->fString.set(fontRec.fFileName);
429 // outFontIdentifier->fStyle = fontRec.fStyle; 430 // outFontIdentifier->fStyle = fontRec.fStyle;
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
834 return SkCreateTypefaceForScriptNG(getHBScriptFromHBScriptOld(script), style , fontVariant); 835 return SkCreateTypefaceForScriptNG(getHBScriptFromHBScriptOld(script), style , fontVariant);
835 } 836 }
836 837
837 #endif 838 #endif
838 839
839 /////////////////////////////////////////////////////////////////////////////// 840 ///////////////////////////////////////////////////////////////////////////////
840 841
841 SkFontMgr* SkFontMgr::Factory() { 842 SkFontMgr* SkFontMgr::Factory() {
842 return NULL; 843 return NULL;
843 } 844 }
OLDNEW
« no previous file with comments | « gyp/tests.gyp ('k') | tests/Typeface.cpp » ('j') | tests/Typeface.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698