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

Side by Side Diff: Source/core/platform/graphics/mac/SimpleFontDataMac.mm

Issue 14325012: Remove the dynamic initialization of WebKitSystemInterface. Just call into the library directly. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: '' Created 7 years, 8 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) 2005, 2006, 2010, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2005, 2006, 2010, 2011 Apple Inc. All rights reserved.
3 * Copyright (C) 2006 Alexey Proskuryakov 3 * Copyright (C) 2006 Alexey Proskuryakov
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 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 float SimpleFontData::platformWidthForGlyph(Glyph glyph) const 386 float SimpleFontData::platformWidthForGlyph(Glyph glyph) const
387 { 387 {
388 CGSize advance = CGSizeZero; 388 CGSize advance = CGSizeZero;
389 if (platformData().orientation() == Horizontal || m_isBrokenIdeographFallbac k) { 389 if (platformData().orientation() == Horizontal || m_isBrokenIdeographFallbac k) {
390 NSFont *font = platformData().font(); 390 NSFont *font = platformData().font();
391 if (font && platformData().isColorBitmapFont()) 391 if (font && platformData().isColorBitmapFont())
392 advance = NSSizeToCGSize([font advancementForGlyph:glyph]); 392 advance = NSSizeToCGSize([font advancementForGlyph:glyph]);
393 else { 393 else {
394 float pointSize = platformData().m_size; 394 float pointSize = platformData().m_size;
395 CGAffineTransform m = CGAffineTransformMakeScale(pointSize, pointSiz e); 395 CGAffineTransform m = CGAffineTransformMakeScale(pointSize, pointSiz e);
396 if (!wkGetGlyphTransformedAdvances(platformData().cgFont(), font, &m , &glyph, &advance)) { 396 if (!WKGetGlyphTransformedAdvances(platformData().cgFont(), font, &m , &glyph, &advance)) {
397 LOG_ERROR("Unable to cache glyph widths for %@ %f", [font displa yName], pointSize); 397 LOG_ERROR("Unable to cache glyph widths for %@ %f", [font displa yName], pointSize);
398 advance.width = 0; 398 advance.width = 0;
399 } 399 }
400 } 400 }
401 } else 401 } else
402 CTFontGetAdvancesForGlyphs(m_platformData.ctFont(), kCTFontVerticalOrien tation, &glyph, &advance, 1); 402 CTFontGetAdvancesForGlyphs(m_platformData.ctFont(), kCTFontVerticalOrien tation, &glyph, &advance, 1);
403 403
404 return advance.width + m_syntheticBoldOffset; 404 return advance.width + m_syntheticBoldOffset;
405 } 405 }
406 406
(...skipping 21 matching lines...) Expand all
428 if (!m_combiningCharacterSequenceSupport) 428 if (!m_combiningCharacterSequenceSupport)
429 m_combiningCharacterSequenceSupport = adoptPtr(new HashMap<String, bool> ); 429 m_combiningCharacterSequenceSupport = adoptPtr(new HashMap<String, bool> );
430 430
431 WTF::HashMap<String, bool>::AddResult addResult = m_combiningCharacterSequen ceSupport->add(String(characters, length), false); 431 WTF::HashMap<String, bool>::AddResult addResult = m_combiningCharacterSequen ceSupport->add(String(characters, length), false);
432 if (!addResult.isNewEntry) 432 if (!addResult.isNewEntry)
433 return addResult.iterator->value; 433 return addResult.iterator->value;
434 434
435 RetainPtr<CGFontRef> cgFont(AdoptCF, CTFontCopyGraphicsFont(platformData().c tFont(), 0)); 435 RetainPtr<CGFontRef> cgFont(AdoptCF, CTFontCopyGraphicsFont(platformData().c tFont(), 0));
436 436
437 ProviderInfo info = { characters, length, getCFStringAttributes(0, platformD ata().orientation()) }; 437 ProviderInfo info = { characters, length, getCFStringAttributes(0, platformD ata().orientation()) };
438 RetainPtr<CTLineRef> line(AdoptCF, wkCreateCTLineWithUniCharProvider(&provid eStringAndAttributes, 0, &info)); 438 RetainPtr<CTLineRef> line(AdoptCF, WKCreateCTLineWithUniCharProvider(&provid eStringAndAttributes, 0, &info));
439 439
440 CFArrayRef runArray = CTLineGetGlyphRuns(line.get()); 440 CFArrayRef runArray = CTLineGetGlyphRuns(line.get());
441 CFIndex runCount = CFArrayGetCount(runArray); 441 CFIndex runCount = CFArrayGetCount(runArray);
442 442
443 for (CFIndex r = 0; r < runCount; r++) { 443 for (CFIndex r = 0; r < runCount; r++) {
444 CTRunRef ctRun = static_cast<CTRunRef>(CFArrayGetValueAtIndex(runArray, r)); 444 CTRunRef ctRun = static_cast<CTRunRef>(CFArrayGetValueAtIndex(runArray, r));
445 ASSERT(CFGetTypeID(ctRun) == CTRunGetTypeID()); 445 ASSERT(CFGetTypeID(ctRun) == CTRunGetTypeID());
446 CFDictionaryRef runAttributes = CTRunGetAttributes(ctRun); 446 CFDictionaryRef runAttributes = CTRunGetAttributes(ctRun);
447 CTFontRef runFont = static_cast<CTFontRef>(CFDictionaryGetValue(runAttri butes, kCTFontAttributeName)); 447 CTFontRef runFont = static_cast<CTFontRef>(CFDictionaryGetValue(runAttri butes, kCTFontAttributeName));
448 RetainPtr<CGFontRef> runCGFont(AdoptCF, CTFontCopyGraphicsFont(runFont, 0)); 448 RetainPtr<CGFontRef> runCGFont(AdoptCF, CTFontCopyGraphicsFont(runFont, 0));
449 if (!CFEqual(runCGFont.get(), cgFont.get())) 449 if (!CFEqual(runCGFont.get(), cgFont.get()))
450 return false; 450 return false;
451 } 451 }
452 452
453 addResult.iterator->value = true; 453 addResult.iterator->value = true;
454 return true; 454 return true;
455 } 455 }
456 456
457 } // namespace WebCore 457 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/platform/graphics/mac/GlyphPageTreeNodeMac.cpp ('k') | Source/core/platform/mac/ThemeMac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698