Flutter Engine
 
Loading...
Searching...
No Matches
run_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_TXT_SRC_TXT_RUN_METRICS_H_
6#define FLUTTER_TXT_SRC_TXT_RUN_METRICS_H_
7
8#include "text_style.h"
9#include "third_party/skia/include/core/SkFontMetrics.h"
10
11namespace txt {
12
13// Contains the font metrics and TextStyle of a unique run.
15 public:
16 explicit RunMetrics(const TextStyle* style) : text_style(style) {}
17
18 RunMetrics(const TextStyle* style, const SkFontMetrics& metrics)
19 : text_style(style), font_metrics(metrics) {}
20
22
23 // SkFontMetrics contains the following metrics:
24 //
25 // * Top distance to reserve above baseline
26 // * Ascent distance to reserve below baseline
27 // * Descent extent below baseline
28 // * Bottom extent below baseline
29 // * Leading distance to add between lines
30 // * AvgCharWidth average character width
31 // * MaxCharWidth maximum character width
32 // * XMin minimum x
33 // * XMax maximum x
34 // * XHeight height of lower-case 'x'
35 // * CapHeight height of an upper-case letter
36 // * UnderlineThickness underline thickness
37 // * UnderlinePosition underline position relative to baseline
38 // * StrikeoutThickness strikeout thickness
39 // * StrikeoutPosition strikeout position relative to baseline
40 SkFontMetrics font_metrics;
41};
42
43} // namespace txt
44
45#endif // FLUTTER_TXT_SRC_TXT_RUN_METRICS_H_
RunMetrics(const TextStyle *style)
Definition run_metrics.h:16
SkFontMetrics font_metrics
Definition run_metrics.h:40
const TextStyle * text_style
Definition run_metrics.h:21
RunMetrics(const TextStyle *style, const SkFontMetrics &metrics)
Definition run_metrics.h:18