SkFontMgr_custom_empty.cpp 802 B

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