23#if !defined(SK_DISABLE_LEGACY_SKSHAPER_FUNCTIONS)
25#if defined(SK_SHAPER_HARFBUZZ_AVAILABLE)
29#if defined(SK_SHAPER_CORETEXT_AVAILABLE)
35#if !defined(SK_DISABLE_LEGACY_SKSHAPER_FUNCTIONS)
37#if defined(SK_SHAPER_HARFBUZZ_AVAILABLE) && defined(SK_SHAPER_UNICODE_AVAILABLE)
38 std::unique_ptr<SkShaper> shaper = MakeShapeThenWrap(std::move(
fallback));
42#elif defined(SK_SHAPER_CORETEXT_AVAILABLE)
51#if defined(SK_SHAPER_HARFBUZZ_AVAILABLE) && defined(SK_SHAPER_UNICODE_AVAILABLE)
56std::unique_ptr<SkShaper::BiDiRunIterator>
58#if defined(SK_SHAPER_UNICODE_AVAILABLE)
59 std::unique_ptr<SkShaper::BiDiRunIterator> bidi = MakeIcuBiDiRunIterator(
utf8, utf8Bytes, bidiLevel);
64 return std::make_unique<SkShaper::TrivialBiDiRunIterator>(bidiLevel, utf8Bytes);
67std::unique_ptr<SkShaper::ScriptRunIterator>
69#if defined(SK_SHAPER_HARFBUZZ_AVAILABLE) && defined(SK_SHAPER_UNICODE_AVAILABLE)
70 std::unique_ptr<SkShaper::ScriptRunIterator>
script =
76 return std::make_unique<SkShaper::TrivialScriptRunIterator>(scriptTag, utf8Bytes);
86 return val < 0 ? 0xFFFD : val;
95 : fCurrent(
utf8), fBegin(
utf8), fEnd(fCurrent + utf8Bytes)
96 , fFallbackMgr(
std::move(fallbackMgr))
98 , fFallbackFont(fFont)
99 , fCurrentFont(nullptr)
100 , fRequestName(requestName)
101 , fRequestStyle(requestStyle)
112 nullptr,
font.getTypeface()->fontStyle(), nullptr)
121 fCurrentFont = &fFont;
124 fCurrentFont = &fFallbackFont;
127 const char* language = fLanguage ? fLanguage->
currentLanguage() :
nullptr;
128 int languageCount = fLanguage ? 1 : 0;
130 fRequestName, fRequestStyle, &language, languageCount, u));
133 fCurrentFont = &fFallbackFont;
135 fCurrentFont = &fFont;
139 while (fCurrent < fEnd) {
140 const char*
prev = fCurrent;
151 const char* language = fLanguage ? fLanguage->
currentLanguage() :
nullptr;
152 int languageCount = fLanguage ? 1 : 0;
154 fRequestName, fRequestStyle, &language, languageCount, u));
163 return fCurrent - fBegin;
166 return fCurrent == fEnd;
170 return *fCurrentFont;
174 char const * fCurrent;
175 char const *
const fBegin;
176 char const *
const fEnd;
181 char const *
const fRequestName;
186std::unique_ptr<SkShaper::FontRunIterator>
190 return std::make_unique<FontMgrRunIterator>(
utf8, utf8Bytes,
font, std::move(
fallback));
193std::unique_ptr<SkShaper::FontRunIterator>
199 return std::make_unique<FontMgrRunIterator>(
utf8, utf8Bytes,
font, std::move(
fallback),
200 requestName, requestStyle, language);
203std::unique_ptr<SkShaper::LanguageRunIterator>
205 return std::make_unique<TrivialLanguageRunIterator>(std::locale().
name().c_str(), utf8Bytes);
209 fCurrentPosition = fOffset;
216 info.fFont.getMetrics(&metrics);
223 fCurrentPosition.
fY -= fMaxRunAscent;
227 int glyphCount = SkTFitsIn<int>(
info.glyphCount) ?
info.glyphCount : INT_MAX;
228 int utf8RangeSize = SkTFitsIn<int>(
info.utf8Range.size()) ?
info.utf8Range.size() : INT_MAX;
232 memcpy(
runBuffer.utf8text, fUtf8Text +
info.utf8Range.begin(), utf8RangeSize);
235 fGlyphCount = glyphCount;
236 fClusterOffset =
info.utf8Range.begin();
247 for (
int i = 0;
i < fGlyphCount; ++
i) {
248 SkASSERT(fClusters[
i] >= (
unsigned)fClusterOffset);
249 fClusters[
i] -= fClusterOffset;
251 fCurrentPosition +=
info.fAdvance;
254 fOffset += { 0, fMaxRunDescent + fMaxRunLeading - fMaxRunAscent };
258 return fBuilder.
make();
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
static float prev(float f)
static SkUnichar utf8_next(const char **ptr, const char *end)
size_t endOfCurrentRun() const override
FontMgrRunIterator(const char *utf8, size_t utf8Bytes, const SkFont &font, sk_sp< SkFontMgr > fallbackMgr)
const SkFont & currentFont() const override
FontMgrRunIterator(const char *utf8, size_t utf8Bytes, const SkFont &font, sk_sp< SkFontMgr > fallbackMgr, const char *requestName, SkFontStyle requestStyle, const SkShaper::LanguageRunIterator *lang)
bool atEnd() const override
sk_sp< SkTypeface > matchFamilyStyleCharacter(const char familyName[], const SkFontStyle &, const char *bcp47[], int bcp47Count, SkUnichar character) const
SkTypeface * getTypeface() const
void setTypeface(sk_sp< SkTypeface > tf)
SkGlyphID unicharToGlyph(SkUnichar uni) const
virtual const char * currentLanguage() const =0
virtual size_t endOfCurrentRun() const =0
static std::unique_ptr< SkShaper > Make(sk_sp< SkFontMgr > fallback=nullptr)
static std::unique_ptr< ScriptRunIterator > MakeScriptRunIterator(const char *utf8, size_t utf8Bytes, SkFourByteTag script)
static std::unique_ptr< FontRunIterator > MakeFontMgrRunIterator(const char *utf8, size_t utf8Bytes, const SkFont &font, sk_sp< SkFontMgr > fallback)
static std::unique_ptr< LanguageRunIterator > MakeStdLanguageRunIterator(const char *utf8, size_t utf8Bytes)
static void PurgeCaches()
static std::unique_ptr< BiDiRunIterator > MakeBiDiRunIterator(const char *utf8, size_t utf8Bytes, uint8_t bidiLevel)
void commitLine() override
void beginLine() override
void commitRunInfo() override
void runInfo(const RunInfo &) override
Buffer runBuffer(const RunInfo &) override
void commitRunBuffer(const RunInfo &) override
sk_sp< SkTextBlob > makeBlob()
sk_sp< SkTextBlob > make()
const RunBuffer & allocRunTextPos(const SkFont &font, int count, int textByteCount, const SkRect *bounds=nullptr)
static float max(float r, float g, float b)
static float min(float r, float g, float b)
SKSHAPER_API std::unique_ptr< SkShaper > CoreText()
SKSHAPER_API void PurgeCaches()
SKSHAPER_API std::unique_ptr< SkShaper::ScriptRunIterator > ScriptRunIterator(const char *utf8, size_t utf8Bytes)
SKSHAPER_API std::unique_ptr< SkShaper > PrimitiveText()
SK_SPI SkUnichar NextUTF8(const char **ptr, const char *end)
DEF_SWITCHES_START aot vmservice shared library name
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
font
Font Metadata and Metrics.
SkScalar fLeading
distance to add between lines, typically positive or zero
SkScalar fAscent
distance to reserve above baseline, typically negative
SkScalar fDescent
distance to reserve below baseline, typically positive