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

Unified Diff: Source/platform/fonts/cocoa/FontPlatformDataCocoa.mm

Issue 546973004: Revert 181541 "Merge FontPlatformDataHarfBuzz and FontPlatformData headers" (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 3 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
Index: Source/platform/fonts/cocoa/FontPlatformDataCocoa.mm
diff --git a/Source/platform/fonts/cocoa/FontPlatformDataCocoa.mm b/Source/platform/fonts/cocoa/FontPlatformDataCocoa.mm
index 4992cad45bdb2f75c9d68a9d2c03ed19c5d16fa8..d76370a4be9d9d0ca630efbc8c70b4a6d2eed4d9 100644
--- a/Source/platform/fonts/cocoa/FontPlatformDataCocoa.mm
+++ b/Source/platform/fonts/cocoa/FontPlatformDataCocoa.mm
@@ -35,26 +35,18 @@
namespace blink {
-unsigned FontPlatformData::hash() const
-{
- ASSERT(m_font || !m_cgFont);
- uintptr_t hashCodes[3] = { (uintptr_t)m_font, m_widthVariant, static_cast<uintptr_t>(m_isHashTableDeletedValue << 3 | m_orientation << 2 | m_syntheticBold << 1 | m_syntheticItalic) };
- return StringHasher::hashMemory<sizeof(hashCodes)>(hashCodes);
-}
-
// These CoreText Text Spacing feature selectors are not defined in CoreText.
enum TextSpacingCTFeatureSelector { TextSpacingProportional, TextSpacingFullWidth, TextSpacingHalfWidth, TextSpacingThirdWidth, TextSpacingQuarterWidth };
-FontPlatformData::FontPlatformData(NSFont *nsFont, float size, bool syntheticBold, bool syntheticItalic, FontOrientation orientation, FontWidthVariant widthVariant)
- : m_textSize(size)
- , m_syntheticBold(syntheticBold)
- , m_syntheticItalic(syntheticItalic)
+FontPlatformData::FontPlatformData(NSFont *nsFont, float size, bool syntheticBold, bool syntheticOblique, FontOrientation orientation, FontWidthVariant widthVariant)
+ : m_syntheticBold(syntheticBold)
+ , m_syntheticOblique(syntheticOblique)
, m_orientation(orientation)
- , m_isColorBitmapFont(false)
- , m_isCompositeFontReference(false)
+ , m_size(size)
, m_widthVariant(widthVariant)
, m_font(nsFont)
- , m_isHashTableDeletedValue(false)
+ , m_isColorBitmapFont(false)
+ , m_isCompositeFontReference(false)
{
ASSERT_ARG(nsFont, nsFont);
@@ -137,11 +129,11 @@ void FontPlatformData::setFont(NSFont *font)
if (m_font)
CFRelease(m_font);
m_font = font;
- m_textSize = [font pointSize];
+ m_size = [font pointSize];
CGFontRef cgFont = 0;
NSFont* loadedFont = 0;
- loadFont(m_font, m_textSize, loadedFont, cgFont);
+ loadFont(m_font, m_size, loadedFont, cgFont);
#if OS(MACOSX)
// If loadFont replaced m_font with a fallback font, then release the
@@ -255,7 +247,7 @@ CTFontRef FontPlatformData::ctFont() const
return m_CTFont.get();
if (m_inMemoryFont) {
- m_CTFont.adoptCF(CTFontCreateWithGraphicsFont(m_inMemoryFont->cgFont(), m_textSize, 0, cascadeToLastResortFontDescriptor()));
+ m_CTFont.adoptCF(CTFontCreateWithGraphicsFont(m_inMemoryFont->cgFont(), m_size, 0, cascadeToLastResortFontDescriptor()));
return m_CTFont.get();
}
@@ -268,9 +260,9 @@ CTFontRef FontPlatformData::ctFont() const
fontDescriptor = cascadeToLastResortAndDisableSwashesFontDescriptor();
else
fontDescriptor = cascadeToLastResortFontDescriptor();
- m_CTFont.adoptCF(CTFontCreateCopyWithAttributes(m_CTFont.get(), m_textSize, 0, fontDescriptor));
+ m_CTFont.adoptCF(CTFontCreateCopyWithAttributes(m_CTFont.get(), m_size, 0, fontDescriptor));
} else
- m_CTFont.adoptCF(CTFontCreateWithGraphicsFont(m_cgFont.get(), m_textSize, 0, cascadeToLastResortFontDescriptor()));
+ m_CTFont.adoptCF(CTFontCreateWithGraphicsFont(m_cgFont.get(), m_size, 0, cascadeToLastResortFontDescriptor()));
if (m_widthVariant != RegularWidth) {
int featureTypeValue = kTextSpacingType;
@@ -279,7 +271,7 @@ CTFontRef FontPlatformData::ctFont() const
RetainPtr<CFNumberRef> featureType(AdoptCF, CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &featureTypeValue));
RetainPtr<CFNumberRef> featureSelector(AdoptCF, CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &featureSelectorValue));
RetainPtr<CTFontDescriptorRef> newDescriptor(AdoptCF, CTFontDescriptorCreateCopyWithFeature(sourceDescriptor.get(), featureType.get(), featureSelector.get()));
- RetainPtr<CTFontRef> newFont(AdoptCF, CTFontCreateWithFontDescriptor(newDescriptor.get(), m_textSize, 0));
+ RetainPtr<CTFontRef> newFont(AdoptCF, CTFontCreateWithFontDescriptor(newDescriptor.get(), m_size, 0));
if (newFont)
m_CTFont = newFont;
@@ -288,7 +280,7 @@ CTFontRef FontPlatformData::ctFont() const
return m_CTFont.get();
}
-SkTypeface* FontPlatformData::typeface() const {
+SkTypeface* FontPlatformData::typeface() const{
if (m_typeface)
return m_typeface.get();
@@ -311,9 +303,8 @@ static bool isAATFont(CTFontRef ctFont)
}
return false;
}
-#endif
-HarfBuzzFace* FontPlatformData::harfBuzzFace() const
+HarfBuzzFace* FontPlatformData::harfBuzzFace()
{
CTFontRef font = ctFont();
// HarfBuzz can't handle AAT font
@@ -326,13 +317,14 @@ HarfBuzzFace* FontPlatformData::harfBuzzFace() const
}
return m_harfBuzzFace.get();
}
+#endif
#ifndef NDEBUG
String FontPlatformData::description() const
{
RetainPtr<CFStringRef> cgFontDescription(AdoptCF, CFCopyDescription(cgFont()));
- return String(cgFontDescription.get()) + " " + String::number(m_textSize)
- + (m_syntheticBold ? " synthetic bold" : "") + (m_syntheticItalic ? " synthetic oblique" : "") + (m_orientation ? " vertical orientation" : "");
+ return String(cgFontDescription.get()) + " " + String::number(m_size)
+ + (m_syntheticBold ? " synthetic bold" : "") + (m_syntheticOblique ? " synthetic oblique" : "") + (m_orientation ? " vertical orientation" : "");
}
#endif
« no previous file with comments | « Source/platform/fonts/FontPlatformData.cpp ('k') | Source/platform/fonts/harfbuzz/FontPlatformDataHarfBuzz.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698