• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2021 Google LLC
3  *
4  * Use of this source code is governed by a BSD-style license that can be
5  * found in the LICENSE file.
6  */
7 
8 #include "src/core/SkFontMgrPriv.h"
9 #include "tools/flags/CommandLineFlags.h"
10 #include "tools/flags/CommonFlags.h"
11 #include "tools/fonts/TestFontMgr.h"
12 
13 #if defined(SK_BUILD_FOR_WIN)
14 #include "include/ports/SkTypeface_win.h"
15 #endif
16 
17 namespace CommonFlags {
18 
19 
20 static DEFINE_bool(nativeFonts,
21                    true,
22                    "If true, use native font manager and rendering. "
23                    "If false, fonts will draw as portably as possible.");
24 #if defined(SK_BUILD_FOR_WIN)
25 static DEFINE_bool(gdi, false, "Use GDI instead of DirectWrite for font rendering.");
26 #endif
27 
SetDefaultFontMgr()28 void SetDefaultFontMgr() {
29     if (!FLAGS_nativeFonts) {
30         gSkFontMgr_DefaultFactory = &ToolUtils::MakePortableFontMgr;
31     }
32 #if defined(SK_BUILD_FOR_WIN)
33     if (FLAGS_gdi) {
34         gSkFontMgr_DefaultFactory = &SkFontMgr_New_GDI;
35     }
36 #endif
37 }
38 
39 }
40