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

Side by Side Diff: Source/platform/fonts/mac/ComplexTextControllerCoreText.mm

Issue 99103006: Moving GraphicsContext and dependencies from core to platform. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Final patch - fixes Android Created 7 years 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) 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * 12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND AN Y 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND AN Y
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
15 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 15 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
16 * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR AN Y 16 * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR AN Y
17 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 17 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
18 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 18 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
19 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND O N 19 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND O N
20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
22 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 22 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 */ 23 */
24 24
25 #include "config.h" 25 #include "config.h"
26 26
27 #include "core/platform/graphics/mac/ComplexTextController.h" 27 #include "platform/fonts/mac/ComplexTextController.h"
28 28
29 #include "core/platform/graphics/Font.h" 29 #include "platform/fonts/Font.h"
30 #include "core/platform/graphics/FontCache.h" 30 #include "platform/fonts/FontCache.h"
31 #include "platform/graphics/TextRun.h" 31 #include "platform/graphics/TextRun.h"
32 32
33 #include <ApplicationServices/ApplicationServices.h> 33 #include <ApplicationServices/ApplicationServices.h>
34 #import <AvailabilityMacros.h> 34 #import <AvailabilityMacros.h>
35 35
36 // Forward declare Mac SPIs. 36 // Forward declare Mac SPIs.
37 extern "C" { 37 extern "C" {
38 // Request for public API: rdar://13803619 38 // Request for public API: rdar://13803619
39 CTLineRef CTLineCreateWithUniCharProvider(const UniChar* (*provide)(CFIndex stri ngIndex, CFIndex* charCount, CFDictionaryRef* attributes, void* context), void ( *dispose)(const UniChar* chars, void* context), void* context); 39 CTLineRef CTLineCreateWithUniCharProvider(const UniChar* (*provide)(CFIndex stri ngIndex, CFIndex* charCount, CFDictionaryRef* attributes, void* context), void ( *dispose)(const UniChar* chars, void* context), void* context);
40 } 40 }
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 // If there is no matching font, look up by name in the font cac he. 268 // If there is no matching font, look up by name in the font cac he.
269 if (!runFontData) { 269 if (!runFontData) {
270 // Rather than using runFont as an NSFont and wrapping it in a FontPlatformData, go through 270 // Rather than using runFont as an NSFont and wrapping it in a FontPlatformData, go through
271 // the font cache and ultimately through NSFontManager in or der to get an NSFont with the right 271 // the font cache and ultimately through NSFontManager in or der to get an NSFont with the right
272 // NSFontRenderingMode. 272 // NSFontRenderingMode.
273 RetainPtr<CFStringRef> fontName(AdoptCF, CTFontCopyPostScrip tName(runFont)); 273 RetainPtr<CFStringRef> fontName(AdoptCF, CTFontCopyPostScrip tName(runFont));
274 if (CFEqual(fontName.get(), CFSTR("LastResort"))) { 274 if (CFEqual(fontName.get(), CFSTR("LastResort"))) {
275 m_complexTextRuns.append(ComplexTextRun::create(m_font.p rimaryFont(), cp, stringLocation + runRange.location, runRange.length, m_run.ltr ())); 275 m_complexTextRuns.append(ComplexTextRun::create(m_font.p rimaryFont(), cp, stringLocation + runRange.location, runRange.length, m_run.ltr ()));
276 continue; 276 continue;
277 } 277 }
278 runFontData = fontCache()->getFontData(m_font.fontDescriptio n(), fontName.get(), false, DoNotRetain).get(); 278 runFontData = FontCache::fontCache()->getFontData(m_font.fon tDescription(), fontName.get(), false, DoNotRetain).get();
279 // Core Text may have used a font that is not known to NSFon tManager. In that case, fall back on 279 // Core Text may have used a font that is not known to NSFon tManager. In that case, fall back on
280 // using the font as returned, even though it may not have t he best NSFontRenderingMode. 280 // using the font as returned, even though it may not have t he best NSFontRenderingMode.
281 if (!runFontData) { 281 if (!runFontData) {
282 FontPlatformData runFontPlatformData((NSFont *)runFont, CTFontGetSize(runFont), m_font.fontDescription().usePrinterFont()); 282 FontPlatformData runFontPlatformData((NSFont *)runFont, CTFontGetSize(runFont), m_font.fontDescription().usePrinterFont());
283 runFontData = fontCache()->fontDataFromFontPlatformData( &runFontPlatformData, DoNotRetain).get(); 283 runFontData = FontCache::fontCache()->fontDataFromFontPl atformData(&runFontPlatformData, DoNotRetain).get();
284 } 284 }
285 } 285 }
286 if (m_fallbackFonts && runFontData != m_font.primaryFont()) 286 if (m_fallbackFonts && runFontData != m_font.primaryFont())
287 m_fallbackFonts->add(runFontData); 287 m_fallbackFonts->add(runFontData);
288 } 288 }
289 } 289 }
290 if (m_fallbackFonts && runFontData != m_font.primaryFont()) 290 if (m_fallbackFonts && runFontData != m_font.primaryFont())
291 m_fallbackFonts->add(fontData); 291 m_fallbackFonts->add(fontData);
292 292
293 m_complexTextRuns.append(ComplexTextRun::create(ctRun, runFontData, cp, stringLocation, length, runRange)); 293 m_complexTextRuns.append(ComplexTextRun::create(ctRun, runFontData, cp, stringLocation, length, runRange));
294 } 294 }
295 } 295 }
296 296
297 } // namespace WebCore 297 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/platform/fonts/mac/ComplexTextController.cpp ('k') | Source/platform/fonts/mac/FontCacheMac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698