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 28 matching lines...) Expand all Loading... |
39 extern "C" { | 39 extern "C" { |
40 void CGFontGetGlyphsForUnichars(CGFontRef font, const UniChar chars[], CGGlyph g
lyphs[], size_t length); | 40 void CGFontGetGlyphsForUnichars(CGFontRef font, const UniChar chars[], CGGlyph g
lyphs[], size_t length); |
41 } | 41 } |
42 | 42 |
43 namespace WebCore { | 43 namespace WebCore { |
44 | 44 |
45 static bool shouldUseCoreText(UChar* buffer, unsigned bufferLength, const Simple
FontData* fontData) | 45 static bool shouldUseCoreText(UChar* buffer, unsigned bufferLength, const Simple
FontData* fontData) |
46 { | 46 { |
47 if (fontData->platformData().isCompositeFontReference()) | 47 if (fontData->platformData().isCompositeFontReference()) |
48 return true; | 48 return true; |
| 49 |
| 50 // CoreText doesn't have vertical glyphs of surrogate pair characters. |
| 51 // Therefore, we should not use CoreText, but this always returns horizontal
glyphs. |
| 52 // FIXME: We should use vertical glyphs. https://code.google.com/p/chromium/
issues/detail?id=340173 |
| 53 if (bufferLength >= 2 && U_IS_SURROGATE(buffer[0]) && fontData->hasVerticalG
lyphs()) { |
| 54 ASSERT(U_IS_SURROGATE_LEAD(buffer[0])); |
| 55 ASSERT(U_IS_TRAIL(buffer[1])); |
| 56 return false; |
| 57 } |
| 58 |
49 if (fontData->platformData().widthVariant() != RegularWidth || fontData->has
VerticalGlyphs()) { | 59 if (fontData->platformData().widthVariant() != RegularWidth || fontData->has
VerticalGlyphs()) { |
50 // Ideographs don't have a vertical variant or width variants. | 60 // Ideographs don't have a vertical variant or width variants. |
51 for (unsigned i = 0; i < bufferLength; ++i) { | 61 for (unsigned i = 0; i < bufferLength; ++i) { |
52 if (!Character::isCJKIdeograph(buffer[i])) | 62 if (!Character::isCJKIdeograph(buffer[i])) |
53 return true; | 63 return true; |
54 } | 64 } |
55 } | 65 } |
56 | 66 |
57 return false; | 67 return false; |
58 } | 68 } |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 } | 170 } |
161 } | 171 } |
162 } | 172 } |
163 } | 173 } |
164 } | 174 } |
165 | 175 |
166 return haveGlyphs; | 176 return haveGlyphs; |
167 } | 177 } |
168 | 178 |
169 } // namespace WebCore | 179 } // namespace WebCore |
OLD | NEW |