skia2/tools/flags/CommonFlagsFontMgr.cpp
Kevin Lubick 8f4e560871 Use CommonFlags namespace for other flags/functions
This consolidates tools/flags/CommonFlagsFontMgr.h into
tools/flags/CommonFlags.h and adds all those common
flags into the CommonFlags namespace.

I also cleaned up a few unused includes in DM.cpp

Change-Id: I1d1bf6598dfb87619b6abbb9faa1e24631f76fb4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/459476
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
2021-10-14 14:34:21 +00:00

40 lines
985 B
C++

/*
* Copyright 2021 Google LLC
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "src/core/SkFontMgrPriv.h"
#include "tools/flags/CommandLineFlags.h"
#include "tools/flags/CommonFlags.h"
#include "tools/fonts/TestFontMgr.h"
#if defined(SK_BUILD_FOR_WIN)
#include "include/ports/SkTypeface_win.h"
#endif
namespace CommonFlags {
static DEFINE_bool(nativeFonts,
true,
"If true, use native font manager and rendering. "
"If false, fonts will draw as portably as possible.");
#if defined(SK_BUILD_FOR_WIN)
static DEFINE_bool(gdi, false, "Use GDI instead of DirectWrite for font rendering.");
#endif
void SetDefaultFontMgr() {
if (!FLAGS_nativeFonts) {
gSkFontMgr_DefaultFactory = &ToolUtils::MakePortableFontMgr;
}
#if defined(SK_BUILD_FOR_WIN)
if (FLAGS_gdi) {
gSkFontMgr_DefaultFactory = &SkFontMgr_New_GDI;
}
#endif
}
}