30 {
31 auto makeSystemFont = [](
float size) -> CTFontRef {
32
33 return CTFontCreateUIFontForLanguage(kCTFontUIFontSystem,
size,
nullptr);
34 };
35
38 buffer[0] = (tag & 0xff000000) >> 24;
39 buffer[1] = (tag & 0xff0000) >> 16;
40 buffer[2] = (tag & 0xff00) >> 8;
43 return std::string(
buffer);
44 };
45
46
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62 if (!typeface) {
64 return;
65 }
68
69 const int originalPositionCount = typeface->getVariationDesignPosition(nullptr, 0);
70 std::vector<Coordinate> originalPosition(originalPositionCount);
71 const int retrievedOriginalPositionCount =
72 typeface->getVariationDesignPosition(originalPosition.data(), originalPosition.size());
73 if (!(retrievedOriginalPositionCount == originalPositionCount)) {
75 return;
76 }
77
82
84 for (auto& originalCoordinate : originalPosition) {
85 SkMaybeDebugf(
"(%s: %f) ", tagToString(originalCoordinate.axis).c_str(),
86 originalCoordinate.value);
87 }
89
90 const int originalAxisCount = typeface->getVariationDesignParameters(nullptr, 0);
91 std::vector<Axis> originalAxes(originalAxisCount);
92 const int returnedOriginalAxisCount =
93 typeface->getVariationDesignParameters(originalAxes.data(), originalAxes.size());
94 if (!(returnedOriginalAxisCount == originalAxisCount)) {
96 return;
97 }
98
99 for (bool omitOpsz : {false, true}) {
100 for (
SkFourByteTag axisToBump : { 0u, kOpszTag, kWdthTag, kGRADTag }) {
101 for (float testCoordinate : {100, 300, 400, 500, 700, 900}) {
102 std::vector<Coordinate> expectedPosition;
103 std::vector<Coordinate> requestPosition;
105 for (auto& originalCoordinate : originalPosition) {
106 float requestValue = originalCoordinate.value;
107 if (originalCoordinate.axis == kOpszTag && omitOpsz) {
108 SkMaybeDebugf(
"#%s: %f# ", tagToString(originalCoordinate.axis).c_str(),
109 requestValue);
110 } else {
111 if (originalCoordinate.axis == axisToBump) {
112
113
114
115 requestValue += requestValue / 1024.0f;
116 }
117 if (originalCoordinate.axis == kWghtTag) {
118 requestValue = testCoordinate;
119 }
120 SkMaybeDebugf(
"(%s: %f) ", tagToString(originalCoordinate.axis).c_str(),
121 requestValue);
122 requestPosition.push_back({originalCoordinate.axis, requestValue});
123 }
124
125 float expectedValue = requestValue;
126 for (auto& originalAxis : originalAxes) {
127 if (originalAxis.tag == originalCoordinate.axis) {
128 expectedValue =
std::min(expectedValue, originalAxis.max);
129 expectedValue =
std::max(expectedValue, originalAxis.min);
130 }
131 }
132 expectedPosition.push_back({originalCoordinate.axis, expectedValue});
133 }
135
137 for (auto& expectedCoordinate : expectedPosition) {
138 SkMaybeDebugf(
"(%s: %f) ", tagToString(expectedCoordinate.axis).c_str(),
139 expectedCoordinate.value);
140 }
142
144 { requestPosition.data(), (
int)requestPosition.size() };
146 typeface->makeClone(
SkFontArguments().setVariationDesignPosition(variationPosition)));
147
148 const int cloneAxisCount = cloneTypeface->getVariationDesignPosition(nullptr, 0);
149 std::vector<Coordinate> clonePosition(cloneAxisCount);
150 const int retrievedCloneAxisCount =
151 cloneTypeface->getVariationDesignPosition(clonePosition.data(), clonePosition.size());
152 if (!(retrievedCloneAxisCount == cloneAxisCount)) {
154 continue;
155 }
156
158 for (auto& cloneCoordinate : clonePosition) {
159 SkMaybeDebugf(
"(%s: %f) ", tagToString(cloneCoordinate.axis).c_str(),
160 cloneCoordinate.value);
161 }
163
164 if (clonePosition.size() != expectedPosition.size()) {
166 continue;
167 }
168
169 auto compareCoordinate = [](
const Coordinate&
a,
const Coordinate&
b) ->
bool {
170 return a.axis <
b.axis;
171 };
172 std::sort(clonePosition.begin(), clonePosition.end(), compareCoordinate);
173 std::sort(expectedPosition.begin(), expectedPosition.end(), compareCoordinate);
174 for (
const auto&& [clone, expected] :
SkMakeZip(clonePosition, expectedPosition)) {
177 }
178
180 }
181 }
182 }
183}
static std::vector< SkPDFIndirectReference > sort(const THashSet< SkPDFIndirectReference > &src)
static constexpr SkFourByteTag SkSetFourByteTag(char a, char b, char c, char d)
constexpr auto SkMakeZip(Ts &&... ts)
#define REPORTER_ASSERT(r, cond,...)
static void SkMaybeDebugf(const char format[],...)
static float max(float r, float g, float b)
static float min(float r, float g, float b)
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size