50 if (!
data->unique()) {
57 SkTAfter<SkSFNTHeader::TableDirectoryEntry>(sfntHeader);
60 for (
int tableEntryIndex = 0; tableEntryIndex < numTables; ++tableEntryIndex) {
62 os2TableEntry = tableEntry + tableEntryIndex;
69 SkOTTableOS2_V0* os2Table = SkTAddOffset<SkOTTableOS2_V0>(sfntHeader, os2TableOffset);
89 newStyle.
weight() == weight ||
90 (weight <= 10 && newStyle.
weight() == 100 * weight) ||
91 (weight == 4 && newStyle.
weight() == 350) ||
92 (weight == 5 && newStyle.
weight() == 400) ||
93 (weight == 0 && newStyle.
weight() == 1) ||
94 (weight == 1000 && newStyle.
weight() == 999)
100 newStyle.
width() ==
width || newStyle.
width() == SkFontStyle::Width::kNormal_Width,
101 "newStyle.width(): %d width: %" PRIu16, newStyle.
width(),
width);
112 for (
int weight = SkFS::kInvisible_Weight; weight <= SkFS::kExtraBlack_Weight; ++weight) {
115 for (
int width = SkFS::kUltraCondensed_Width;
width <= SkFS::kUltraExpanded_Width; ++
width) {
141 Variation::Coordinate varPos[2];
155 std::vector<Variation::Coordinate> position;
183 static const constexpr bool isMac =
184#if defined(SK_BUILD_FOR_MAC)
190 args.setVariationDesignPosition(Variation{
test.position.data(), (
int)
test.position.size()});
243 desc.setStyle(style);
244 const char postscriptName[] =
"postscript";
245 desc.setPostscriptName(postscriptName);
247 variation[0] = { 0, -1.0f };
272 auto test = [&](
SkTypeface* typeface,
const Variation& expected,
int alsoAcceptedAxisTagCount) {
278 if (actualCount == -1) {
282 actualCount == alsoAcceptedAxisTagCount);
287 std::unique_ptr<Variation::Coordinate[]> actual(
new Variation::Coordinate[actualCount]);
289 if (actualCount == -1) {
293 actualCount == alsoAcceptedAxisTagCount);
296 std::unique_ptr<bool[]> expectedUsed(
new bool[expected.coordinateCount]());
297 for (
int actualIdx = 0; actualIdx < actualCount; ++actualIdx) {
298 bool actualFound =
false;
299 for (
int expectedIdx = 0; expectedIdx < expected.coordinateCount; ++expectedIdx) {
300 if (expectedUsed[expectedIdx]) {
304 if (actual[actualIdx].axis != expected.coordinates[expectedIdx].axis) {
311 if (!(
SkTAbs(fixedRead - fixedOriginal) < 2)) {
317 expectedUsed[expectedIdx] =
true;
321 "Actual axis '%c%c%c%c' with value '%f' not expected",
322 (
char)((actual[actualIdx].axis >> 24) & 0xFF),
323 (
char)((actual[actualIdx].axis >> 16) & 0xFF),
324 (
char)((actual[actualIdx].axis >> 8) & 0xFF),
325 (
char)((actual[actualIdx].axis ) & 0xFF),
339 const Variation::Coordinate defaultPosition[] = {
344 test(typeface.
get(), Variation{&defaultPosition[0], 2}, -1);
357 const Variation::Coordinate position[] = {
365 test(typeface.
get(), Variation{&position[1], 2}, 1);
378 const Variation::Coordinate position[] = {
385 test(typeface.
get(), Variation{&position[1], 1}, -1);
390 test(clone.
get(), Variation{&position[1], 1}, -1);
405 params.setCollectionIndex(0x00010000);
430 "positionRead[0].value: %f", positionRead[0].
value);
456 auto test = [&](
SkTypeface* typeface,
const Axis* expected,
int expectedCount,
457 int alsoAcceptedAxisTagCount)
464 if (actualCount == -1) {
468 actualCount == alsoAcceptedAxisTagCount);
470 std::unique_ptr<Axis[]> actual(
new Axis[actualCount]);
472 if (actualCount == -1) {
476 actualCount == alsoAcceptedAxisTagCount);
479 std::unique_ptr<bool[]> expectedUsed(
new bool[expectedCount]());
480 for (
int actualIdx = 0; actualIdx < actualCount; ++actualIdx) {
481 bool actualFound =
false;
482 for (
int expectedIdx = 0; expectedIdx < expectedCount; ++expectedIdx) {
483 if (expectedUsed[expectedIdx]) {
487 if (actual[actualIdx].tag != expected[expectedIdx].tag) {
494 if (!(
SkTAbs(fixedActualMin - fixedExpectedMin) < 2)) {
500 if (!(
SkTAbs(fixedActualMax - fixedExpectedMax) < 2)) {
506 if (!(
SkTAbs(fixedActualDefault - fixedExpectedDefault) < 2)) {
512 if (actual[actualIdx].isHidden() &&
513 actual[actualIdx].isHidden() != expected[expectedIdx].isHidden())
520 expectedUsed[expectedIdx] =
true;
524 "Actual axis '%c%c%c%c' with min %f max %f default %f hidden %s not expected",
525 (
char)((actual[actualIdx].tag >> 24) & 0xFF),
526 (
char)((actual[actualIdx].tag >> 16) & 0xFF),
527 (
char)((actual[actualIdx].tag >> 8) & 0xFF),
528 (
char)((actual[actualIdx].tag ) & 0xFF),
529 actual[actualIdx].
min,
530 actual[actualIdx].def,
531 actual[actualIdx].
max,
532 actual[actualIdx].isHidden() ?
"true" :
"false");
545 constexpr Axis expected[] = {
563 constexpr Axis expected[] = {
578 constexpr Axis expected[] = {
587 int*
count =
static_cast<int*
>(ctx);
653 size_t const textLen = strlen(
text);
655 font.getTypeface()->getFamilyName(&familyName);
658 char const *
const textEnd =
text + textLen;
659 std::unique_ptr<SkUnichar[]> originalCodepoints(
new SkUnichar[codepointCount]);
660 for (
size_t i = 0;
i < codepointCount; ++
i) {
664 font.unicharsToGlyphs(originalCodepoints.get(), codepointCount,
glyphs.get());
666 ERRORF(
reporter,
"Unexpected typeface \"%s\". Expected full support for emoji_sample_text.",
671 std::unique_ptr<SkUnichar[]> newCodepoints(
new SkUnichar[codepointCount]);
674 for (
size_t i = 0;
i < codepointCount; ++
i) {
682 "name:%s i:%zu original:%d new:%d glyph:%d", familyName.
c_str(),
i,
683 originalCodepoints[
i], newCodepoints[
i],
glyphs[
i]);
696 if (typeface1 || typeface2 || typeface3) {
std::unique_ptr< SkStreamAsset > GetResourceAsStream(const char *resource, bool useFileStream)
#define SkASSERT_RELEASE(cond)
#define SkEndian_SwapBE32(n)
#define SkEndian_SwapBE16(n)
#define SkScalarToFixed(x)
sk_sp< T > sk_ref_sp(T *obj)
#define SkScalarToDouble(x)
static constexpr SkFourByteTag SkSetFourByteTag(char a, char b, char c, char d)
#define REPORTER_ASSERT(r, cond,...)
#define REPORT_FAILURE(reporter, cond, message)
DEF_TEST(TypefaceStyle, reporter)
static int count(skiatest::Reporter *reporter, const SkTypefaceCache &cache)
static void check_serialize_behaviors(sk_sp< SkTypeface > tf, skiatest::Reporter *reporter)
static bool count_proc(SkTypeface *face, void *ctx)
static void TypefaceStyle_test(skiatest::Reporter *reporter, uint16_t weight, uint16_t width, SkData *data)
static sk_sp< SkData > MakeWithCopy(const void *data, size_t length)
static sk_sp< SkData > MakeFromStream(SkStream *, size_t size)
SkFontStyle getStyle() const
const SkFontArguments::VariationPosition::Coordinate * getVariation() const
static bool Deserialize(SkStream *, SkFontDescriptor *result)
int getVariationCoordinateCount() const
sk_sp< SkTypeface > makeFromStream(std::unique_ptr< SkStreamAsset >, int ttcIndex=0) const
sk_sp< SkTypeface > legacyMakeTypeface(const char familyName[], SkFontStyle style) const
static void GlyphsToUnichars(const SkFont &, const uint16_t glyphs[], int count, SkUnichar[])
static constexpr SkFontStyle Italic()
static constexpr SkFontStyle BoldItalic()
static constexpr SkFontStyle Bold()
static constexpr SkFontStyle Normal()
const char * c_str() const
void getFontDescriptor(SkFontDescriptor *desc, bool *isLocal) const
SkFontStyle fontStyle() const
void serialize(SkWStream *, SerializeBehavior=SerializeBehavior::kIncludeDataIfLocal) const
int getVariationDesignParameters(SkFontParameters::Variation::Axis parameters[], int parameterCount) const
int getVariationDesignPosition(SkFontArguments::VariationPosition::Coordinate coordinates[], int coordinateCount) const
static bool Equal(const SkTypeface *facea, const SkTypeface *faceb)
bool getPostScriptName(SkString *name) const
std::unique_ptr< SkStreamAsset > openStream(int *ttcIndex) const
sk_sp< SkTypeface > makeClone(const SkFontArguments &) const
static sk_sp< SkTypeface > Make()
const EmbeddedViewParams * params
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
static float max(float r, float g, float b)
static float min(float r, float g, float b)
SK_SPI SkUnichar NextUTF8(const char **ptr, const char *end)
SK_SPI int CountUTF8(const char *utf8, size_t byteLength)
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 Enable an endless trace buffer The default is a ring buffer This is useful when very old events need to viewed For during application launch Memory usage will continue to grow indefinitely however Start app with an specific route defined on the framework flutter assets Path to the Flutter assets directory enable service port Allow the VM service to fallback to automatic port selection if binding to a specified port fails trace Trace early application lifecycle Automatically switches to an endless trace buffer trace skia Filters out all Skia trace event categories except those that are specified in this comma separated list dump skp on shader Automatically dump the skp that triggers new shader compilations This is useful for writing custom ShaderWarmUp to reduce jank By this is not enabled to reduce the overhead purge persistent cache
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
font
Font Metadata and Metrics.
enum SkOTTableOS2_V0::WidthClass::Value value
struct SkOTTableOS2_V0::WidthClass usWidthClass
struct SkOTTableOS2_V0::WeightClass usWeightClass
static constexpr SK_OT_ULONG TAG
std::shared_ptr< const fml::Mapping > data