fallbackFontFamily = @"Times New Roman";
else
fallbackFontFamily = webFallbackFontFamily();
-
+
// Try setting up the alternate font.
// This is a last ditch effort to use a substitute font when something has gone wrong.
#if !ERROR_DISABLED
WTF_LOG_ERROR("failed to set up font, using system font %s", m_platformData.font());
initFontData(this);
}
-
+
int iAscent;
int iDescent;
int iLineGap;
unsigned unitsPerEm;
+
iAscent = CGFontGetAscent(m_platformData.cgFont());
// Some fonts erroneously specify a positive descender value. We follow Core Text in assuming that
// such fonts meant the same distance, but in the reverse direction.
float ascent = scaleEmToUnits(iAscent, unitsPerEm) * pointSize;
float descent = -scaleEmToUnits(iDescent, unitsPerEm) * pointSize;
float lineGap = scaleEmToUnits(iLineGap, unitsPerEm) * pointSize;
+ float underlineThickness = CTFontGetUnderlineThickness(m_platformData.ctFont());
// We need to adjust Times, Helvetica, and Courier to closely match the
// vertical metrics of their Microsoft counterparts that are the de facto
lineGap -= 3 - descent;
descent = 3;
}
-
+
if (platformData().orientation() == Vertical && !isTextOrientationFallback())
m_hasVerticalGlyphs = fontHasVerticalGlyphs(m_platformData.ctFont());
m_fontMetrics.setDescent(descent);
m_fontMetrics.setLineGap(lineGap);
m_fontMetrics.setXHeight(xHeight);
+ m_fontMetrics.setUnderlineThickness(underlineThickness);
}
static CFDataRef copyFontTableForTag(FontPlatformData& platformData, FourCharCode tableName)
{
m_avgCharWidth = 0;
m_maxCharWidth = 0;
-
+
RetainPtr<CFDataRef> os2Table(AdoptCF, copyFontTableForTag(m_platformData, 'OS/2'));
if (os2Table && CFDataGetLength(os2Table.get()) >= 4) {
const UInt8* os2 = CFDataGetBytePtr(os2Table.get());
return 0;
}
-bool SimpleFontData::containsCharacters(const UChar* characters, int length) const
-{
- NSString *string = [[NSString alloc] initWithCharactersNoCopy:const_cast<unichar*>(characters) length:length freeWhenDone:NO];
- NSCharacterSet *set = [[m_platformData.font() coveredCharacterSet] invertedSet];
- bool result = set && [string rangeOfCharacterFromSet:set].location == NSNotFound;
- [string release];
- return result;
-}
-
void SimpleFontData::determinePitch()
{
NSFont* f = m_platformData.font();
WTF::HashMap<String, bool>::AddResult addResult = m_combiningCharacterSequenceSupport->add(String(characters, length), false);
if (!addResult.isNewEntry)
- return addResult.iterator->value;
+ return addResult.storedValue->value;
RetainPtr<CGFontRef> cgFont(AdoptCF, CTFontCopyGraphicsFont(platformData().ctFont(), 0));
return false;
}
- addResult.iterator->value = true;
+ addResult.storedValue->value = true;
return true;
}