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

Side by Side Diff: gm/fontmgr.cpp

Issue 670243002: Update fontMgr to take list of bcp47 language tags. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « no previous file | include/ports/SkFontMgr.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 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 "gm.h" 8 #include "gm.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkFontMgr.h" 10 #include "SkFontMgr.h"
(...skipping 20 matching lines...) Expand all
31 return x + paint.measureText(text.c_str(), text.size()); 31 return x + paint.measureText(text.c_str(), text.size());
32 } 32 }
33 33
34 static SkScalar drawCharacter(SkCanvas* canvas, uint32_t character, SkScalar x, 34 static SkScalar drawCharacter(SkCanvas* canvas, uint32_t character, SkScalar x,
35 SkScalar y, SkPaint& paint, SkFontMgr* fm, 35 SkScalar y, SkPaint& paint, SkFontMgr* fm,
36 const char* fontName, const char* bpc47, 36 const char* fontName, const char* bpc47,
37 const SkFontStyle& fontStyle) { 37 const SkFontStyle& fontStyle) {
38 // find typeface containing the requested character and draw it 38 // find typeface containing the requested character and draw it
39 SkString ch; 39 SkString ch;
40 ch.appendUnichar(character); 40 ch.appendUnichar(character);
41 #ifdef SK_FM_NEW_MATCH_FAMILY_STYLE_CHARACTER
42 SkTypeface* typeface = fm->matchFamilyStyleCharacter(fontName, fontStyle, &b pc47, 1, character);
43 #else
41 SkTypeface* typeface = fm->matchFamilyStyleCharacter(fontName, fontStyle, bp c47, character); 44 SkTypeface* typeface = fm->matchFamilyStyleCharacter(fontName, fontStyle, bp c47, character);
45 #endif
42 SkSafeUnref(paint.setTypeface(typeface)); 46 SkSafeUnref(paint.setTypeface(typeface));
43 x = drawString(canvas, ch, x, y, paint) + 20; 47 x = drawString(canvas, ch, x, y, paint) + 20;
44 48
45 if (NULL == typeface) { 49 if (NULL == typeface) {
46 return x; 50 return x;
47 } 51 }
48 52
49 // repeat the process, but this time use the family name of the typeface 53 // repeat the process, but this time use the family name of the typeface
50 // from the first pass. This emulates the behavior in Blink where it 54 // from the first pass. This emulates the behavior in Blink where it
51 // it expects to get the same glyph when following this pattern. 55 // it expects to get the same glyph when following this pattern.
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 319
316 ////////////////////////////////////////////////////////////////////////////// 320 //////////////////////////////////////////////////////////////////////////////
317 321
318 DEF_GM( return SkNEW(FontMgrGM); ) 322 DEF_GM( return SkNEW(FontMgrGM); )
319 DEF_GM( return SkNEW(FontMgrBoundsGM); ) 323 DEF_GM( return SkNEW(FontMgrBoundsGM); )
320 DEF_GM( return SkNEW(FontMgrMatchGM); ) 324 DEF_GM( return SkNEW(FontMgrMatchGM); )
321 325
322 #ifdef SK_BUILD_FOR_WIN 326 #ifdef SK_BUILD_FOR_WIN
323 DEF_GM( return SkNEW_ARGS(FontMgrGM, (SkFontMgr_New_DirectWrite())); ) 327 DEF_GM( return SkNEW_ARGS(FontMgrGM, (SkFontMgr_New_DirectWrite())); )
324 #endif 328 #endif
OLDNEW
« no previous file with comments | « no previous file | include/ports/SkFontMgr.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698