Flutter Engine
The Flutter Engine
Functions
paragraph_builder.cpp File Reference
#include "../export.h"
#include "../wrappers.h"
#include "third_party/skia/modules/skparagraph/include/ParagraphBuilder.h"
#include "third_party/skia/modules/skunicode/include/SkUnicode_client.h"

Go to the source code of this file.

Functions

SKWASM_EXPORT ParagraphBuilderparagraphBuilder_create (ParagraphStyle *style, FlutterFontCollection *collection)
 
SKWASM_EXPORT void paragraphBuilder_dispose (ParagraphBuilder *builder)
 
SKWASM_EXPORT void paragraphBuilder_addPlaceholder (ParagraphBuilder *builder, SkScalar width, SkScalar height, PlaceholderAlignment alignment, SkScalar baselineOffset, TextBaseline baseline)
 
SKWASM_EXPORT void paragraphBuilder_addText (ParagraphBuilder *builder, std::u16string *text)
 
SKWASM_EXPORT char * paragraphBuilder_getUtf8Text (ParagraphBuilder *builder, uint32_t *outLength)
 
SKWASM_EXPORT void paragraphBuilder_pushStyle (ParagraphBuilder *builder, TextStyle *style)
 
SKWASM_EXPORT void paragraphBuilder_pop (ParagraphBuilder *builder)
 
SKWASM_EXPORT ParagraphparagraphBuilder_build (ParagraphBuilder *builder)
 
SKWASM_EXPORT std::vector< SkUnicode::Position > * unicodePositionBuffer_create (size_t length)
 
SKWASM_EXPORT SkUnicode::PositionunicodePositionBuffer_getDataPointer (std::vector< SkUnicode::Position > *buffer)
 
SKWASM_EXPORT void unicodePositionBuffer_free (std::vector< SkUnicode::Position > *buffer)
 
SKWASM_EXPORT std::vector< SkUnicode::LineBreakBefore > * lineBreakBuffer_create (size_t length)
 
SKWASM_EXPORT SkUnicode::LineBreakBeforelineBreakBuffer_getDataPointer (std::vector< SkUnicode::LineBreakBefore > *buffer)
 
SKWASM_EXPORT void lineBreakBuffer_free (std::vector< SkUnicode::LineBreakBefore > *buffer)
 
SKWASM_EXPORT void paragraphBuilder_setGraphemeBreaksUtf16 (ParagraphBuilder *builder, std::vector< SkUnicode::Position > *breaks)
 
SKWASM_EXPORT void paragraphBuilder_setWordBreaksUtf16 (ParagraphBuilder *builder, std::vector< SkUnicode::Position > *breaks)
 
SKWASM_EXPORT void paragraphBuilder_setLineBreaksUtf16 (ParagraphBuilder *builder, std::vector< SkUnicode::LineBreakBefore > *breaks)
 

Function Documentation

◆ lineBreakBuffer_create()

SKWASM_EXPORT std::vector< SkUnicode::LineBreakBefore > * lineBreakBuffer_create ( size_t  length)

Definition at line 80 of file paragraph_builder.cpp.

81 {
82 return new std::vector<SkUnicode::LineBreakBefore>(
84}
size_t length

◆ lineBreakBuffer_free()

SKWASM_EXPORT void lineBreakBuffer_free ( std::vector< SkUnicode::LineBreakBefore > *  buffer)

Definition at line 91 of file paragraph_builder.cpp.

92 {
93 delete buffer;
94}
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
Definition: switches.h:126

◆ lineBreakBuffer_getDataPointer()

SKWASM_EXPORT SkUnicode::LineBreakBefore * lineBreakBuffer_getDataPointer ( std::vector< SkUnicode::LineBreakBefore > *  buffer)

Definition at line 86 of file paragraph_builder.cpp.

87 {
88 return buffer->data();
89}

◆ paragraphBuilder_addPlaceholder()

SKWASM_EXPORT void paragraphBuilder_addPlaceholder ( ParagraphBuilder builder,
SkScalar  width,
SkScalar  height,
PlaceholderAlignment  alignment,
SkScalar  baselineOffset,
TextBaseline  baseline 
)

Definition at line 24 of file paragraph_builder.cpp.

30 {
31 builder->addPlaceholder(
32 PlaceholderStyle(width, height, alignment, baseline, baselineOffset));
33}
int32_t height
int32_t width

◆ paragraphBuilder_addText()

SKWASM_EXPORT void paragraphBuilder_addText ( ParagraphBuilder builder,
std::u16string *  text 
)

Definition at line 35 of file paragraph_builder.cpp.

36 {
37 builder->addText(*text);
38}
std::u16string text

◆ paragraphBuilder_build()

SKWASM_EXPORT Paragraph * paragraphBuilder_build ( ParagraphBuilder builder)

Definition at line 56 of file paragraph_builder.cpp.

56 {
57 auto [words, graphemeBreaks, lineBreaks] = builder->getClientICUData();
58 auto text = builder->getText();
59 sk_sp<SkUnicode> clientICU =
60 SkUnicodes::Client::Make(text, words, graphemeBreaks, lineBreaks);
61 builder->SetUnicode(clientICU);
62 return builder->Build().release();
63}
SKUNICODE_API sk_sp< SkUnicode > Make(SkSpan< char > text, std::vector< SkUnicode::Position > words, std::vector< SkUnicode::Position > graphemeBreaks, std::vector< SkUnicode::LineBreakBefore > lineBreaks)

◆ paragraphBuilder_create()

SKWASM_EXPORT ParagraphBuilder * paragraphBuilder_create ( ParagraphStyle style,
FlutterFontCollection collection 
)

Definition at line 13 of file paragraph_builder.cpp.

15 {
16 return ParagraphBuilder::make(*style, collection->collection, nullptr)
17 .release();
18}
static void make(SkBitmap *bitmap, SkColorType colorType, SkAlphaType alphaType, sk_sp< SkColorSpace > colorSpace)
Definition: encode_srgb.cpp:35
sk_sp< skia::textlayout::FontCollection > collection
Definition: wrappers.h:33

◆ paragraphBuilder_dispose()

SKWASM_EXPORT void paragraphBuilder_dispose ( ParagraphBuilder builder)

Definition at line 20 of file paragraph_builder.cpp.

20 {
21 delete builder;
22}

◆ paragraphBuilder_getUtf8Text()

SKWASM_EXPORT char * paragraphBuilder_getUtf8Text ( ParagraphBuilder builder,
uint32_t *  outLength 
)

Definition at line 40 of file paragraph_builder.cpp.

41 {
42 auto span = builder->getText();
43 *outLength = span.size();
44 return span.data();
45}

◆ paragraphBuilder_pop()

SKWASM_EXPORT void paragraphBuilder_pop ( ParagraphBuilder builder)

Definition at line 52 of file paragraph_builder.cpp.

52 {
53 builder->pop();
54}

◆ paragraphBuilder_pushStyle()

SKWASM_EXPORT void paragraphBuilder_pushStyle ( ParagraphBuilder builder,
TextStyle style 
)

Definition at line 47 of file paragraph_builder.cpp.

48 {
49 builder->pushStyle(*style);
50}

◆ paragraphBuilder_setGraphemeBreaksUtf16()

SKWASM_EXPORT void paragraphBuilder_setGraphemeBreaksUtf16 ( ParagraphBuilder builder,
std::vector< SkUnicode::Position > *  breaks 
)

Definition at line 96 of file paragraph_builder.cpp.

98 {
99 builder->setGraphemeBreaksUtf16(std::move(*breaks));
100}

◆ paragraphBuilder_setLineBreaksUtf16()

SKWASM_EXPORT void paragraphBuilder_setLineBreaksUtf16 ( ParagraphBuilder builder,
std::vector< SkUnicode::LineBreakBefore > *  breaks 
)

Definition at line 108 of file paragraph_builder.cpp.

110 {
111 builder->setLineBreaksUtf16(std::move(*breaks));
112}

◆ paragraphBuilder_setWordBreaksUtf16()

SKWASM_EXPORT void paragraphBuilder_setWordBreaksUtf16 ( ParagraphBuilder builder,
std::vector< SkUnicode::Position > *  breaks 
)

Definition at line 102 of file paragraph_builder.cpp.

104 {
105 builder->setWordsUtf16(std::move(*breaks));
106}

◆ unicodePositionBuffer_create()

SKWASM_EXPORT std::vector< SkUnicode::Position > * unicodePositionBuffer_create ( size_t  length)

Definition at line 65 of file paragraph_builder.cpp.

66 {
67 return new std::vector<SkUnicode::Position>(length);
68}

◆ unicodePositionBuffer_free()

SKWASM_EXPORT void unicodePositionBuffer_free ( std::vector< SkUnicode::Position > *  buffer)

Definition at line 75 of file paragraph_builder.cpp.

76 {
77 delete buffer;
78}

◆ unicodePositionBuffer_getDataPointer()

SKWASM_EXPORT SkUnicode::Position * unicodePositionBuffer_getDataPointer ( std::vector< SkUnicode::Position > *  buffer)

Definition at line 70 of file paragraph_builder.cpp.

71 {
72 return buffer->data();
73}