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"
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 
36 
38 
40 
42 
44 
45  uint32_t GetLineCount() const;
46 
47  const std::unique_ptr<txt::Paragraph>& GetHandle() const;
48 
50 
52  size_t code_unit_index) const;
53 
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_
Scalar GetMaxWidth() const
Definition: paragraph.cc:14
Scalar GetLongestLineWidth() const
Definition: paragraph.cc:22
ScopedObject< GlyphInfo > GetGlyphInfoAtCodeUnitIndex(size_t code_unit_index) const
Definition: paragraph.cc:61
Scalar GetMinIntrinsicWidth() const
Definition: paragraph.cc:26
Scalar GetHeight() const
Definition: paragraph.cc:18
Paragraph & operator=(const Paragraph &)=delete
ImpellerRange GetWordBoundary(size_t code_unit_index) const
Definition: paragraph.cc:80
uint32_t GetLineCount() const
Definition: paragraph.cc:42
Scalar GetIdeographicBaseline() const
Definition: paragraph.cc:34
Paragraph(const Paragraph &)=delete
Paragraph(std::unique_ptr< txt::Paragraph > paragraph)
Definition: paragraph.cc:9
Scalar GetAlphabeticBaseline() const
Definition: paragraph.cc:38
ScopedObject< GlyphInfo > GetClosestGlyphInfoAtParagraphCoordinates(double x, double y) const
Definition: paragraph.cc:70
ScopedObject< LineMetrics > GetLineMetrics() const
Definition: paragraph.cc:50
Scalar GetMaxIntrinsicWidth() const
Definition: paragraph.cc:30
const std::unique_ptr< txt::Paragraph > & GetHandle() const
Definition: paragraph.cc:46
int32_t x
float Scalar
Definition: scalar.h:19