FontPlatformData::FontPlatformData(const FontDescription& desc, const AtomicString& family) { // NB: The Windows wxFont constructor has two forms, one taking a wxSize (with pixels) // and one taking an int (points). When points are used, Windows calculates // a pixel size using an algorithm which causes the size to be way off. However, // this is a moot issue on Linux and Mac as they only accept the point argument. So, // we use the pixel size constructor on Windows, but we use point size on Linux and Mac. #if __WXMSW__ m_font = new FontHolder(new wxFont( wxSize(0, -desc.computedPixelSize()), fontFamilyToWxFontFamily(desc.genericFamily()), italicToWxFontStyle(desc.italic()), fontWeightToWxFontWeight(desc.weight()), false, family.string() ) ); #else m_font = new FontHolder(new wxFont( desc.computedPixelSize(), fontFamilyToWxFontFamily(desc.genericFamily()), italicToWxFontStyle(desc.italic()), fontWeightToWxFontWeight(desc.weight()), false, family.string() ) ); #endif m_fontState = VALID; }
FontPlatformData::FontPlatformData(const FontDescription& desc, const AtomicString& family) { // NB: The Windows wxFont constructor has two forms, one taking a wxSize (with pixels) // and one taking an int (points). When points are used, Windows calculates // a pixel size using an algorithm which causes the size to be way off. However, // this is a moot issue on Linux and Mac as they only accept the point argument. So, // we use the pixel size constructor on Windows, but we use point size on Linux and Mac. #if __WXMSW__ m_font = adoptRef(new FontHolder(new wxFont( wxSize(0, -desc.computedPixelSize()), fontFamilyToWxFontFamily(desc.genericFamily()), italicToWxFontStyle(desc.italic()), fontWeightToWxFontWeight(desc.weight()), false, family.string() ) )); #else m_font = adoptRef(new FontHolder(new wxFont( desc.computedPixelSize(), fontFamilyToWxFontFamily(desc.genericFamily()), italicToWxFontStyle(desc.italic()), fontWeightToWxFontWeight(desc.weight()), false, family.string() ) )); #endif #if OS(DARWIN) #if !wxOSX_USE_CORE_TEXT #if wxCHECK_VERSION(2,9,0) m_atsuFontID = m_font->font()->OSXGetATSUFontID(); #else m_atsuFontID = m_font->font()->MacGetATSUFontID(); #endif #endif m_nsFont = 0; cacheNSFont(); #endif m_size = desc.computedPixelSize(); m_fontState = VALID; m_size = desc.computedPixelSize(); }