8#ifndef SkShaper_DEFINED
9#define SkShaper_DEFINED
26#if defined(SK_DISABLE_LEGACY_SKSHAPER_FUNCTIONS)
32#if !defined(SKSHAPER_IMPLEMENTATION)
33 #define SKSHAPER_IMPLEMENTATION 0
36#if !defined(SKSHAPER_API)
37 #if defined(SKSHAPER_DLL)
39 #if SKSHAPER_IMPLEMENTATION
40 #define SKSHAPER_API __declspec(dllexport)
42 #define SKSHAPER_API __declspec(dllimport)
45 #define SKSHAPER_API __attribute__((visibility("default")))
54#if !defined(SK_DISABLE_LEGACY_SKSHAPER_FUNCTIONS)
55 static std::unique_ptr<SkShaper> MakePrimitive();
57#if defined(SK_SHAPER_HARFBUZZ_AVAILABLE)
60 static void PurgeHarfBuzzCache();
63#if defined(SK_SHAPER_CORETEXT_AVAILABLE)
64 static std::unique_ptr<SkShaper> MakeCoreText();
111 template <
typename RunIteratorSub
class>
112 class TrivialRunIterator :
public RunIteratorSubclass {
115 TrivialRunIterator(
size_t utf8Bytes) : fEnd(utf8Bytes), fAtEnd(fEnd == 0) {}
116 void consume()
override {
SkASSERT(!fAtEnd); fAtEnd =
true; }
117 size_t endOfCurrentRun()
const override {
return fAtEnd ? fEnd : 0; }
118 bool atEnd()
const override {
return fAtEnd; }
125 static std::unique_ptr<FontRunIterator>
126 MakeFontMgrRunIterator(
const char*
utf8,
size_t utf8Bytes,
128 static std::unique_ptr<SkShaper::FontRunIterator>
129 MakeFontMgrRunIterator(
const char*
utf8,
size_t utf8Bytes,
136 : TrivialRunIterator(utf8Bytes), fFont(
font) {}
142#if !defined(SK_DISABLE_LEGACY_SKSHAPER_FUNCTIONS)
143 static std::unique_ptr<BiDiRunIterator>
144 MakeBiDiRunIterator(
const char*
utf8,
size_t utf8Bytes, uint8_t bidiLevel);
145#if defined(SK_SHAPER_UNICODE_AVAILABLE)
146 static std::unique_ptr<BiDiRunIterator>
147 MakeIcuBiDiRunIterator(
const char*
utf8,
size_t utf8Bytes, uint8_t bidiLevel);
154 : TrivialRunIterator(utf8Bytes), fBidiLevel(bidiLevel) {}
160#if !defined(SK_DISABLE_LEGACY_SKSHAPER_FUNCTIONS)
161 static std::unique_ptr<ScriptRunIterator>
163#if defined(SK_SHAPER_HARFBUZZ_AVAILABLE)
164 static std::unique_ptr<ScriptRunIterator>
165 MakeSkUnicodeHbScriptRunIterator(
const char*
utf8,
size_t utf8Bytes);
166 static std::unique_ptr<ScriptRunIterator>
169 static std::unique_ptr<ScriptRunIterator>
170 MakeHbIcuScriptRunIterator(
const char*
utf8,
size_t utf8Bytes);
177 : TrivialRunIterator(utf8Bytes), fScript(
script) {}
183 static std::unique_ptr<LanguageRunIterator>
184 MakeStdLanguageRunIterator(
const char*
utf8,
size_t utf8Bytes);
188 : TrivialRunIterator(utf8Bytes), fLanguage(language) {}
199 constexpr Range() : fBegin(0), fSize(0) {}
203 constexpr size_t begin()
const {
return fBegin; }
205 constexpr size_t size()
const {
return fSize; }
226 virtual void beginLine() = 0;
229 virtual void runInfo(
const RunInfo&) = 0;
232 virtual void commitRunInfo() = 0;
238 virtual void commitRunBuffer(
const RunInfo&) = 0;
241 virtual void commitLine() = 0;
244#if !defined(SK_DISABLE_LEGACY_SKSHAPER_FUNCTIONS)
281 : fUtf8Text(utf8Text)
286 void beginLine()
override;
287 void runInfo(
const RunInfo&)
override;
288 void commitRunInfo()
override;
289 Buffer runBuffer(
const RunInfo&)
override;
290 void commitRunBuffer(
const RunInfo&)
override;
291 void commitLine()
override;
295 char const *
const fUtf8Text;
310 (
size_t utf8Bytes, uint8_t bidiLevel);
virtual uint8_t currentLevel() const =0
virtual const SkFont & currentFont() const =0
virtual const char * currentLanguage() const =0
virtual ~RunHandler()=default
virtual bool atEnd() const =0
virtual size_t endOfCurrentRun() const =0
virtual ~RunIterator()=default
virtual SkFourByteTag currentScript() const =0
TrivialBiDiRunIterator(uint8_t bidiLevel, size_t utf8Bytes)
uint8_t currentLevel() const override
const SkFont & currentFont() const override
TrivialFontRunIterator(const SkFont &font, size_t utf8Bytes)
TrivialLanguageRunIterator(const char *language, size_t utf8Bytes)
const char * currentLanguage() const override
SkFourByteTag currentScript() const override
TrivialScriptRunIterator(SkFourByteTag script, size_t utf8Bytes)
virtual void shape(const char *utf8, size_t utf8Bytes, FontRunIterator &, BiDiRunIterator &, ScriptRunIterator &, LanguageRunIterator &, const Feature *features, size_t featuresSize, SkScalar width, RunHandler *) const =0
virtual void shape(const char *utf8, size_t utf8Bytes, const SkFont &srcFont, bool leftToRight, SkScalar width, RunHandler *) const =0
virtual void shape(const char *utf8, size_t utf8Bytes, FontRunIterator &, BiDiRunIterator &, ScriptRunIterator &, LanguageRunIterator &, SkScalar width, RunHandler *) const =0
SkTextBlobBuilderRunHandler(const char *utf8Text, SkPoint offset)
static const char * begin(const StringSlice &s)
SK_API sk_sp< SkDocument > Make(SkWStream *dst, const SkSerialProcs *=nullptr, std::function< void(const SkPicture *)> onEndPage=nullptr)
SKSHAPER_API void PurgeCaches()
SKSHAPER_API std::unique_ptr< SkShaper::BiDiRunIterator > TrivialBiDiRunIterator(size_t utf8Bytes, uint8_t bidiLevel)
SKSHAPER_API std::unique_ptr< SkShaper > PrimitiveText()
SKSHAPER_API std::unique_ptr< SkShaper::ScriptRunIterator > TrivialScriptRunIterator(size_t utf8Bytes, SkFourByteTag scriptTag)
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace Enable an endless trace buffer The default is a ring buffer This is useful when very old events need to viewed For during application launch Memory usage will continue to grow indefinitely however Start app with an specific route defined on the framework flutter assets Path to the Flutter assets directory enable service port fallback
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
font
Font Metadata and Metrics.
constexpr size_t size() const
constexpr size_t begin() const
constexpr size_t end() const
constexpr Range(size_t begin, size_t size)