xref: /aosp_15_r20/external/skia/modules/skshaper/src/SkShaper_factory.cpp (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1 /*
2  * Copyright 2024 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 "modules/skshaper/include/SkShaper_factory.h"
9 
10 #include "include/core/SkFontMgr.h" // IWYU pragma: keep
11 
12 namespace {
13 class PrimitiveFactory final : public SkShapers::Factory {
makeShaper(sk_sp<SkFontMgr>)14     std::unique_ptr<SkShaper> makeShaper(sk_sp<SkFontMgr>) override {
15         return SkShapers::Primitive::PrimitiveText();
16     }
makeBidiRunIterator(const char *,size_t,uint8_t)17     std::unique_ptr<SkShaper::BiDiRunIterator> makeBidiRunIterator(const char*,
18                                                                 size_t,
19                                                                 uint8_t) override {
20         return std::make_unique<SkShaper::TrivialBiDiRunIterator>(0, 0);
21     }
makeScriptRunIterator(const char *,size_t,SkFourByteTag)22     std::unique_ptr<SkShaper::ScriptRunIterator> makeScriptRunIterator(const char*,
23                                                                  size_t,
24                                                                  SkFourByteTag) override {
25         return std::make_unique<SkShaper::TrivialScriptRunIterator>(0, 0);
26     }
27 
getUnicode()28     SkUnicode* getUnicode() override {
29         return nullptr;
30     }
31 };
32 }
33 
34 namespace SkShapers::Primitive {
Factory()35 sk_sp<SkShapers::Factory> Factory() {
36     return sk_make_sp<PrimitiveFactory>();
37 }
38 }  // namespace SkShapers::Primitive
39