Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2113)

Unified Diff: Source/platform/fonts/FontPlatformData.cpp

Issue 879533003: Remove Mac native font type members from FontPlatformData (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Canvas text metrics test does not need rebaselining after improvement landed, toNSFont in WebSubstringUtil.mm Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/platform/fonts/FontPlatformData.h ('k') | Source/platform/fonts/SimpleFontData.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/fonts/FontPlatformData.cpp
diff --git a/Source/platform/fonts/FontPlatformData.cpp b/Source/platform/fonts/FontPlatformData.cpp
index 33f234c0b2958212562ab40afa13389c640efdb7..824ceba270e0aac203985f10dbb94733c1e2b63f 100644
--- a/Source/platform/fonts/FontPlatformData.cpp
+++ b/Source/platform/fonts/FontPlatformData.cpp
@@ -46,11 +46,7 @@ FontPlatformData::FontPlatformData(WTF::HashTableDeletedValueType)
, m_syntheticBold(false)
, m_syntheticItalic(false)
, m_orientation(Horizontal)
-#if OS(MACOSX)
- , m_isColorBitmapFont(false)
- , m_isCompositeFontReference(false)
- , m_font(nullptr)
-#else
+#if !OS(MACOSX)
, m_style(FontRenderStyle())
#endif
, m_isHashTableDeletedValue(true)
@@ -72,11 +68,7 @@ FontPlatformData::FontPlatformData()
, m_syntheticBold(false)
, m_syntheticItalic(false)
, m_orientation(Horizontal)
-#if OS(MACOSX)
- , m_isColorBitmapFont(false)
- , m_isCompositeFontReference(false)
- , m_font(nullptr)
-#else
+#if !OS(MACOSX)
, m_style(FontRenderStyle())
#endif
, m_isHashTableDeletedValue(false)
@@ -98,11 +90,7 @@ FontPlatformData::FontPlatformData(float size, bool syntheticBold, bool syntheti
, m_syntheticBold(syntheticBold)
, m_syntheticItalic(syntheticItalic)
, m_orientation(orientation)
-#if OS(MACOSX)
- , m_isColorBitmapFont(false)
- , m_isCompositeFontReference(false)
- , m_font(nullptr)
-#else
+#if !OS(MACOSX)
, m_style(FontRenderStyle())
#endif
, m_isHashTableDeletedValue(false)
@@ -124,10 +112,6 @@ FontPlatformData::FontPlatformData(const FontPlatformData& source)
, m_syntheticBold(source.m_syntheticBold)
, m_syntheticItalic(source.m_syntheticItalic)
, m_orientation(source.m_orientation)
-#if OS(MACOSX)
- , m_isColorBitmapFont(source.m_isColorBitmapFont)
- , m_isCompositeFontReference(source.m_isCompositeFontReference)
-#endif
#if !OS(MACOSX)
, m_style(source.m_style)
#endif
@@ -140,9 +124,6 @@ FontPlatformData::FontPlatformData(const FontPlatformData& source)
, m_minSizeForSubpixel(source.m_minSizeForSubpixel)
#endif
{
-#if OS(MACOSX)
- platformDataInit(source);
-#endif
}
FontPlatformData::FontPlatformData(const FontPlatformData& src, float textSize)
@@ -154,10 +135,6 @@ FontPlatformData::FontPlatformData(const FontPlatformData& src, float textSize)
, m_syntheticBold(src.m_syntheticBold)
, m_syntheticItalic(src.m_syntheticItalic)
, m_orientation(src.m_orientation)
-#if OS(MACOSX)
- , m_isColorBitmapFont(src.m_isColorBitmapFont)
- , m_isCompositeFontReference(src.m_isCompositeFontReference)
-#endif
#if !OS(MACOSX)
, m_style(src.m_style)
#endif
@@ -170,31 +147,11 @@ FontPlatformData::FontPlatformData(const FontPlatformData& src, float textSize)
, m_minSizeForSubpixel(src.m_minSizeForSubpixel)
#endif
{
-#if OS(MACOSX)
- platformDataInit(src);
-#else
+#if !OS(MACOSX)
querySystemForRenderStyle(FontDescription::subpixelPositioning());
#endif
}
-#if OS(MACOSX)
-FontPlatformData::FontPlatformData(CGFontRef cgFont, PassRefPtr<SkTypeface> tf, float size, bool syntheticBold, bool syntheticItalic, FontOrientation orientation)
- : m_typeface(tf)
- , m_family(CString())
- , m_textSize(size)
- , m_syntheticBold(syntheticBold)
- , m_syntheticItalic(syntheticItalic)
- , m_orientation(orientation)
- , m_isColorBitmapFont(false)
- , m_isCompositeFontReference(false)
- , m_font(nullptr)
- , m_cgFont(cgFont)
- , m_isHashTableDeletedValue(false)
-{
-}
-
-#else
-
FontPlatformData::FontPlatformData(PassRefPtr<SkTypeface> tf, const char* family, float textSize, bool syntheticBold, bool syntheticItalic, FontOrientation orientation, bool subpixelTextPosition)
: m_typeface(tf)
#if !OS(WIN)
@@ -212,18 +169,26 @@ FontPlatformData::FontPlatformData(PassRefPtr<SkTypeface> tf, const char* family
, m_minSizeForSubpixel(0)
#endif
{
+#if !OS(MACOSX)
querySystemForRenderStyle(subpixelTextPosition);
-}
-
#endif
+}
FontPlatformData::~FontPlatformData()
{
+}
+
#if OS(MACOSX)
- if (m_font)
- CFRelease(m_font);
-#endif
+CTFontRef FontPlatformData::ctFont() const
+{
+ return SkTypeface_GetCTFontRef(m_typeface.get());
+};
+
+CGFontRef FontPlatformData::cgFont() const
+{
+ return CTFontCopyGraphicsFont(ctFont(), 0);
}
+#endif
const FontPlatformData& FontPlatformData::operator=(const FontPlatformData& other)
{
@@ -240,10 +205,7 @@ const FontPlatformData& FontPlatformData::operator=(const FontPlatformData& othe
m_syntheticItalic = other.m_syntheticItalic;
m_harfBuzzFace = nullptr;
m_orientation = other.m_orientation;
-#if OS(MACOSX)
- m_isColorBitmapFont = other.m_isColorBitmapFont;
- m_isCompositeFontReference = other.m_isCompositeFontReference;
-#else
+#if !OS(MACOSX)
m_style = other.m_style;
#endif
@@ -254,11 +216,7 @@ const FontPlatformData& FontPlatformData::operator=(const FontPlatformData& othe
m_useSubpixelPositioning = other.m_useSubpixelPositioning;
#endif
-#if OS(MACOSX)
- return platformDataAssign(other);
-#else
return *this;
-#endif
}
bool FontPlatformData::operator==(const FontPlatformData& a) const
@@ -276,13 +234,10 @@ bool FontPlatformData::operator==(const FontPlatformData& a) const
&& m_isHashTableDeletedValue == a.m_isHashTableDeletedValue
&& m_syntheticBold == a.m_syntheticBold
&& m_syntheticItalic == a.m_syntheticItalic
- && m_orientation == a.m_orientation
#if !OS(MACOSX)
- && m_style == a.m_style;
-#else
- && m_isColorBitmapFont == a.m_isColorBitmapFont
- && m_isCompositeFontReference == a.m_isCompositeFontReference;
+ && m_style == a.m_style
#endif
+ && m_orientation == a.m_orientation;
}
SkFontID FontPlatformData::uniqueID() const
@@ -307,13 +262,6 @@ bool FontPlatformData::isFixedPitch() const
SkTypeface* FontPlatformData::typeface() const
{
-#if OS(MACOSX)
- // ctFont() will always generate a typeface, even for uninitialized font members.
- // We only want to generate a Skia typeface if we have a valid font to start from,
- // to keep hashing and comparisons to the empty object consistent.
- if (!m_typeface && (m_font || m_cgFont || m_CTFont || m_inMemoryFont))
- m_typeface = adoptRef(SkCreateTypefaceFromCTFont(ctFont()));
-#endif
return m_typeface.get();
}
« no previous file with comments | « Source/platform/fonts/FontPlatformData.h ('k') | Source/platform/fonts/SimpleFontData.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698