1 /* 2 * Copyright 2017 Google Inc. 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 "include/ports/SkFontMgr_empty.h" 9 #include "src/ports/SkFontMgr_custom.h" 10 11 class EmptyFontLoader : public SkFontMgr_Custom::SystemFontLoader { 12 public: EmptyFontLoader()13 EmptyFontLoader() { } 14 loadSystemFonts(const SkTypeface_FreeType::Scanner & scanner,SkFontMgr_Custom::Families * families) const15 void loadSystemFonts(const SkTypeface_FreeType::Scanner& scanner, 16 SkFontMgr_Custom::Families* families) const override 17 { 18 SkFontStyleSet_Custom* family = new SkFontStyleSet_Custom(SkString()); 19 families->push_back().reset(family); 20 family->appendTypeface(sk_make_sp<SkTypeface_Empty>()); 21 } 22 23 }; 24 SkFontMgr_New_Custom_Empty()25SK_API sk_sp<SkFontMgr> SkFontMgr_New_Custom_Empty() { 26 return sk_make_sp<SkFontMgr_Custom>(EmptyFontLoader()); 27 } 28