179 {
181 if (!fontRuns.atEnd()) {
182 fontRuns.consume();
183 font = fontRuns.currentFont();
184 }
186
188 if (glyphCount < 0) {
189 return;
190 }
191
194
195 std::unique_ptr<SkScalar[]> advances(
new SkScalar[glyphCount]);
196 font.getWidthsBounds(
glyphs.get(), glyphCount, advances.get(),
nullptr,
nullptr);
197
198 size_t glyphOffset = 0;
199 size_t utf8Offset = 0;
200 do {
201 size_t bytesCollapsed;
202 size_t bytesConsumed =
linebreak(utf8, utf8 + utf8Bytes, font,
width,
203 advances.get() + glyphOffset, &bytesCollapsed);
204 size_t bytesVisible = bytesConsumed - bytesCollapsed;
205
207 const RunHandler::RunInfo
info = {
209 0,
211 numGlyphs,
212 RunHandler::Range(utf8Offset, bytesVisible)
213 };
214 handler->beginLine();
215 if (
info.glyphCount) {
216 handler->runInfo(
info);
217 }
218 handler->commitRunInfo();
219 if (
info.glyphCount) {
221
224 for (
size_t i = 0; i <
info.glyphCount; ++i) {
225 buffer.positions[i] = position;
226 position.
fX += advances[i + glyphOffset];
227 }
229 const char* txtPtr =
utf8;
230 for (
size_t i = 0; i <
info.glyphCount; ++i) {
231
234 }
235 }
236 handler->commitRunBuffer(
info);
237 }
238 handler->commitLine();
239
241 utf8Offset += bytesConsumed;
242 utf8 += bytesConsumed;
243 utf8Bytes -= bytesConsumed;
244 } while (0 < utf8Bytes);
245}
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
@ kUTF8
uses bytes to represent UTF-8 or ASCII
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 const uint8_t buffer[]
SK_SPI SkUnichar NextUTF8(const char **ptr, const char *end)
SK_SPI int CountUTF8(const char *utf8, size_t byteLength)
font
Font Metadata and Metrics.