Flutter Engine
The Flutter Engine
paragraph.h
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef FLUTTER_LIB_UI_TEXT_PARAGRAPH_H_
6#define FLUTTER_LIB_UI_TEXT_PARAGRAPH_H_
7
8#include "flutter/fml/message_loop.h"
9#include "flutter/lib/ui/dart_wrapper.h"
10#include "flutter/lib/ui/painting/canvas.h"
11#include "flutter/third_party/txt/src/txt/paragraph.h"
12
13namespace flutter {
14
15class Paragraph : public RefCountedDartWrappable<Paragraph> {
16 DEFINE_WRAPPERTYPEINFO();
17 FML_FRIEND_MAKE_REF_COUNTED(Paragraph);
18
19 public:
20 static void Create(Dart_Handle paragraph_handle,
21 std::unique_ptr<txt::Paragraph> txt_paragraph) {
22 auto paragraph = fml::MakeRefCounted<Paragraph>(std::move(txt_paragraph));
23 paragraph->AssociateWithDartWrapper(paragraph_handle);
24 }
25
26 ~Paragraph() override;
27
28 double width();
29 double height();
30 double longestLine();
31 double minIntrinsicWidth();
32 double maxIntrinsicWidth();
33 double alphabeticBaseline();
34 double ideographicBaseline();
35 bool didExceedMaxLines();
36
37 void layout(double width);
38 void paint(Canvas* canvas, double x, double y);
39
40 tonic::Float32List getRectsForRange(unsigned start,
41 unsigned end,
42 unsigned boxHeightStyle,
43 unsigned boxWidthStyle);
44 tonic::Float32List getRectsForPlaceholders();
45 Dart_Handle getPositionForOffset(double dx, double dy);
46 Dart_Handle getGlyphInfoAt(unsigned utf16Offset,
47 Dart_Handle constructor) const;
49 double dy,
50 Dart_Handle constructor) const;
53 tonic::Float64List computeLineMetrics() const;
54 Dart_Handle getLineMetricsAt(int lineNumber, Dart_Handle constructor) const;
55 size_t getNumberOfLines() const;
56 int getLineNumberAt(size_t utf16Offset) const;
57
58 void dispose();
59
60 private:
61 std::unique_ptr<txt::Paragraph> m_paragraph_;
62
63 explicit Paragraph(std::unique_ptr<txt::Paragraph> paragraph);
64};
65
66} // namespace flutter
67
68#endif // FLUTTER_LIB_UI_TEXT_PARAGRAPH_H_
Dart_Handle getLineBoundary(unsigned offset)
Definition: paragraph.cc:172
static void Create(Dart_Handle paragraph_handle, std::unique_ptr< txt::Paragraph > txt_paragraph)
Definition: paragraph.h:20
tonic::Float32List getRectsForPlaceholders()
Definition: paragraph.cc:107
tonic::Float32List getRectsForRange(unsigned start, unsigned end, unsigned boxHeightStyle, unsigned boxWidthStyle)
Definition: paragraph.cc:97
Dart_Handle getGlyphInfoAt(unsigned utf16Offset, Dart_Handle constructor) const
Definition: paragraph.cc:139
size_t getNumberOfLines() const
Definition: paragraph.cc:243
Dart_Handle getPositionForOffset(double dx, double dy)
Definition: paragraph.cc:113
void paint(Canvas *canvas, double x, double y)
Definition: paragraph.cc:65
double alphabeticBaseline()
Definition: paragraph.cc:49
tonic::Float64List computeLineMetrics() const
Definition: paragraph.cc:187
double maxIntrinsicWidth()
Definition: paragraph.cc:45
bool didExceedMaxLines()
Definition: paragraph.cc:57
double longestLine()
Definition: paragraph.cc:37
double ideographicBaseline()
Definition: paragraph.cc:53
void layout(double width)
Definition: paragraph.cc:61
Dart_Handle getWordBoundary(unsigned offset)
Definition: paragraph.cc:165
double minIntrinsicWidth()
Definition: paragraph.cc:41
~Paragraph() override
Dart_Handle getClosestGlyphInfo(double dx, double dy, Dart_Handle constructor) const
Definition: paragraph.cc:151
Dart_Handle getLineMetricsAt(int lineNumber, Dart_Handle constructor) const
Definition: paragraph.cc:215
int getLineNumberAt(size_t utf16Offset) const
Definition: paragraph.cc:247
struct _Dart_Handle * Dart_Handle
Definition: dart_api.h:258
double y
double x
skia_private::AutoTArray< sk_sp< SkImageFilter > > filters TypedMatrix matrix TypedMatrix matrix SkScalar dx
Definition: SkRecords.h:208
SeparatedVector2 offset