| 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 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 } | 291 } |
| 292 | 292 |
| 293 FontPlatformData::~FontPlatformData() | 293 FontPlatformData::~FontPlatformData() |
| 294 { | 294 { |
| 295 ScriptFreeCache(&m_scriptCache); | 295 ScriptFreeCache(&m_scriptCache); |
| 296 m_scriptCache = 0; | 296 m_scriptCache = 0; |
| 297 } | 297 } |
| 298 | 298 |
| 299 String FontPlatformData::fontFamilyName() const | 299 String FontPlatformData::fontFamilyName() const |
| 300 { | 300 { |
| 301 #if ENABLE(GDI_FONTS_ON_WINDOWS) |
| 301 HWndDC dc(0); | 302 HWndDC dc(0); |
| 302 HGDIOBJ oldFont = static_cast<HFONT>(SelectObject(dc, hfont())); | 303 HGDIOBJ oldFont = static_cast<HFONT>(SelectObject(dc, hfont())); |
| 303 WCHAR name[LF_FACESIZE]; | 304 WCHAR name[LF_FACESIZE]; |
| 304 unsigned resultLength = GetTextFace(dc, LF_FACESIZE, name); | 305 unsigned resultLength = GetTextFace(dc, LF_FACESIZE, name); |
| 305 if (resultLength > 0) | 306 if (resultLength > 0) |
| 306 resultLength--; // ignore the null terminator | 307 resultLength--; // ignore the null terminator |
| 307 SelectObject(dc, oldFont); | 308 SelectObject(dc, oldFont); |
| 308 return String(name, resultLength); | 309 return String(name, resultLength); |
| 310 #else |
| 311 // FIXME: This returns the requested name, perhaps a better solution would b
e to |
| 312 // return the list of names provided by SkTypeface::createFamilyNameIterator
. |
| 313 ASSERT(typeface()); |
| 314 SkString familyName; |
| 315 typeface()->getFamilyName(&familyName); |
| 316 return String::fromUTF8(familyName.c_str()); |
| 317 #endif |
| 309 } | 318 } |
| 310 | 319 |
| 311 bool FontPlatformData::isFixedPitch() const | 320 bool FontPlatformData::isFixedPitch() const |
| 312 { | 321 { |
| 313 #if ENABLE(GDI_FONTS_ON_WINDOWS) | 322 #if ENABLE(GDI_FONTS_ON_WINDOWS) |
| 314 // TEXTMETRICS have this. Set m_treatAsFixedPitch based off that. | 323 // TEXTMETRICS have this. Set m_treatAsFixedPitch based off that. |
| 315 HWndDC dc(0); | 324 HWndDC dc(0); |
| 316 HGDIOBJ oldFont = SelectObject(dc, hfont()); | 325 HGDIOBJ oldFont = SelectObject(dc, hfont()); |
| 317 | 326 |
| 318 // Yes, this looks backwards, but the fixed pitch bit is actually set if the
font | 327 // Yes, this looks backwards, but the fixed pitch bit is actually set if the
font |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 | 388 |
| 380 bool FontPlatformData::ensureFontLoaded(HFONT font) | 389 bool FontPlatformData::ensureFontLoaded(HFONT font) |
| 381 { | 390 { |
| 382 WebKit::WebSandboxSupport* sandboxSupport = WebKit::Platform::current()->san
dboxSupport(); | 391 WebKit::WebSandboxSupport* sandboxSupport = WebKit::Platform::current()->san
dboxSupport(); |
| 383 // if there is no sandbox, then we can assume the font | 392 // if there is no sandbox, then we can assume the font |
| 384 // was able to be loaded successfully already | 393 // was able to be loaded successfully already |
| 385 return sandboxSupport ? sandboxSupport->ensureFontLoaded(font) : true; | 394 return sandboxSupport ? sandboxSupport->ensureFontLoaded(font) : true; |
| 386 } | 395 } |
| 387 | 396 |
| 388 } | 397 } |
| OLD | NEW |