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_LIB_UI_TEXT_LINE_METRICS_H_
6#define FLUTTER_LIB_UI_TEXT_LINE_METRICS_H_
7
8#include "third_party/dart/runtime/include/dart_api.h"
9#include "third_party/tonic/converter/dart_converter.h"
10
11namespace flutter {
12
13struct LineMetrics {
14 const bool* hard_break;
15
16 // The final computed ascent and descent for the line. This can be impacted by
17 // the strut, height, scaling, as well as outlying runs that are very tall.
18 //
19 // The top edge is `baseline - ascent` and the bottom edge is `baseline +
20 // descent`. Ascent and descent are provided as positive numbers. Raw numbers
21 // for specific runs of text can be obtained in run_metrics_map. These values
22 // are the cumulative metrics for the entire line.
23 const double* ascent;
24 const double* descent;
25 const double* unscaled_ascent;
26 // Height of the line.
27 const double* height;
28 // Width of the line.
29 const double* width;
30 // The left edge of the line. The right edge can be obtained with `left +
31 // width`
32 const double* left;
33 // The y position of the baseline for this line from the top of the paragraph.
34 const double* baseline;
35 // Zero indexed line number.
36 const size_t* line_number;
37
38 LineMetrics();
39
40 LineMetrics(const bool* hard_break,
41 const double* ascent,
42 const double* descent,
43 const double* unscaled_ascent,
44 const double* height,
45 const double* width,
46 const double* left,
47 const double* baseline,
48 const size_t* line_number)
49 : hard_break(hard_break),
50 ascent(ascent),
51 descent(descent),
52 unscaled_ascent(unscaled_ascent),
53 height(height),
54 width(width),
55 left(left),
56 baseline(baseline),
57 line_number(line_number) {}
58};
59
60} // namespace flutter
61
62#endif // FLUTTER_LIB_UI_TEXT_LINE_METRICS_H_
63