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

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

Issue 1921903002: Add oblique as a slant. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rebase and add test. Created 4 years, 8 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
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkTypes.h" 8 #include "SkTypes.h"
9 9
10 #include "SkData.h" 10 #include "SkData.h"
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 return SkRef(closest); 250 return SkRef(closest);
251 } 251 }
252 252
253 private: 253 private:
254 SkFontStyle style(int index) { 254 SkFontStyle style(int index) {
255 return fStyles[index]->fontStyle(); 255 return fStyles[index]->fontStyle();
256 } 256 }
257 static int match_score(const SkFontStyle& pattern, const SkFontStyle& candid ate) { 257 static int match_score(const SkFontStyle& pattern, const SkFontStyle& candid ate) {
258 int score = 0; 258 int score = 0;
259 score += SkTAbs((pattern.width() - candidate.width()) * 100); 259 score += SkTAbs((pattern.width() - candidate.width()) * 100);
260 score += SkTAbs((pattern.isItalic() == candidate.isItalic()) ? 0 : 1000) ; 260 score += SkTAbs((pattern.slant() == candidate.slant()) ? 0 : 1000);
261 score += SkTAbs(pattern.weight() - candidate.weight()); 261 score += SkTAbs(pattern.weight() - candidate.weight());
262 return score; 262 return score;
263 } 263 }
264 264
265 SkTArray<SkAutoTUnref<SkTypeface_AndroidSystem>, true> fStyles; 265 SkTArray<SkAutoTUnref<SkTypeface_AndroidSystem>, true> fStyles;
266 266
267 friend struct NameToFamily; 267 friend struct NameToFamily;
268 friend class SkFontMgr_Android; 268 friend class SkFontMgr_Android;
269 269
270 typedef SkFontStyleSet INHERITED; 270 typedef SkFontStyleSet INHERITED;
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 SkASSERT(custom->fSystemFontUse < SK_ARRAY_COUNT(gSystemFontUseStrings)) ; 578 SkASSERT(custom->fSystemFontUse < SK_ARRAY_COUNT(gSystemFontUseStrings)) ;
579 SkDEBUGF(("SystemFontUse: %s BasePath: %s Fonts: %s FallbackFonts: %s\n" , 579 SkDEBUGF(("SystemFontUse: %s BasePath: %s Fonts: %s FallbackFonts: %s\n" ,
580 gSystemFontUseStrings[custom->fSystemFontUse], 580 gSystemFontUseStrings[custom->fSystemFontUse],
581 custom->fBasePath, 581 custom->fBasePath,
582 custom->fFontsXml, 582 custom->fFontsXml,
583 custom->fFallbackFontsXml)); 583 custom->fFallbackFontsXml));
584 } 584 }
585 585
586 return new SkFontMgr_Android(custom); 586 return new SkFontMgr_Android(custom);
587 } 587 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698