| Flutter Impeller |

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_IMPELLER_TOOLKIT_INTEROP_PARAGRAPH_BUILDER_H_
6 #define FLUTTER_IMPELLER_TOOLKIT_INTEROP_PARAGRAPH_BUILDER_H_
7
8 #include <memory>
9
10 #include "flutter/third_party/txt/src/txt/paragraph_builder.h"
11 #include "impeller/toolkit/interop/impeller.h"
12 #include "impeller/toolkit/interop/object.h"
13 #include "impeller/toolkit/interop/paragraph.h"
14 #include "impeller/toolkit/interop/paragraph_style.h"
15 #include "impeller/toolkit/interop/typography_context.h"
16
17 namespace impeller::interop {
18
19 class ParagraphBuilder final
20 : public Object<ParagraphBuilder,
21 IMPELLER_INTERNAL_HANDLE_NAME(ImpellerParagraphBuilder)> {
22 public:
23 explicit ParagraphBuilder(const TypographyContext& context);
24
25 ~ParagraphBuilder() override;
26
27 ParagraphBuilder(const ParagraphBuilder&) = delete;
28
29 ParagraphBuilder& operator=(const ParagraphBuilder&) = delete;
30
31 bool IsValid() const;
32
33 void PushStyle(const ParagraphStyle& style);
34
35 void PopStyle();
36
37 void AddText(const uint8_t* data, size_t byte_length);
38
39 ScopedObject<Paragraph> Build(Scalar width) const;
40
41 private:
42 std::unique_ptr<txt::ParagraphBuilder> builder_;
43 };
44
45 } // namespace impeller::interop
46
47 #endif // FLUTTER_IMPELLER_TOOLKIT_INTEROP_PARAGRAPH_BUILDER_H_
impeller.h
impeller::interop::Object
Definition: object.h:56
paragraph.h
impeller::interop::ParagraphBuilder::~ParagraphBuilder
~ParagraphBuilder() override
impeller::Scalar
float Scalar
Definition: scalar.h:18
impeller::interop::ParagraphBuilder::AddText
void AddText(const uint8_t *data, size_t byte_length)
Definition: paragraph_builder.cc:42
impeller::interop::ScopedObject
Definition: object.h:67
data
std::shared_ptr< const fml::Mapping > data
Definition: texture_gles.cc:63
impeller::interop::ParagraphBuilder::operator=
ParagraphBuilder & operator=(const ParagraphBuilder &)=delete
impeller::interop::ParagraphBuilder::Build
ScopedObject< Paragraph > Build(Scalar width) const
Definition: paragraph_builder.cc:46
impeller::interop
Definition: color_filter.cc:7
impeller::interop::ParagraphBuilder::ParagraphBuilder
ParagraphBuilder(const TypographyContext &context)
Definition: paragraph_builder.cc:13
typography_context.h
impeller::interop::ParagraphBuilder::IsValid
bool IsValid() const
Definition: paragraph_builder.cc:30
impeller::interop::ParagraphStyle
Definition: paragraph_style.h:15
impeller::interop::TypographyContext
Definition: typography_context.h:16
impeller::interop::ParagraphBuilder::PushStyle
void PushStyle(const ParagraphStyle &style)
Definition: paragraph_builder.cc:34
impeller::interop::ParagraphBuilder
Definition: paragraph_builder.h:19
paragraph_style.h
object.h
impeller::interop::ParagraphBuilder::PopStyle
void PopStyle()
Definition: paragraph_builder.cc:38