| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2006, 2007, 2008, 2009 Google Inc. All rights reserved. | 2 * Copyright (c) 2006, 2007, 2008, 2009 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 name = family.utf8(); | 135 name = family.utf8(); |
| 136 } | 136 } |
| 137 | 137 |
| 138 int style = SkTypeface::kNormal; | 138 int style = SkTypeface::kNormal; |
| 139 if (fontDescription.weight() >= FontWeightBold) | 139 if (fontDescription.weight() >= FontWeightBold) |
| 140 style |= SkTypeface::kBold; | 140 style |= SkTypeface::kBold; |
| 141 if (fontDescription.italic()) | 141 if (fontDescription.italic()) |
| 142 style |= SkTypeface::kItalic; | 142 style |= SkTypeface::kItalic; |
| 143 | 143 |
| 144 // FIXME: Use SkFontStyle and matchFamilyStyle instead of legacyCreateTypefa
ce. | 144 // FIXME: Use SkFontStyle and matchFamilyStyle instead of legacyCreateTypefa
ce. |
| 145 #if OS(WIN) && !ENABLE(GDI_FONTS_ON_WINDOWS) | 145 #if OS(WIN) |
| 146 if (m_fontManager) | 146 if (m_fontManager) |
| 147 return adoptRef(m_fontManager->legacyCreateTypeface(name.data(), style))
; | 147 return adoptRef(m_fontManager->legacyCreateTypeface(name.data(), style))
; |
| 148 #endif | 148 #endif |
| 149 | 149 |
| 150 return adoptRef(SkTypeface::CreateFromName(name.data(), static_cast<SkTypefa
ce::Style>(style))); | 150 return adoptRef(SkTypeface::CreateFromName(name.data(), static_cast<SkTypefa
ce::Style>(style))); |
| 151 } | 151 } |
| 152 | 152 |
| 153 #if !OS(WIN) | 153 #if !OS(WIN) |
| 154 FontPlatformData* FontCache::createFontPlatformData(const FontDescription& fontD
escription, const AtomicString& family, float fontSize) | 154 FontPlatformData* FontCache::createFontPlatformData(const FontDescription& fontD
escription, const AtomicString& family, float fontSize) |
| 155 { | 155 { |
| 156 CString name; | 156 CString name; |
| 157 RefPtr<SkTypeface> tf(createTypeface(fontDescription, family, name)); | 157 RefPtr<SkTypeface> tf(createTypeface(fontDescription, family, name)); |
| 158 if (!tf) | 158 if (!tf) |
| 159 return 0; | 159 return 0; |
| 160 | 160 |
| 161 FontPlatformData* result = new FontPlatformData(tf, | 161 FontPlatformData* result = new FontPlatformData(tf, |
| 162 name.data(), | 162 name.data(), |
| 163 fontSize, | 163 fontSize, |
| 164 (fontDescription.weight() >= FontWeightBold && !tf->isBold()) || fontDes
cription.isSyntheticBold(), | 164 (fontDescription.weight() >= FontWeightBold && !tf->isBold()) || fontDes
cription.isSyntheticBold(), |
| 165 (fontDescription.italic() && !tf->isItalic()) || fontDescription.isSynth
eticItalic(), | 165 (fontDescription.italic() && !tf->isItalic()) || fontDescription.isSynth
eticItalic(), |
| 166 fontDescription.orientation(), | 166 fontDescription.orientation(), |
| 167 fontDescription.useSubpixelPositioning()); | 167 fontDescription.useSubpixelPositioning()); |
| 168 return result; | 168 return result; |
| 169 } | 169 } |
| 170 #endif // !OS(WINDOWNS) | 170 #endif // !OS(WINDOWNS) |
| 171 | 171 |
| 172 } // namespace WebCore | 172 } // namespace WebCore |
| OLD | NEW |