mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Obtain test font attributes from the font description (#3396)
Fixes https://github.com/flutter/flutter/issues/7724
This commit is contained in:
parent
cbf49d0652
commit
d49a6b110b
@ -20,7 +20,7 @@ TestFontSelector::TestFontSelector() = default;
|
||||
TestFontSelector::~TestFontSelector() = default;
|
||||
|
||||
PassRefPtr<FontData> TestFontSelector::getFontData(
|
||||
const FontDescription&,
|
||||
const FontDescription& fontDescription,
|
||||
const AtomicString& familyName) {
|
||||
if (test_font_data_ != nullptr) {
|
||||
return test_font_data_;
|
||||
@ -28,8 +28,15 @@ PassRefPtr<FontData> TestFontSelector::getFontData(
|
||||
|
||||
auto typeface = SkTypeface::MakeFromStream(GetTestFontData().release());
|
||||
|
||||
FontPlatformData platform_data(typeface, "Ahem", 14.0, false, false,
|
||||
FontOrientation::Horizontal, false);
|
||||
bool syntheticBold = (fontDescription.weight() >= FontWeight600 ||
|
||||
fontDescription.isSyntheticBold());
|
||||
bool syntheticItalic = (fontDescription.style() ||
|
||||
fontDescription.isSyntheticItalic());
|
||||
FontPlatformData platform_data(typeface, "Ahem",
|
||||
fontDescription.effectiveFontSize(),
|
||||
syntheticBold, syntheticItalic,
|
||||
fontDescription.orientation(),
|
||||
fontDescription.useSubpixelPositioning());
|
||||
|
||||
test_font_data_ =
|
||||
SimpleFontData::create(platform_data, CustomFontData::create());
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user