Flutter Engine
 
Loading...
Searching...
No Matches
placeholder_run.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_TXT_SRC_TXT_PLACEHOLDER_RUN_H_
6#define FLUTTER_TXT_SRC_TXT_PLACEHOLDER_RUN_H_
7
8#include "text_baseline.h"
9
10namespace txt {
11
12/// Where to vertically align the placeholder relative to the surrounding text.
14 /// Match the baseline of the placeholder with the baseline.
16
17 /// Align the bottom edge of the placeholder with the baseline such that the
18 /// placeholder sits on top of the baseline.
20
21 /// Align the top edge of the placeholder with the baseline specified in
22 /// such that the placeholder hangs below the baseline.
24
25 /// Align the top edge of the placeholder with the top edge of the font.
26 /// When the placeholder is very tall, the extra space will hang from
27 /// the top and extend through the bottom of the line.
28 kTop,
29
30 /// Align the bottom edge of the placeholder with the top edge of the font.
31 /// When the placeholder is very tall, the extra space will rise from
32 /// the bottom and extend through the top of the line.
33 kBottom,
34
35 /// Align the middle of the placeholder with the middle of the text. When the
36 /// placeholder is very tall, the extra space will grow equally from
37 /// the top and bottom of the line.
38 kMiddle,
39};
40
41// Represents the metrics required to fully define a rect that will fit a
42// placeholder.
43//
44// LibTxt will leave an empty space in the layout of the text of the size
45// defined by this class. After layout, the framework will draw placeholders
46// into the reserved space.
48 public:
49 double width = 0;
50 double height = 0;
51
53
55
56 // Distance from the top edge of the rect to the baseline position. This
57 // baseline will be aligned against the alphabetic baseline of the surrounding
58 // text.
59 //
60 // Positive values drop the baseline lower (positions the rect higher) and
61 // small or negative values will cause the rect to be positioned underneath
62 // the line. When baseline == height, the bottom edge of the rect will rest on
63 // the alphabetic baseline.
64 double baseline_offset = 0;
65
67
68 PlaceholderRun(double width,
69 double height,
72 double baseline_offset);
73};
74
75} // namespace txt
76
77#endif // FLUTTER_TXT_SRC_TXT_PLACEHOLDER_RUN_H_
PlaceholderAlignment alignment
PlaceholderAlignment
Where to vertically align the placeholder relative to the surrounding text.
@ kBaseline
Match the baseline of the placeholder with the baseline.