16#if !defined(SK_DISABLE_LEGACY_SKSHAPER_FUNCTIONS)
28#if !defined(SK_DISABLE_LEGACY_SKSHAPER_FUNCTIONS)
29 void shape(
const char*
utf8,
size_t utf8Bytes,
33 RunHandler*)
const override;
35 void shape(
const char*
utf8,
size_t utf8Bytes,
41 RunHandler*)
const override;
44 void shape(
const char*
utf8,
size_t utf8Bytes,
49 const Feature*,
size_t featureSize,
51 RunHandler*)
const override;
90 const char* wordStart =
text;
95 const char* prevText =
text;
97 accumulatedWidth += advance[glyphIndex++];
100 if (!currWS && prevWS) {
101 wordStart = prevText;
105 if (
width < accumulatedWidth) {
106 bool consumeWhitespace =
false;
109 if (prevText ==
start) {
113 consumeWhitespace =
true;
114 }
else if (wordStart !=
start) {
117 }
else if (prevText >
start) {
123 consumeWhitespace =
true;
125 if (consumeWhitespace) {
131 *trailing =
text - prevText;
141#if !defined(SK_DISABLE_LEGACY_SKSHAPER_FUNCTIONS)
142void SkShaperPrimitive::shape(
const char*
utf8,
144 FontRunIterator&
font,
145 BiDiRunIterator& bidi,
147 LanguageRunIterator&
lang,
149 RunHandler* handler)
const {
153void SkShaperPrimitive::shape(
const char*
utf8,
158 RunHandler* handler)
const {
159 std::unique_ptr<FontRunIterator> fontRuns(
167 TrivialLanguageRunIterator
lang{
nullptr, 0};
168 return this->shape(
utf8, utf8Bytes, *fontRuns, bidi,
script,
lang,
nullptr, 0,
width, handler);
172void SkShaperPrimitive::shape(
const char*
utf8,
174 FontRunIterator& fontRuns,
177 LanguageRunIterator&,
181 RunHandler* handler)
const {
183 if (!fontRuns.atEnd()) {
185 font = fontRuns.currentFont();
190 if (glyphCount < 0) {
197 std::unique_ptr<SkScalar[]> advances(
new SkScalar[glyphCount]);
198 font.getWidthsBounds(
glyphs.get(), glyphCount, advances.get(),
nullptr,
nullptr);
200 size_t glyphOffset = 0;
201 size_t utf8Offset = 0;
203 size_t bytesCollapsed;
205 advances.get() + glyphOffset, &bytesCollapsed);
206 size_t bytesVisible = bytesConsumed - bytesCollapsed;
209 const RunHandler::RunInfo
info = {
214 RunHandler::Range(utf8Offset, bytesVisible)
216 handler->beginLine();
217 if (
info.glyphCount) {
218 handler->runInfo(
info);
220 handler->commitRunInfo();
221 if (
info.glyphCount) {
226 for (
size_t i = 0;
i <
info.glyphCount; ++
i) {
227 buffer.positions[
i] = position;
228 position.
fX += advances[
i + glyphOffset];
231 const char* txtPtr =
utf8;
232 for (
size_t i = 0;
i <
info.glyphCount; ++
i) {
238 handler->commitRunBuffer(
info);
240 handler->commitLine();
243 utf8Offset += bytesConsumed;
244 utf8 += bytesConsumed;
245 utf8Bytes -= bytesConsumed;
246 }
while (0 < utf8Bytes);
249#if !defined(SK_DISABLE_LEGACY_SKSHAPER_FUNCTIONS)
254std::unique_ptr<SkShaper>
PrimitiveText() {
return std::make_unique<SkShaperPrimitive>(); }
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
static float next(float f)
@ kUTF8
uses bytes to represent UTF-8 or ASCII
static bool is_breaking_whitespace(SkUnichar c)
static size_t linebreak(const char text[], const char stop[], const SkFont &font, SkScalar width, SkScalar *advance, size_t *trailing)
constexpr uint32_t SkToU32(S x)
static std::unique_ptr< FontRunIterator > MakeFontMgrRunIterator(const char *utf8, size_t utf8Bytes, const SkFont &font, sk_sp< SkFontMgr > fallback)
static std::unique_ptr< SkShaper > MakePrimitive()
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 > PrimitiveText()
SKSHAPER_API std::unique_ptr< SkShaper::ScriptRunIterator > TrivialScriptRunIterator(size_t utf8Bytes, SkFourByteTag scriptTag)
SK_SPI SkUnichar NextUTF8(const char **ptr, const char *end)
SK_SPI int CountUTF8(const char *utf8, size_t byteLength)
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 buffer
font
Font Metadata and Metrics.