xref: /aosp_15_r20/external/skia/src/ports/SkFontMgr_custom_empty.cpp (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
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/core/SkFontScanner.h"
9 #include "include/core/SkRefCnt.h"
10 #include "include/ports/SkFontMgr_empty.h"
11 #include "src/ports/SkFontMgr_custom.h"
12 
13 class EmptyFontLoader : public SkFontMgr_Custom::SystemFontLoader {
14 public:
EmptyFontLoader()15     EmptyFontLoader() { }
16 
loadSystemFonts(const SkFontScanner * scanner,SkFontMgr_Custom::Families * families) const17     void loadSystemFonts(const SkFontScanner* scanner,
18                          SkFontMgr_Custom::Families* families) const override
19     {
20         SkFontStyleSet_Custom* family = new SkFontStyleSet_Custom(SkString());
21         families->push_back().reset(family);
22         family->appendTypeface(sk_make_sp<SkTypeface_Empty>());
23     }
24 
25 };
26 
SkFontMgr_New_Custom_Empty()27 sk_sp<SkFontMgr> SkFontMgr_New_Custom_Empty() {
28     return sk_make_sp<SkFontMgr_Custom>(EmptyFontLoader());
29 }
30