OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007 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 * | 7 * |
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 16 matching lines...) Expand all Loading... | |
27 */ | 27 */ |
28 | 28 |
29 #include "config.h" | 29 #include "config.h" |
30 #include "core/platform/graphics/GlyphPageTreeNode.h" | 30 #include "core/platform/graphics/GlyphPageTreeNode.h" |
31 | 31 |
32 #include <ApplicationServices/ApplicationServices.h> | 32 #include <ApplicationServices/ApplicationServices.h> |
33 #include "core/platform/graphics/Font.h" | 33 #include "core/platform/graphics/Font.h" |
34 #include "core/platform/graphics/SimpleFontData.h" | 34 #include "core/platform/graphics/SimpleFontData.h" |
35 #include "core/platform/mac/WebCoreSystemInterface.h" | 35 #include "core/platform/mac/WebCoreSystemInterface.h" |
36 | 36 |
37 // Forward declare Mac SPIs. | |
38 extern "C" { | |
39 void CGFontGetGlyphsForUnichars(CGFontRef font, const UniChar chars[], CGGlyph g lyphs[], size_t length); | |
40 } | |
41 | |
37 namespace WebCore { | 42 namespace WebCore { |
38 | 43 |
39 static bool shouldUseCoreText(UChar* buffer, unsigned bufferLength, const Simple FontData* fontData) | 44 static bool shouldUseCoreText(UChar* buffer, unsigned bufferLength, const Simple FontData* fontData) |
40 { | 45 { |
41 if (fontData->platformData().isCompositeFontReference()) | 46 if (fontData->platformData().isCompositeFontReference()) |
42 return true; | 47 return true; |
43 if (fontData->platformData().widthVariant() != RegularWidth || fontData->has VerticalGlyphs()) { | 48 if (fontData->platformData().widthVariant() != RegularWidth || fontData->has VerticalGlyphs()) { |
44 // Ideographs don't have a vertical variant or width variants. | 49 // Ideographs don't have a vertical variant or width variants. |
45 for (unsigned i = 0; i < bufferLength; ++i) { | 50 for (unsigned i = 0; i < bufferLength; ++i) { |
46 if (!Font::isCJKIdeograph(buffer[i])) | 51 if (!Font::isCJKIdeograph(buffer[i])) |
47 return true; | 52 return true; |
48 } | 53 } |
49 } | 54 } |
50 | 55 |
51 return false; | 56 return false; |
52 } | 57 } |
53 | 58 |
54 bool GlyphPage::fill(unsigned offset, unsigned length, UChar* buffer, unsigned b ufferLength, const SimpleFontData* fontData) | 59 bool GlyphPage::fill(unsigned offset, unsigned length, UChar* buffer, unsigned b ufferLength, const SimpleFontData* fontData) |
55 { | 60 { |
56 bool haveGlyphs = false; | 61 bool haveGlyphs = false; |
57 | 62 |
58 Vector<CGGlyph, 512> glyphs(bufferLength); | 63 Vector<CGGlyph, 512> glyphs(bufferLength); |
59 if (!shouldUseCoreText(buffer, bufferLength, fontData)) { | 64 if (!shouldUseCoreText(buffer, bufferLength, fontData)) { |
60 WKGetGlyphsForCharacters(fontData->platformData().cgFont(), buffer, glyp hs.data(), bufferLength); | 65 CGFontGetGlyphsForUnichars(fontData->platformData().cgFont(), buffer, gl yphs.data(), bufferLength); |
Nico
2013/05/01 01:02:18
Same question.
Robert Sesek
2013/05/01 23:58:43
Done.
| |
61 for (unsigned i = 0; i < length; ++i) { | 66 for (unsigned i = 0; i < length; ++i) { |
62 if (!glyphs[i]) | 67 if (!glyphs[i]) |
63 setGlyphDataForIndex(offset + i, 0, 0); | 68 setGlyphDataForIndex(offset + i, 0, 0); |
64 else { | 69 else { |
65 setGlyphDataForIndex(offset + i, glyphs[i], fontData); | 70 setGlyphDataForIndex(offset + i, glyphs[i], fontData); |
66 haveGlyphs = true; | 71 haveGlyphs = true; |
67 } | 72 } |
68 } | 73 } |
69 } else if (!fontData->platformData().isCompositeFontReference() && ((fontDat a->platformData().widthVariant() == RegularWidth) ? WKGetVerticalGlyphsForCharac ters(fontData->platformData().ctFont(), buffer, glyphs.data(), bufferLength) | 74 } else if (!fontData->platformData().isCompositeFontReference() && ((fontDat a->platformData().widthVariant() == RegularWidth) ? WKGetVerticalGlyphsForCharac ters(fontData->platformData().ctFont(), buffer, glyphs.data(), bufferLength) |
70 : CTFontGetGlyphsForCharacters(fontData->platformData().ctFont(), buffer, glyphs.data(), bufferLength))) { | 75 : CTFontGetGlyphsForCharacters(fontData->platformData().ctFont(), buffer, glyphs.data(), bufferLength))) { |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
154 } | 159 } |
155 } | 160 } |
156 } | 161 } |
157 } | 162 } |
158 } | 163 } |
159 | 164 |
160 return haveGlyphs; | 165 return haveGlyphs; |
161 } | 166 } |
162 | 167 |
163 } // namespace WebCore | 168 } // namespace WebCore |
OLD | NEW |