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

Side by Side Diff: gm/fontmgr.cpp

Issue 673443003: 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') | include/ports/SkFontMgr.h » ('J')
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 13 matching lines...) Expand all
24 return x + paint.measureText(text.c_str(), text.size()); 24 return x + paint.measureText(text.c_str(), text.size());
25 } 25 }
26 26
27 static SkScalar drawCharacter(SkCanvas* canvas, uint32_t character, SkScalar x, 27 static SkScalar drawCharacter(SkCanvas* canvas, uint32_t character, SkScalar x,
28 SkScalar y, SkPaint& paint, SkFontMgr* fm, 28 SkScalar y, SkPaint& paint, SkFontMgr* fm,
29 const char* fontName, const char* bpc47, 29 const char* fontName, const char* bpc47,
30 const SkFontStyle& fontStyle) { 30 const SkFontStyle& fontStyle) {
31 // find typeface containing the requested character and draw it 31 // find typeface containing the requested character and draw it
32 SkString ch; 32 SkString ch;
33 ch.appendUnichar(character); 33 ch.appendUnichar(character);
34 SkTypeface* typeface = fm->matchFamilyStyleCharacter(fontName, fontStyle, bp c47, character); 34 SkTypeface* typeface = fm->matchFamilyStyleCharacter(fontName, fontStyle, &b pc47, 1, character);
35 SkSafeUnref(paint.setTypeface(typeface)); 35 SkSafeUnref(paint.setTypeface(typeface));
36 x = drawString(canvas, ch, x, y, paint) + 20; 36 x = drawString(canvas, ch, x, y, paint) + 20;
37 37
38 if (NULL == typeface) { 38 if (NULL == typeface) {
39 return x; 39 return x;
40 } 40 }
41 41
42 // repeat the process, but this time use the family name of the typeface 42 // repeat the process, but this time use the family name of the typeface
43 // from the first pass. This emulates the behavior in Blink where it 43 // from the first pass. This emulates the behavior in Blink where it
44 // it expects to get the same glyph when following this pattern. 44 // it expects to get the same glyph when following this pattern.
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 }; 221 };
222 222
223 ////////////////////////////////////////////////////////////////////////////// 223 //////////////////////////////////////////////////////////////////////////////
224 224
225 DEF_GM( return SkNEW(FontMgrGM); ) 225 DEF_GM( return SkNEW(FontMgrGM); )
226 DEF_GM( return SkNEW(FontMgrMatchGM); ) 226 DEF_GM( return SkNEW(FontMgrMatchGM); )
227 227
228 #ifdef SK_BUILD_FOR_WIN 228 #ifdef SK_BUILD_FOR_WIN
229 DEF_GM( return SkNEW_ARGS(FontMgrGM, (SkFontMgr_New_DirectWrite())); ) 229 DEF_GM( return SkNEW_ARGS(FontMgrGM, (SkFontMgr_New_DirectWrite())); )
230 #endif 230 #endif
OLDNEW
« no previous file with comments | « no previous file | include/ports/SkFontMgr.h » ('j') | include/ports/SkFontMgr.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698