5#include "third_party/skia/modules/skparagraph/include/Paragraph.h"
9#include "third_party/skia/include/core/SkScalar.h"
10#include "third_party/skia/modules/skparagraph/include/DartTypes.h"
11#include "third_party/skia/modules/skparagraph/include/TextStyle.h"
64 skia::textlayout::Affinity* out_affinity) {
65 auto position = paragraph->
skia_paragraph->getGlyphPositionAtCoordinate(
68 *out_affinity = position.affinity;
70 return position.position;
78 SkRect* grapheme_layout_bounds,
79 size_t* grapheme_code_unit_range,
80 bool* boolean_flags) {
81 skia::textlayout::Paragraph::GlyphInfo glyph_info;
82 if (!paragraph->
skia_paragraph->getClosestUTF16GlyphInfoAt(offset_x, offset_y,
88 std::memcpy(grapheme_layout_bounds, &glyph_info.fGraphemeLayoutBounds,
90 std::memcpy(grapheme_code_unit_range, &glyph_info.fGraphemeClusterTextRange,
93 glyph_info.fDirection == skia::textlayout::TextDirection::kLtr;
101 SkRect* grapheme_layout_bounds,
102 size_t* grapheme_code_unit_range,
103 bool* boolean_flags) {
104 skia::textlayout::Paragraph::GlyphInfo glyph_info;
109 std::memcpy(grapheme_layout_bounds, &glyph_info.fGraphemeLayoutBounds,
111 std::memcpy(grapheme_code_unit_range, &glyph_info.fGraphemeClusterTextRange,
114 glyph_info.fDirection == skia::textlayout::TextDirection::kLtr;
120 unsigned int position,
123 auto range = paragraph->
skia_paragraph->getWordBoundary(position);
124 out_range[0] = range.start;
125 out_range[1] = range.end;
133 size_t character_index) {
134 return paragraph->
skia_paragraph->getLineNumberAtUTF16Offset(character_index);
139 size_t line_number) {
141 auto metrics =
new skia::textlayout::LineMetrics();
142 if (paragraph->
skia_paragraph->getLineMetricsAt(line_number, metrics)) {
151 std::vector<skia::textlayout::TextBox>
boxes;
160 return list->
boxes.size();
165 const auto& box = list->
boxes[index];
166 *out_rect = box.rect;
167 return box.direction;
174 skia::textlayout::RectHeightStyle height_style,
175 skia::textlayout::RectWidthStyle width_style) {
178 start,
end, height_style, width_style)};
196 SkUnichar* out_code_points,
198 if (!out_code_points) {
204 if (out_index < out_length) {
uint32_t live_line_metrics_count
uint32_t live_text_box_list_count
uint32_t live_paragraph_count
SKWASM_EXPORT int paragraph_getLineNumberAt(Skwasm::Paragraph *paragraph, size_t character_index)
SKWASM_EXPORT bool paragraph_getGlyphInfoAt(Skwasm::Paragraph *paragraph, size_t index, SkRect *grapheme_layout_bounds, size_t *grapheme_code_unit_range, bool *boolean_flags)
SKWASM_EXPORT SkScalar paragraph_getLongestLine(Skwasm::Paragraph *paragraph)
SKWASM_EXPORT bool paragraph_getClosestGlyphInfoAtCoordinate(Skwasm::Paragraph *paragraph, SkScalar offset_x, SkScalar offset_y, SkRect *grapheme_layout_bounds, size_t *grapheme_code_unit_range, bool *boolean_flags)
SKWASM_EXPORT SkScalar paragraph_getWidth(Skwasm::Paragraph *paragraph)
SKWASM_EXPORT size_t paragraph_getLineCount(Skwasm::Paragraph *paragraph)
SKWASM_EXPORT SkScalar paragraph_getAlphabeticBaseline(Skwasm::Paragraph *paragraph)
SKWASM_EXPORT int paragraph_getUnresolvedCodePoints(Skwasm::Paragraph *paragraph, SkUnichar *out_code_points, int out_length)
SKWASM_EXPORT void paragraph_getWordBoundary(Skwasm::Paragraph *paragraph, unsigned int position, int32_t *out_range)
SKWASM_EXPORT TextBoxList * paragraph_getBoxesForRange(Skwasm::Paragraph *paragraph, int start, int end, skia::textlayout::RectHeightStyle height_style, skia::textlayout::RectWidthStyle width_style)
SKWASM_EXPORT TextBoxList * paragraph_getBoxesForPlaceholders(Skwasm::Paragraph *paragraph)
SKWASM_EXPORT size_t textBoxList_getLength(TextBoxList *list)
SKWASM_EXPORT skia::textlayout::LineMetrics * paragraph_getLineMetricsAtIndex(Skwasm::Paragraph *paragraph, size_t line_number)
SKWASM_EXPORT skia::textlayout::TextDirection textBoxList_getBoxAtIndex(TextBoxList *list, size_t index, SkRect *out_rect)
SKWASM_EXPORT SkScalar paragraph_getMinIntrinsicWidth(Skwasm::Paragraph *paragraph)
SKWASM_EXPORT SkScalar paragraph_getMaxIntrinsicWidth(Skwasm::Paragraph *paragraph)
SKWASM_EXPORT SkScalar paragraph_getIdeographicBaseline(Skwasm::Paragraph *paragraph)
SKWASM_EXPORT void textBoxList_dispose(TextBoxList *list)
SKWASM_EXPORT bool paragraph_getDidExceedMaxLines(Skwasm::Paragraph *paragraph)
SKWASM_EXPORT int32_t paragraph_getPositionForOffset(Skwasm::Paragraph *paragraph, SkScalar offset_x, SkScalar offset_y, skia::textlayout::Affinity *out_affinity)
SKWASM_EXPORT void paragraph_layout(Skwasm::Paragraph *paragraph, SkScalar width)
SKWASM_EXPORT void paragraph_dispose(Skwasm::Paragraph *paragraph)
SKWASM_EXPORT SkScalar paragraph_getHeight(Skwasm::Paragraph *paragraph)
std::unique_ptr< skia::textlayout::Paragraph > skia_paragraph
std::vector< skia::textlayout::TextBox > boxes