Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
SkAdvancedTypefaceMetrics.h
Go to the documentation of this file.
1/*
2 * Copyright 2011 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#ifndef SkAdvancedTypefaceMetrics_DEFINED
9#define SkAdvancedTypefaceMetrics_DEFINED
10
11#include "include/core/SkRect.h"
13#include "src/base/SkBitmaskEnum.h" // IWYU pragma: keep
14
15#include <cstdint>
16#include <type_traits>
17
18/** \class SkAdvancedTypefaceMetrics
19
20 The SkAdvancedTypefaceMetrics class is used by the PDF backend to correctly
21 embed typefaces. This class is created and filled in with information by
22 SkTypeface::getAdvancedMetrics.
23*/
25 // The PostScript name of the font. See `FontName` and `BaseFont` in PDF standard.
27
28 // These enum values match the values used in the PDF file format.
29 enum StyleFlags : uint32_t {
30 kFixedPitch_Style = 0x00000001,
31 kSerif_Style = 0x00000002,
32 kScript_Style = 0x00000008,
33 kItalic_Style = 0x00000040,
34 kAllCaps_Style = 0x00010000,
35 kSmallCaps_Style = 0x00020000,
36 kForceBold_Style = 0x00040000
37 };
38 StyleFlags fStyle = (StyleFlags)0; // Font style characteristics.
39
47 // The type of the underlying font program. This field determines which
48 // of the following fields are valid. If it is kOther_Font the per glyph
49 // information will never be populated.
51
52 enum FontFlags : uint8_t {
53 kVariable_FontFlag = 1 << 0, //!<May be true for Type1, CFF, or TrueType fonts.
54 kNotEmbeddable_FontFlag = 1 << 1, //!<May not be embedded.
55 kNotSubsettable_FontFlag = 1 << 2, //!<May not be subset.
56 kAltDataFormat_FontFlag = 1 << 3, //!<Data compressed. Table access may still work.
57 };
58 FontFlags fFlags = (FontFlags)0; // Global font flags.
59
60 int16_t fItalicAngle = 0; // Counterclockwise degrees from vertical of the
61 // dominant vertical stroke for an Italic face.
62 // The following fields are all in font units.
63 int16_t fAscent = 0; // Max height above baseline, not including accents.
64 int16_t fDescent = 0; // Max depth below baseline (negative).
65 int16_t fStemV = 0; // Thickness of dominant vertical stem.
66 int16_t fCapHeight = 0; // Height (from baseline) of top of flat capitals.
67
68 SkIRect fBBox = {0, 0, 0, 0}; // The bounding box of all glyphs (in font units).
69};
70
71namespace sknonstd {
72template <> struct is_bitmask_enum<SkAdvancedTypefaceMetrics::FontFlags> : std::true_type {};
73template <> struct is_bitmask_enum<SkAdvancedTypefaceMetrics::StyleFlags> : std::true_type {};
74} // namespace sknonstd
75
76#endif
@ kNotEmbeddable_FontFlag
May not be embedded.
@ kAltDataFormat_FontFlag
Data compressed. Table access may still work.
@ kNotSubsettable_FontFlag
May not be subset.
@ kVariable_FontFlag
May be true for Type1, CFF, or TrueType fonts.