Commit 051968d4 authored by caseq@chromium.org's avatar caseq@chromium.org

Do not use SkCreateTypefaceFromCTFont for custom fonts

SkCreateTypefaceFromCTFont implies fonts are non-local
(i.e. serialized as font name only, not the glyphs). This
does not work with the dynamically loaded fonts, so just
keep the SkTypeface we used to create in FontCustomPlatformDataMac
rather than create one from CTFont.

BUG=426088

Review URL: https://codereview.chromium.org/691733004

git-svn-id: svn://svn.chromium.org/blink/trunk@184884 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 48dbb1be
11
99
111
999
1111
9999
11111
99999
123456
111111
999999
This is a testharness.js-based test.
PASS Numbers expected to be laid out in one combining block
PASS Numbers expected to be laid out in one combining block
FAIL Numbers expected to be laid out in one combining block assert_equals: Numbers laid out in one combining block. expected 24 but got 26.6953125
FAIL Numbers expected to be laid out in one combining block assert_equals: Numbers laid out in one combining block. expected 24 but got 26.6953125
FAIL Numbers expected to be laid out in one combining block assert_equals: Numbers laid out in one combining block. expected 24 but got 40.04296875
FAIL Numbers expected to be laid out in one combining block assert_equals: Numbers laid out in one combining block. expected 24 but got 40.04296875
FAIL Numbers expected to be laid out in one combining block assert_equals: Numbers laid out in one combining block. expected 24 but got 53.390625
FAIL Numbers expected to be laid out in one combining block assert_equals: Numbers laid out in one combining block. expected 24 but got 53.390625
PASS Number laid out vertically, not combined.
Harness: the test ran to completion.
11
99
111
999
1111
9999
11111
99999
123456
111111
999999
This is a testharness.js-based test.
PASS Numbers expected to be laid out in one combining block
PASS Numbers expected to be laid out in one combining block
FAIL Numbers expected to be laid out in one combining block assert_equals: Numbers laid out in one combining block. expected 24 but got 26.6953125
FAIL Numbers expected to be laid out in one combining block assert_equals: Numbers laid out in one combining block. expected 24 but got 26.6953125
FAIL Numbers expected to be laid out in one combining block assert_equals: Numbers laid out in one combining block. expected 24 but got 40.04296875
FAIL Numbers expected to be laid out in one combining block assert_equals: Numbers laid out in one combining block. expected 24 but got 40.04296875
FAIL Numbers expected to be laid out in one combining block assert_equals: Numbers laid out in one combining block. expected 24 but got 53.390625
FAIL Numbers expected to be laid out in one combining block assert_equals: Numbers laid out in one combining block. expected 24 but got 53.390625
PASS Number laid out vertically, not combined.
Harness: the test ran to completion.
......@@ -189,8 +189,8 @@ FontPlatformData::FontPlatformData(const FontPlatformData& src, float textSize)
}
#if OS(MACOSX)
FontPlatformData::FontPlatformData(CGFontRef cgFont, float size, bool syntheticBold, bool syntheticItalic, FontOrientation orientation, FontWidthVariant widthVariant)
: m_typeface(nullptr)
FontPlatformData::FontPlatformData(CGFontRef cgFont, PassRefPtr<SkTypeface> tf, float size, bool syntheticBold, bool syntheticItalic, FontOrientation orientation, FontWidthVariant widthVariant)
: m_typeface(tf)
, m_family(CString())
, m_textSize(size)
, m_syntheticBold(syntheticBold)
......
......@@ -80,7 +80,7 @@ public:
#if OS(MACOSX)
FontPlatformData(NSFont*, float size, bool syntheticBold = false, bool syntheticItalic = false,
FontOrientation = Horizontal, FontWidthVariant = RegularWidth);
FontPlatformData(CGFontRef, float size, bool syntheticBold, bool syntheticOblique, FontOrientation, FontWidthVariant);
FontPlatformData(CGFontRef, PassRefPtr<SkTypeface>, float size, bool syntheticBold, bool syntheticOblique, FontOrientation, FontWidthVariant);
#else
FontPlatformData(PassRefPtr<SkTypeface>, const char* name, float textSize, bool syntheticBold, bool syntheticItalic, FontOrientation = Horizontal, bool subpixelTextPosition = defaultUseSubpixelPositioning());
#endif
......
......@@ -44,7 +44,7 @@ FontCustomPlatformData::~FontCustomPlatformData()
FontPlatformData FontCustomPlatformData::fontPlatformData(float size, bool bold, bool italic, FontOrientation orientation, FontWidthVariant widthVariant)
{
return FontPlatformData(m_cgFont.get(), size, bold, italic, orientation, widthVariant);
return FontPlatformData(m_cgFont.get(), m_typeface, size, bold, italic, orientation, widthVariant);
}
PassOwnPtr<FontCustomPlatformData> FontCustomPlatformData::create(SharedBuffer* buffer)
......@@ -63,10 +63,6 @@ PassOwnPtr<FontCustomPlatformData> FontCustomPlatformData::create(SharedBuffer*
if (!cgFontRef)
return nullptr;
// It's unclear whether this is used. It seems like it has the effect of priming the cache.
// Since we store this anyways, it might be worthwhile just plumbing this to FontMac.cpp in
// a more obvious way.
// FIXME: Remove this, add an explicit use, or add a comment explaining why this exists.
RefPtr<SkMemoryStream> stream = adoptRef(new SkMemoryStream(buffer->getAsSkData().get()));
RefPtr<SkTypeface> typeface = adoptRef(SkTypeface::CreateFromStream(stream.get()));
if (!typeface)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment