27#if defined(SK_UNICODE_ICU_IMPLEMENTATION)
31#if defined(SK_UNICODE_LIBGRAPHEME_IMPLEMENTATION)
35#if defined(SK_UNICODE_ICU4X_IMPLEMENTATION)
42#if defined(SK_UNICODE_ICU_IMPLEMENTATION)
47#if defined(SK_UNICODE_LIBGRAPHEME_IMPLEMENTATION)
52#if defined(SK_UNICODE_ICU4X_IMPLEMENTATION)
61 const char* fResource;
65 std::unique_ptr<SkGlyphID[]> fGlyphs;
66 std::unique_ptr<SkPoint[]> fPositions;
67 std::unique_ptr<uint32_t[]> fClusters;
69 unsigned fGlyphCount = 0;
71 bool fBeginLine =
false;
72 bool fCommitRunInfo =
false;
73 bool fCommitLine =
false;
78 void beginLine()
override { fBeginLine =
true;}
83 fRange =
info.utf8Range;
84 fGlyphs = std::make_unique<SkGlyphID[]>(
info.glyphCount);
85 fPositions = std::make_unique<SkPoint[]>(
info.glyphCount);
86 fClusters = std::make_unique<uint32_t[]>(
info.glyphCount);
97 if (!(fRange.
begin() + fRange.
size() <= fUtf8Size)) {
113 fontSize =
stream->getLength();
117 for (
auto&& [glyph, cluster] :
SkZip(
info.glyphCount, fGlyphs.get(), fClusters.get())) {
120 glyphs.appendU32(cluster);
129 "%s range: %zu-%zu(%zu) glyphCount:%u font: \"%s\" \"%s\" #%d %zuB\n"
130 "rangeText: \"%.*s\"\n"
133 fResource, fRange.
begin(), fRange.
end(), fRange.
size(), fGlyphCount,
134 familyName.
c_str(), postscriptName.
c_str(), ttcIndex, fontSize,
135 (
int)fRange.
size(), fUtf8 + fRange.
begin(),
140 for (
unsigned i = 0;
i < fGlyphCount; ++
i) {
142 "%" PRIu32
" >= %zu %s i:%u glyphCount:%u",
143 fClusters[
i], fRange.
begin(), fResource,
i, fGlyphCount);
145 "%" PRIu32
" < %zu %s i:%u glyphCount:%u",
146 fClusters[
i], fRange.
end(), fResource,
i, fGlyphCount);
149 void commitLine()
override { fCommitLine =
true; }
152#if defined(SK_SHAPER_HARFBUZZ_AVAILABLE) && defined(SK_SHAPER_UNICODE_AVAILABLE)
171 constexpr float kWidth = 400;
173 const char*
utf8 = (
const char*)
data->data();
174 size_t utf8Bytes =
data->size();
179 std::unique_ptr<SkShaper::BiDiRunIterator> bidi =
183 std::unique_ptr<SkShaper::LanguageRunIterator> language =
187 std::unique_ptr<SkShaper::ScriptRunIterator>
script =
191 std::unique_ptr<SkShaper::FontRunIterator> fontRuns =
194 shaper->shape(
utf8, utf8Bytes, *fontRuns, *bidi, *
script, *language,
nullptr, 0,
kWidth, &rh);
207 shaper->shape((
const char*)
data->data(),
233#if defined(SK_SHAPER_HARFBUZZ_AVAILABLE) && defined(SK_SHAPER_UNICODE_AVAILABLE)
237#define SHAPER_TEST(X) DEF_TEST(Shaper_cluster_ ## X, r) { cluster_test(r, "text/" #X ".txt"); }
249SHAPER_TEST(han_simplified)
250SHAPER_TEST(han_traditional)
256SHAPER_TEST(newtailue)
259SHAPER_TEST(sundanese)
267SHAPER_TEST(devanagari)
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
sk_sp< SkData > GetResourceAsData(const char *resource)
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
static SkString resource(SkPDFResourceType type, int index)
sk_sp< SkUnicode > get_unicode()
SkSpan(Container &&) -> SkSpan< std::remove_pointer_t< decltype(std::data(std::declval< Container >()))> >
constexpr unsigned SkToUInt(S x)
static constexpr SkFourByteTag SkSetFourByteTag(char a, char b, char c, char d)
SkZip(size_t size, Ts *... ts) -> SkZip< Ts... >
#define DEF_TEST(name, reporter)
#define REPORTER_ASSERT(r, cond,...)
static sk_sp< SkData > MakeEmpty()
static sk_sp< SkFontMgr > RefEmpty()
virtual void commitLine()=0
virtual void commitRunBuffer(const RunInfo &)=0
virtual void commitRunInfo()=0
virtual void runInfo(const RunInfo &)=0
virtual void beginLine()=0
virtual Buffer runBuffer(const RunInfo &)=0
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)
void append(const char text[])
void appendHex(uint32_t value, int minDigits=0)
const char * c_str() const
void getFamilyName(SkString *name) const
bool getPostScriptName(SkString *name) const
std::unique_ptr< SkStreamAsset > openStream(int *ttcIndex) const
SKSHAPER_API std::unique_ptr< SkShaper > ShaperDrivenWrapper(sk_sp< SkUnicode > unicode, sk_sp< SkFontMgr > fallback)
SKSHAPER_API std::unique_ptr< SkShaper::ScriptRunIterator > ScriptRunIterator(const char *utf8, size_t utf8Bytes)
SKSHAPER_API std::unique_ptr< SkShaper::BiDiRunIterator > TrivialBiDiRunIterator(size_t utf8Bytes, uint8_t bidiLevel)
SKSHAPER_API std::unique_ptr< SkShaper::ScriptRunIterator > TrivialScriptRunIterator(size_t utf8Bytes, SkFourByteTag scriptTag)
SKSHAPER_API std::unique_ptr< SkShaper::BiDiRunIterator > BidiRunIterator(sk_sp< SkUnicode > unicode, const char *utf8, size_t utf8Bytes, uint8_t bidiLevel)
SKUNICODE_API sk_sp< SkUnicode > Make()
SKUNICODE_API sk_sp< SkUnicode > Make()
SKUNICODE_API sk_sp< SkUnicode > Make()
DEF_SWITCHES_START aot vmservice shared library name
font
Font Metadata and Metrics.
const myers::Point & get(const myers::Segment &)
constexpr size_t size() const
constexpr size_t begin() const
constexpr size_t end() const
std::shared_ptr< const fml::Mapping > data