| Flutter Impeller |

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_IMPELLER_TOOLKIT_INTEROP_PARAGRAPH_H_
6 #define FLUTTER_IMPELLER_TOOLKIT_INTEROP_PARAGRAPH_H_
7
8 #include "flutter/txt/src/txt/paragraph.h"
9 #include "impeller/toolkit/interop/glyph_info.h"
10 #include "impeller/toolkit/interop/impeller.h"
11 #include "impeller/toolkit/interop/line_metrics.h"
12 #include "impeller/toolkit/interop/object.h"
13
14 namespace impeller::interop {
15
16 /**
17 * An immutable fully laid out paragraph.
18 */
19 class Paragraph final
20 : public Object<Paragraph,
21 IMPELLER_INTERNAL_HANDLE_NAME(ImpellerParagraph)> {
22 public:
23 explicit Paragraph(std::unique_ptr<txt::Paragraph> paragraph);
24
25 ~Paragraph() override;
26
27 Paragraph(const Paragraph&) = delete;
28
29 Paragraph& operator=(const Paragraph&) = delete;
30
31 Scalar GetMaxWidth() const;
32
33 Scalar GetHeight() const;
34
35 Scalar GetLongestLineWidth() const;
36
37 Scalar GetMinIntrinsicWidth() const;
38
39 Scalar GetMaxIntrinsicWidth() const;
40
41 Scalar GetIdeographicBaseline() const;
42
43 Scalar GetAlphabeticBaseline() const;
44
45 uint32_t GetLineCount() const;
46
47 const std::unique_ptr<txt::Paragraph>& GetHandle() const;
48
49 ScopedObject<LineMetrics> GetLineMetrics() const;
50
51 ScopedObject<GlyphInfo> GetGlyphInfoAtCodeUnitIndex(
52 size_t code_unit_index) const;
53
54 ScopedObject<GlyphInfo> GetClosestGlyphInfoAtParagraphCoordinates(
55 double x,
56 double y) const;
57
58 ImpellerRange GetWordBoundary(size_t code_unit_index) const;
59
60 private:
61 std::unique_ptr<txt::Paragraph> paragraph_;
62 mutable ScopedObject<LineMetrics> lazy_line_metrics_;
63 };
64
65 } // namespace impeller::interop
66
67 #endif // FLUTTER_IMPELLER_TOOLKIT_INTEROP_PARAGRAPH_H_
impeller::interop::Object
Definition: object.h:56
impeller::interop::Paragraph
Definition: paragraph.h:21
impeller::interop::Paragraph::GetMaxWidth
Scalar GetMaxWidth() const
Definition: paragraph.cc:14
impeller::interop::Paragraph::GetLongestLineWidth
Scalar GetLongestLineWidth() const
Definition: paragraph.cc:22
impeller::interop::Paragraph::GetGlyphInfoAtCodeUnitIndex
ScopedObject< GlyphInfo > GetGlyphInfoAtCodeUnitIndex(size_t code_unit_index) const
Definition: paragraph.cc:61
impeller::interop::Paragraph::GetMinIntrinsicWidth
Scalar GetMinIntrinsicWidth() const
Definition: paragraph.cc:26
impeller::interop::Paragraph::GetHeight
Scalar GetHeight() const
Definition: paragraph.cc:18
impeller::interop::Paragraph::operator=
Paragraph & operator=(const Paragraph &)=delete
impeller::interop::Paragraph::GetWordBoundary
ImpellerRange GetWordBoundary(size_t code_unit_index) const
Definition: paragraph.cc:80
impeller::interop::Paragraph::GetLineCount
uint32_t GetLineCount() const
Definition: paragraph.cc:42
impeller::interop::Paragraph::GetIdeographicBaseline
Scalar GetIdeographicBaseline() const
Definition: paragraph.cc:34
impeller::interop::Paragraph::Paragraph
Paragraph(const Paragraph &)=delete
impeller::interop::Paragraph::Paragraph
Paragraph(std::unique_ptr< txt::Paragraph > paragraph)
Definition: paragraph.cc:9
impeller::interop::Paragraph::GetAlphabeticBaseline
Scalar GetAlphabeticBaseline() const
Definition: paragraph.cc:38
impeller::interop::Paragraph::~Paragraph
~Paragraph() override
impeller::interop::Paragraph::GetClosestGlyphInfoAtParagraphCoordinates
ScopedObject< GlyphInfo > GetClosestGlyphInfoAtParagraphCoordinates(double x, double y) const
Definition: paragraph.cc:70
impeller::interop::Paragraph::GetLineMetrics
ScopedObject< LineMetrics > GetLineMetrics() const
Definition: paragraph.cc:50
impeller::interop::Paragraph::GetMaxIntrinsicWidth
Scalar GetMaxIntrinsicWidth() const
Definition: paragraph.cc:30
impeller::interop::Paragraph::GetHandle
const std::unique_ptr< txt::Paragraph > & GetHandle() const
Definition: paragraph.cc:46
impeller::interop::ScopedObject
Definition: object.h:67
x
int32_t x
Definition: dl_golden_unittests.cc:458
glyph_info.h
impeller.h
line_metrics.h
impeller::interop
Definition: context_gles.cc:12
impeller::Scalar
float Scalar
Definition: scalar.h:19
object.h
ImpellerRange
Definition: impeller.h:524