OLD | NEW |
1 /* | 1 /* |
2 * This file is part of the internal font implementation. | 2 * This file is part of the internal font implementation. |
3 * | 3 * |
4 * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. | 4 * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. |
5 * Copyright (c) 2010 Google Inc. All rights reserved. | 5 * Copyright (c) 2010 Google Inc. All rights reserved. |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 | 283 |
284 SkTypeface* FontPlatformData::typeface() const{ | 284 SkTypeface* FontPlatformData::typeface() const{ |
285 if (m_typeface) | 285 if (m_typeface) |
286 return m_typeface.get(); | 286 return m_typeface.get(); |
287 | 287 |
288 m_typeface = adoptRef(SkCreateTypefaceFromCTFont(ctFont())); | 288 m_typeface = adoptRef(SkCreateTypefaceFromCTFont(ctFont())); |
289 return m_typeface.get(); | 289 return m_typeface.get(); |
290 } | 290 } |
291 | 291 |
292 #if OS(MACOSX) | 292 #if OS(MACOSX) |
293 static bool isAATFont(CTFontRef ctFont) | |
294 { | |
295 CFDataRef table = CTFontCopyTable(ctFont, kCTFontTableMort, 0); | |
296 if (table) { | |
297 CFRelease(table); | |
298 return true; | |
299 } | |
300 table = CTFontCopyTable(ctFont, kCTFontTableMorx, 0); | |
301 if (table) { | |
302 CFRelease(table); | |
303 return true; | |
304 } | |
305 return false; | |
306 } | |
307 | |
308 HarfBuzzFace* FontPlatformData::harfBuzzFace() | 293 HarfBuzzFace* FontPlatformData::harfBuzzFace() |
309 { | 294 { |
310 CTFontRef font = ctFont(); | 295 CTFontRef font = ctFont(); |
311 // HarfBuzz can't handle AAT font | |
312 if (isAATFont(font)) | |
313 return 0; | |
314 | |
315 if (!m_harfBuzzFace) { | 296 if (!m_harfBuzzFace) { |
316 uint64_t uniqueID = reinterpret_cast<uintptr_t>(font); | 297 uint64_t uniqueID = reinterpret_cast<uintptr_t>(font); |
317 m_harfBuzzFace = HarfBuzzFace::create(const_cast<FontPlatformData*>(this
), uniqueID); | 298 m_harfBuzzFace = HarfBuzzFace::create(const_cast<FontPlatformData*>(this
), uniqueID); |
318 } | 299 } |
319 return m_harfBuzzFace.get(); | 300 return m_harfBuzzFace.get(); |
320 } | 301 } |
321 #endif | 302 #endif |
322 | 303 |
323 #ifndef NDEBUG | 304 #ifndef NDEBUG |
324 String FontPlatformData::description() const | 305 String FontPlatformData::description() const |
325 { | 306 { |
326 RetainPtr<CFStringRef> cgFontDescription(AdoptCF, CFCopyDescription(cgFont()
)); | 307 RetainPtr<CFStringRef> cgFontDescription(AdoptCF, CFCopyDescription(cgFont()
)); |
327 return String(cgFontDescription.get()) + " " + String::number(m_size) | 308 return String(cgFontDescription.get()) + " " + String::number(m_size) |
328 + (m_syntheticBold ? " synthetic bold" : "") + (m_syntheticOblique ?
" synthetic oblique" : "") + (m_orientation ? " vertical orientation" : ""); | 309 + (m_syntheticBold ? " synthetic bold" : "") + (m_syntheticOblique ?
" synthetic oblique" : "") + (m_orientation ? " vertical orientation" : ""); |
329 } | 310 } |
330 #endif | 311 #endif |
331 | 312 |
332 } // namespace WebCore | 313 } // namespace WebCore |
OLD | NEW |