Flutter Engine
 
Loading...
Searching...
No Matches
line_metrics.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_LINE_METRICS_H_
6#define FLUTTER_IMPELLER_TOOLKIT_INTEROP_LINE_METRICS_H_
7
8#include <map>
9
13
14namespace impeller::interop {
15
16//------------------------------------------------------------------------------
17/// @brief Internal C++ peer of ImpellerLineMetrics. For detailed
18/// documentation, refer to the headerdocs in the public API in
19/// impeller.h.
20///
21/// Accessing metrics of missing lines returns default initialized
22/// values.
23///
24class LineMetrics final
25 : public Object<LineMetrics,
26 IMPELLER_INTERNAL_HANDLE_NAME(ImpellerLineMetrics)> {
27 public:
28 explicit LineMetrics(const std::vector<txt::LineMetrics>& metrics);
29
31
32 LineMetrics(const LineMetrics&) = delete;
33
35
36 //----------------------------------------------------------------------------
37 /// @see ImpellerLineMetricsGetAscent.
38 ///
39 double GetAscent(size_t line) const;
40
41 //----------------------------------------------------------------------------
42 /// @see ImpellerLineMetricsGetUnscaledAscent.
43 ///
44 double GetUnscaledAscent(size_t line) const;
45
46 //----------------------------------------------------------------------------
47 /// @see ImpellerLineMetricsGetDescent.
48 ///
49 double GetDescent(size_t line) const;
50
51 //----------------------------------------------------------------------------
52 /// @see ImpellerLineMetricsGetBaseline.
53 ///
54 double GetBaseline(size_t line) const;
55
56 //----------------------------------------------------------------------------
57 /// @see ImpellerLineMetricsIsHardbreak.
58 ///
59 bool IsHardbreak(size_t line) const;
60
61 //----------------------------------------------------------------------------
62 /// @see ImpellerLineMetricsGetWidth.
63 ///
64 double GetWidth(size_t line) const;
65
66 //----------------------------------------------------------------------------
67 /// @see ImpellerLineMetricsGetHeight.
68 ///
69 double GetHeight(size_t line) const;
70
71 //----------------------------------------------------------------------------
72 /// @see ImpellerLineMetricsGetLeft.
73 ///
74 double GetLeft(size_t line) const;
75
76 //----------------------------------------------------------------------------
77 /// @see ImpellerLineMetricsGetCodeUnitStartIndex.
78 ///
79 size_t GetCodeUnitStartIndex(size_t line) const;
80
81 //----------------------------------------------------------------------------
82 /// @see ImpellerLineMetricsGetCodeUnitEndIndex.
83 ///
84 size_t GetCodeUnitEndIndex(size_t line) const;
85
86 //----------------------------------------------------------------------------
87 /// @see ImpellerLineMetricsGetCodeUnitEndIndexExcludingWhitespace.
88 ///
89 size_t GetCodeUnitEndIndexExcludingWhitespace(size_t line) const;
90
91 //----------------------------------------------------------------------------
92 /// @see ImpellerLineMetricsGetCodeUnitEndIndexIncludingNewline.
93 ///
94 size_t GetCodeUnitEndIndexIncludingNewline(size_t line) const;
95
96 private:
97 std::map<size_t /* line number */, txt::LineMetrics> metrics_;
98
99 const txt::LineMetrics& GetLine(size_t line) const;
100};
101
102} // namespace impeller::interop
103
104#endif // FLUTTER_IMPELLER_TOOLKIT_INTEROP_LINE_METRICS_H_
Internal C++ peer of ImpellerLineMetrics. For detailed documentation, refer to the headerdocs in the ...
double GetLeft(size_t line) const
size_t GetCodeUnitStartIndex(size_t line) const
double GetBaseline(size_t line) const
double GetUnscaledAscent(size_t line) const
size_t GetCodeUnitEndIndexIncludingNewline(size_t line) const
double GetWidth(size_t line) const
double GetAscent(size_t line) const
bool IsHardbreak(size_t line) const
double GetHeight(size_t line) const
size_t GetCodeUnitEndIndex(size_t line) const
LineMetrics & operator=(const LineMetrics &)=delete
size_t GetCodeUnitEndIndexExcludingWhitespace(size_t line) const
LineMetrics(const LineMetrics &)=delete
double GetDescent(size_t line) const