Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
paragraph_builder.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_BUILDER_H_
6#define FLUTTER_LIB_UI_TEXT_PARAGRAPH_BUILDER_H_
7
8#include <memory>
9
10#include "flutter/lib/ui/dart_wrapper.h"
11#include "flutter/lib/ui/painting/paint.h"
12#include "flutter/lib/ui/text/paragraph.h"
13#include "flutter/third_party/txt/src/txt/paragraph_builder.h"
15
16namespace flutter {
17
18class Paragraph;
19
20class ParagraphBuilder : public RefCountedDartWrappable<ParagraphBuilder> {
21 DEFINE_WRAPPERTYPEINFO();
23
24 public:
25 static void Create(Dart_Handle wrapper,
26 Dart_Handle encoded_handle,
27 Dart_Handle strutData,
28 const std::string& fontFamily,
29 const std::vector<std::string>& strutFontFamilies,
30 double fontSize,
31 double height,
32 const std::u16string& ellipsis,
33 const std::string& locale);
34
36
37 void pushStyle(const tonic::Int32List& encoded,
38 const std::vector<std::string>& fontFamilies,
39 double fontSize,
40 double letterSpacing,
41 double wordSpacing,
42 double height,
43 double decorationThickness,
44 const std::string& locale,
45 Dart_Handle background_objects,
46 Dart_Handle background_data,
47 Dart_Handle foreground_objects,
48 Dart_Handle foreground_data,
49 Dart_Handle shadows_data,
50 Dart_Handle font_features_data,
51 Dart_Handle font_variations_data);
52
53 void pop();
54
55 Dart_Handle addText(const std::u16string& text);
56
57 // Pushes the information required to leave an open space, where Flutter may
58 // draw a custom placeholder into.
59 //
60 // Internally, this method adds a single object replacement character (0xFFFC)
61 // and emplaces a new PlaceholderRun instance to the vector of inline
62 // placeholders.
63 void addPlaceholder(double width,
64 double height,
65 unsigned alignment,
66 double baseline_offset,
67 unsigned baseline);
68
69 void build(Dart_Handle paragraph_handle);
70
71 private:
72 explicit ParagraphBuilder(Dart_Handle encoded,
73 Dart_Handle strutData,
74 const std::string& fontFamily,
75 const std::vector<std::string>& strutFontFamilies,
76 double fontSize,
77 double height,
78 const std::u16string& ellipsis,
79 const std::string& locale);
80
81 std::unique_ptr<txt::ParagraphBuilder> m_paragraph_builder_;
82};
83
84} // namespace flutter
85
86#endif // FLUTTER_LIB_UI_TEXT_PARAGRAPH_BUILDER_H_
static sk_sp< Effect > Create()
void pushStyle(const tonic::Int32List &encoded, const std::vector< std::string > &fontFamilies, double fontSize, double letterSpacing, double wordSpacing, double height, double decorationThickness, const std::string &locale, Dart_Handle background_objects, Dart_Handle background_data, Dart_Handle foreground_objects, Dart_Handle foreground_data, Dart_Handle shadows_data, Dart_Handle font_features_data, Dart_Handle font_variations_data)
void addPlaceholder(double width, double height, unsigned alignment, double baseline_offset, unsigned baseline)
Dart_Handle addText(const std::u16string &text)
struct _Dart_Handle * Dart_Handle
Definition dart_api.h:258
std::u16string text
Definition build.py:1
#define FML_FRIEND_MAKE_REF_COUNTED(T)
int32_t height
int32_t width