| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007 Apple Computer, Inc. | 2 * Copyright (C) 2006, 2007 Apple Computer, Inc. |
| 3 * Copyright (c) 2006, 2007, 2008, 2009, 2012 Google Inc. All rights reserved. | 3 * Copyright (c) 2006, 2007, 2008, 2009, 2012 Google Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 } | 197 } |
| 198 return *this; | 198 return *this; |
| 199 } | 199 } |
| 200 | 200 |
| 201 FontPlatformData::~FontPlatformData() | 201 FontPlatformData::~FontPlatformData() |
| 202 { | 202 { |
| 203 ScriptFreeCache(&m_scriptCache); | 203 ScriptFreeCache(&m_scriptCache); |
| 204 m_scriptCache = 0; | 204 m_scriptCache = 0; |
| 205 } | 205 } |
| 206 | 206 |
| 207 String FontPlatformData::fontFamilyName() const |
| 208 { |
| 209 SkTypeface::LocalizedStrings* fontFamilyIterator = this->typeface()->createF
amilyNameIterator(); |
| 210 SkTypeface::LocalizedString localizedString; |
| 211 while (fontFamilyIterator->next(&localizedString) && !localizedString.fStrin
g.size()) { } |
| 212 fontFamilyIterator->unref(); |
| 213 return String(localizedString.fString.c_str()); |
| 214 } |
| 215 |
| 207 bool FontPlatformData::isFixedPitch() const | 216 bool FontPlatformData::isFixedPitch() const |
| 208 { | 217 { |
| 209 #if ENABLE(GDI_FONTS_ON_WINDOWS) | 218 #if ENABLE(GDI_FONTS_ON_WINDOWS) |
| 210 // TEXTMETRICS have this. Set m_treatAsFixedPitch based off that. | 219 // TEXTMETRICS have this. Set m_treatAsFixedPitch based off that. |
| 211 HWndDC dc(0); | 220 HWndDC dc(0); |
| 212 HGDIOBJ oldFont = SelectObject(dc, hfont()); | 221 HGDIOBJ oldFont = SelectObject(dc, hfont()); |
| 213 | 222 |
| 214 // Yes, this looks backwards, but the fixed pitch bit is actually set if the
font | 223 // Yes, this looks backwards, but the fixed pitch bit is actually set if the
font |
| 215 // is *not* fixed pitch. Unbelievable but true. | 224 // is *not* fixed pitch. Unbelievable but true. |
| 216 TEXTMETRIC textMetric = { 0 }; | 225 TEXTMETRIC textMetric = { 0 }; |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 | 284 |
| 276 bool FontPlatformData::ensureFontLoaded(HFONT font) | 285 bool FontPlatformData::ensureFontLoaded(HFONT font) |
| 277 { | 286 { |
| 278 WebKit::WebSandboxSupport* sandboxSupport = WebKit::Platform::current()->san
dboxSupport(); | 287 WebKit::WebSandboxSupport* sandboxSupport = WebKit::Platform::current()->san
dboxSupport(); |
| 279 // if there is no sandbox, then we can assume the font | 288 // if there is no sandbox, then we can assume the font |
| 280 // was able to be loaded successfully already | 289 // was able to be loaded successfully already |
| 281 return sandboxSupport ? sandboxSupport->ensureFontLoaded(font) : true; | 290 return sandboxSupport ? sandboxSupport->ensureFontLoaded(font) : true; |
| 282 } | 291 } |
| 283 | 292 |
| 284 } | 293 } |
| OLD | NEW |