Chromium Code Reviews| 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 14 matching lines...) Expand all Loading... | |
| 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 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" | |
| 36 | 35 |
| 37 // Forward declare Mac SPIs. | 36 // Forward declare Mac SPIs. |
| 38 // Request for public API: rdar://13787589 | 37 // Request for public API: rdar://13787589 |
| 39 extern "C" { | 38 extern "C" { |
| 40 void CGFontGetGlyphsForUnichars(CGFontRef font, const UniChar chars[], CGGlyph g lyphs[], size_t length); | 39 void CGFontGetGlyphsForUnichars(CGFontRef font, const UniChar chars[], CGGlyph g lyphs[], size_t length); |
| 41 } | 40 } |
| 42 | 41 |
| 43 namespace WebCore { | 42 namespace WebCore { |
| 44 | 43 |
| 45 static bool shouldUseCoreText(UChar* buffer, unsigned bufferLength, const Simple FontData* fontData) | 44 static bool shouldUseCoreText(UChar* buffer, unsigned bufferLength, const Simple FontData* fontData) |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 65 if (!shouldUseCoreText(buffer, bufferLength, fontData)) { | 64 if (!shouldUseCoreText(buffer, bufferLength, fontData)) { |
| 66 CGFontGetGlyphsForUnichars(fontData->platformData().cgFont(), buffer, gl yphs.data(), bufferLength); | 65 CGFontGetGlyphsForUnichars(fontData->platformData().cgFont(), buffer, gl yphs.data(), bufferLength); |
| 67 for (unsigned i = 0; i < length; ++i) { | 66 for (unsigned i = 0; i < length; ++i) { |
| 68 if (!glyphs[i]) | 67 if (!glyphs[i]) |
| 69 setGlyphDataForIndex(offset + i, 0, 0); | 68 setGlyphDataForIndex(offset + i, 0, 0); |
| 70 else { | 69 else { |
| 71 setGlyphDataForIndex(offset + i, glyphs[i], fontData); | 70 setGlyphDataForIndex(offset + i, glyphs[i], fontData); |
| 72 haveGlyphs = true; | 71 haveGlyphs = true; |
| 73 } | 72 } |
| 74 } | 73 } |
| 75 } 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() && fontData- >platformData().widthVariant() != RegularWidth |
|
Nico
2013/05/03 17:16:51
This looks like a behavior change, not just like a
Robert Sesek
2013/05/03 17:58:03
Sorry, I forgot to call that out. The function doe
| |
| 76 : CTFontGetGlyphsForCharacters(fontData->platformData().ctFont(), buffer, glyphs.data(), bufferLength))) { | 75 && CTFontGetGlyphsForCharacters(fontData->platformData().ctFont() , buffer, glyphs.data(), bufferLength)) { |
| 77 // When buffer consists of surrogate pairs, WKGetVerticalGlyphsForCharac ters and CTFontGetGlyphsForCharacters | 76 // When buffer consists of surrogate pairs, CTFontGetGlyphsForCharacters |
| 78 // place the glyphs at indices corresponding to the first character of e ach pair. | 77 // places the glyphs at indices corresponding to the first character of each pair. |
| 79 unsigned glyphStep = bufferLength / length; | 78 unsigned glyphStep = bufferLength / length; |
| 80 for (unsigned i = 0; i < length; ++i) { | 79 for (unsigned i = 0; i < length; ++i) { |
| 81 if (!glyphs[i * glyphStep]) | 80 if (!glyphs[i * glyphStep]) |
| 82 setGlyphDataForIndex(offset + i, 0, 0); | 81 setGlyphDataForIndex(offset + i, 0, 0); |
| 83 else { | 82 else { |
| 84 setGlyphDataForIndex(offset + i, glyphs[i * glyphStep], fontData ); | 83 setGlyphDataForIndex(offset + i, glyphs[i * glyphStep], fontData ); |
| 85 haveGlyphs = true; | 84 haveGlyphs = true; |
| 86 } | 85 } |
| 87 } | 86 } |
| 88 } else { | 87 } else { |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 160 } | 159 } |
| 161 } | 160 } |
| 162 } | 161 } |
| 163 } | 162 } |
| 164 } | 163 } |
| 165 | 164 |
| 166 return haveGlyphs; | 165 return haveGlyphs; |
| 167 } | 166 } |
| 168 | 167 |
| 169 } // namespace WebCore | 168 } // namespace WebCore |
| OLD | NEW |