Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
third_party
skia
include
core
SkFontArguments.h
Go to the documentation of this file.
1
/*
2
* Copyright 2017 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 SkFontArguments_DEFINED
9
#define SkFontArguments_DEFINED
10
11
#include "
include/core/SkColor.h
"
12
#include "
include/core/SkScalar.h
"
13
#include "
include/core/SkTypes.h
"
14
15
/** Represents a set of actual arguments for a font. */
16
struct
SkFontArguments
{
17
struct
VariationPosition
{
18
struct
Coordinate
{
19
SkFourByteTag
axis
;
20
float
value
;
21
};
22
const
Coordinate
*
coordinates
;
23
int
coordinateCount
;
24
};
25
26
/** Specify a palette to use and overrides for palette entries.
27
*
28
* `overrides` is a list of pairs of palette entry index and color.
29
* The overriden palette entries will use the associated color.
30
* Override pairs with palette entry indices out of range will not be applied.
31
* Later override entries override earlier ones.
32
*/
33
struct
Palette
{
34
struct
Override
{
35
uint16_t
index
;
36
SkColor
color
;
37
};
38
int
index
;
39
const
Override
*
overrides
;
40
int
overrideCount
;
41
};
42
43
SkFontArguments
()
44
: fCollectionIndex(0)
45
, fVariationDesignPosition{nullptr, 0}
46
, fPalette{0, nullptr, 0} {}
47
48
/** Specify the index of the desired font.
49
*
50
* Font formats like ttc, dfont, cff, cid, pfr, t42, t1, and fon may actually be indexed
51
* collections of fonts.
52
*/
53
SkFontArguments
&
setCollectionIndex
(
int
collectionIndex) {
54
fCollectionIndex = collectionIndex;
55
return
*
this
;
56
}
57
58
/** Specify a position in the variation design space.
59
*
60
* Any axis not specified will use the default value.
61
* Any specified axis not actually present in the font will be ignored.
62
*
63
* @param position not copied. The value must remain valid for life of SkFontArguments.
64
*/
65
SkFontArguments
&
setVariationDesignPosition
(
VariationPosition
position) {
66
fVariationDesignPosition.
coordinates
= position.
coordinates
;
67
fVariationDesignPosition.
coordinateCount
= position.
coordinateCount
;
68
return
*
this
;
69
}
70
71
int
getCollectionIndex
()
const
{
72
return
fCollectionIndex;
73
}
74
75
VariationPosition
getVariationDesignPosition
()
const
{
76
return
fVariationDesignPosition;
77
}
78
79
SkFontArguments
&
setPalette
(
Palette
palette) {
80
fPalette.
index
= palette.
index
;
81
fPalette.
overrides
= palette.
overrides
;
82
fPalette.
overrideCount
= palette.
overrideCount
;
83
return
*
this
;
84
}
85
86
Palette
getPalette
()
const
{
return
fPalette; }
87
88
private
:
89
int
fCollectionIndex;
90
VariationPosition fVariationDesignPosition;
91
Palette fPalette;
92
};
93
94
#endif
SkColor.h
SkColor
uint32_t SkColor
Definition
SkColor.h:37
SkScalar.h
SkTypes.h
SkFourByteTag
uint32_t SkFourByteTag
Definition
SkTypes.h:166
SkFontArguments::Palette::Override
Definition
SkFontArguments.h:34
SkFontArguments::Palette::Override::color
SkColor color
Definition
SkFontArguments.h:36
SkFontArguments::Palette::Override::index
uint16_t index
Definition
SkFontArguments.h:35
SkFontArguments::Palette
Definition
SkFontArguments.h:33
SkFontArguments::Palette::index
int index
Definition
SkFontArguments.h:38
SkFontArguments::Palette::overrides
const Override * overrides
Definition
SkFontArguments.h:39
SkFontArguments::Palette::overrideCount
int overrideCount
Definition
SkFontArguments.h:40
SkFontArguments::VariationPosition::Coordinate
Definition
SkFontArguments.h:18
SkFontArguments::VariationPosition::Coordinate::value
float value
Definition
SkFontArguments.h:20
SkFontArguments::VariationPosition::Coordinate::axis
SkFourByteTag axis
Definition
SkFontArguments.h:19
SkFontArguments::VariationPosition
Definition
SkFontArguments.h:17
SkFontArguments::VariationPosition::coordinates
const Coordinate * coordinates
Definition
SkFontArguments.h:22
SkFontArguments::VariationPosition::coordinateCount
int coordinateCount
Definition
SkFontArguments.h:23
SkFontArguments
Definition
SkFontArguments.h:16
SkFontArguments::setCollectionIndex
SkFontArguments & setCollectionIndex(int collectionIndex)
Definition
SkFontArguments.h:53
SkFontArguments::setVariationDesignPosition
SkFontArguments & setVariationDesignPosition(VariationPosition position)
Definition
SkFontArguments.h:65
SkFontArguments::setPalette
SkFontArguments & setPalette(Palette palette)
Definition
SkFontArguments.h:79
SkFontArguments::SkFontArguments
SkFontArguments()
Definition
SkFontArguments.h:43
SkFontArguments::getVariationDesignPosition
VariationPosition getVariationDesignPosition() const
Definition
SkFontArguments.h:75
SkFontArguments::getPalette
Palette getPalette() const
Definition
SkFontArguments.h:86
SkFontArguments::getCollectionIndex
int getCollectionIndex() const
Definition
SkFontArguments.h:71
Generated on Fri Apr 26 2024 06:16:10 for Flutter Engine by
1.9.8