Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(85)

Side by Side Diff: Source/core/platform/graphics/chromium/FontPlatformDataChromiumWin.cpp

Issue 22923010: DevTools: Add CSS.getPlatformFontsForNode in protocol.json (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: use HFONT instead of SKTypeface on Win Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 } 217 }
218 return *this; 218 return *this;
219 } 219 }
220 220
221 FontPlatformData::~FontPlatformData() 221 FontPlatformData::~FontPlatformData()
222 { 222 {
223 ScriptFreeCache(&m_scriptCache); 223 ScriptFreeCache(&m_scriptCache);
224 m_scriptCache = 0; 224 m_scriptCache = 0;
225 } 225 }
226 226
227 String FontPlatformData::fontFamilyName() const
228 {
229 HWndDC dc(0);
230 HGDIOBJ oldFont = static_cast<HFONT>(SelectObject(dc, hfont()));
231 WCHAR name[LF_FACESIZE];
232 unsigned resultLength = GetTextFace(dc, LF_FACESIZE, name);
233 if (resultLength > 0)
234 resultLength--; // ignore the null terminator
235 SelectObject(dc, oldFont);
236 return String(name, resultLength);
237 }
238
227 bool FontPlatformData::isFixedPitch() const 239 bool FontPlatformData::isFixedPitch() const
228 { 240 {
229 #if ENABLE(GDI_FONTS_ON_WINDOWS) 241 #if ENABLE(GDI_FONTS_ON_WINDOWS)
230 // TEXTMETRICS have this. Set m_treatAsFixedPitch based off that. 242 // TEXTMETRICS have this. Set m_treatAsFixedPitch based off that.
231 HWndDC dc(0); 243 HWndDC dc(0);
232 HGDIOBJ oldFont = SelectObject(dc, hfont()); 244 HGDIOBJ oldFont = SelectObject(dc, hfont());
233 245
234 // Yes, this looks backwards, but the fixed pitch bit is actually set if the font 246 // Yes, this looks backwards, but the fixed pitch bit is actually set if the font
235 // is *not* fixed pitch. Unbelievable but true. 247 // is *not* fixed pitch. Unbelievable but true.
236 TEXTMETRIC textMetric = { 0 }; 248 TEXTMETRIC textMetric = { 0 };
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 307
296 bool FontPlatformData::ensureFontLoaded(HFONT font) 308 bool FontPlatformData::ensureFontLoaded(HFONT font)
297 { 309 {
298 WebKit::WebSandboxSupport* sandboxSupport = WebKit::Platform::current()->san dboxSupport(); 310 WebKit::WebSandboxSupport* sandboxSupport = WebKit::Platform::current()->san dboxSupport();
299 // if there is no sandbox, then we can assume the font 311 // if there is no sandbox, then we can assume the font
300 // was able to be loaded successfully already 312 // was able to be loaded successfully already
301 return sandboxSupport ? sandboxSupport->ensureFontLoaded(font) : true; 313 return sandboxSupport ? sandboxSupport->ensureFontLoaded(font) : true;
302 } 314 }
303 315
304 } 316 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698