Changeset 61001 in webkit
- Timestamp:
- Jun 11, 2010 2:58:29 AM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r61000 r61001 1 2010-06-03 Jocelyn Turcotte <jocelyn.turcotte@nokia.com> 2 3 Reviewed by Simon Hausmann. 4 5 Move the text code path detection code from FontFastPath.cpp to Font.cpp. 6 https://bugs.webkit.org/show_bug.cgi?id=40077 7 8 This is a patch preliminary to the implementation of the 9 simple font code path for the Qt port. 10 11 * platform/graphics/Font.cpp: 12 (WebCore::Font::setCodePath): 13 (WebCore::Font::codePath): 14 * platform/graphics/Font.h: 15 * platform/graphics/FontFastPath.cpp: 16 1 17 2010-06-11 Sterling Swigart <sswigart@google.com> 2 18 -
trunk/WebCore/platform/graphics/Font.cpp
r60063 r61001 50 50 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 51 51 }; 52 #endif 52 53 53 54 Font::CodePath Font::s_codePath = Auto; 54 #endif55 55 56 56 // ============================================================================================ … … 269 269 } 270 270 271 } 271 void Font::setCodePath(CodePath p) 272 { 273 s_codePath = p; 274 } 275 276 Font::CodePath Font::codePath() 277 { 278 return s_codePath; 279 } 280 281 Font::CodePath Font::codePath(const TextRun& run) const 282 { 283 if (s_codePath != Auto) 284 return s_codePath; 285 286 // Start from 0 since drawing and highlighting also measure the characters before run->from 287 for (int i = 0; i < run.length(); i++) { 288 const UChar c = run[i]; 289 if (c < 0x300) // U+0300 through U+036F Combining diacritical marks 290 continue; 291 if (c <= 0x36F) 292 return Complex; 293 294 if (c < 0x0591 || c == 0x05BE) // U+0591 through U+05CF excluding U+05BE Hebrew combining marks, Hebrew punctuation Paseq, Sof Pasuq and Nun Hafukha 295 continue; 296 if (c <= 0x05CF) 297 return Complex; 298 299 if (c < 0x0600) // U+0600 through U+1059 Arabic, Syriac, Thaana, Devanagari, Bengali, Gurmukhi, Gujarati, Oriya, Tamil, Telugu, Kannada, Malayalam, Sinhala, Thai, Lao, Tibetan, Myanmar 300 continue; 301 if (c <= 0x1059) 302 return Complex; 303 304 if (c < 0x1100) // U+1100 through U+11FF Hangul Jamo (only Ancient Korean should be left here if you precompose; Modern Korean will be precomposed as a result of step A) 305 continue; 306 if (c <= 0x11FF) 307 return Complex; 308 309 if (c < 0x1780) // U+1780 through U+18AF Khmer, Mongolian 310 continue; 311 if (c <= 0x18AF) 312 return Complex; 313 314 if (c < 0x1900) // U+1900 through U+194F Limbu (Unicode 4.0) 315 continue; 316 if (c <= 0x194F) 317 return Complex; 318 319 if (c < 0x1E00) // U+1E00 through U+2000 characters with diacritics and stacked diacritics 320 continue; 321 if (c <= 0x2000) 322 return SimpleWithGlyphOverflow; 323 324 if (c < 0x20D0) // U+20D0 through U+20FF Combining marks for symbols 325 continue; 326 if (c <= 0x20FF) 327 return Complex; 328 329 if (c < 0xFE20) // U+FE20 through U+FE2F Combining half marks 330 continue; 331 if (c <= 0xFE2F) 332 return Complex; 333 } 334 335 if (typesettingFeatures()) 336 return Complex; 337 338 return Simple; 339 } 340 341 } -
trunk/WebCore/platform/graphics/Font.h
r60063 r61001 152 152 static bool shouldUseSmoothing(); 153 153 154 #if USE(FONT_FAST_PATH)155 154 enum CodePath { Auto, Simple, Complex, SimpleWithGlyphOverflow }; 156 #endif157 155 158 156 private: … … 166 164 167 165 #if USE(FONT_FAST_PATH) 168 CodePath codePath(const TextRun&) const;169 166 void drawSimpleText(GraphicsContext*, const TextRun&, const FloatPoint&, int from, int to) const; 170 167 void drawGlyphs(GraphicsContext*, const SimpleFontData*, const GlyphBuffer&, int from, int to, const FloatPoint&) const; … … 177 174 #endif 178 175 176 CodePath codePath(const TextRun&) const; 179 177 void drawComplexText(GraphicsContext*, const TextRun&, const FloatPoint&, int from, int to) const; 180 178 float floatWidthForComplexText(const TextRun&, HashSet<const SimpleFontData*>* fallbackFonts = 0, GlyphOverflow* = 0) const; … … 186 184 public: 187 185 // Useful for debugging the different font rendering code paths. 188 #if USE(FONT_FAST_PATH)189 186 static void setCodePath(CodePath); 190 187 static CodePath codePath(); 191 188 static CodePath s_codePath; 192 189 190 #if USE(FONT_FAST_PATH) 193 191 static const uint8_t gRoundingHackCharacterTable[256]; 194 192 static bool isRoundingHackCharacter(UChar32 c) -
trunk/WebCore/platform/graphics/FontFastPath.cpp
r58585 r61001 181 181 } 182 182 183 void Font::setCodePath(CodePath p)184 {185 s_codePath = p;186 }187 188 Font::CodePath Font::codePath()189 {190 return s_codePath;191 }192 193 Font::CodePath Font::codePath(const TextRun& run) const194 {195 if (s_codePath != Auto)196 return s_codePath;197 198 // Start from 0 since drawing and highlighting also measure the characters before run->from199 for (int i = 0; i < run.length(); i++) {200 const UChar c = run[i];201 if (c < 0x300) // U+0300 through U+036F Combining diacritical marks202 continue;203 if (c <= 0x36F)204 return Complex;205 206 if (c < 0x0591 || c == 0x05BE) // U+0591 through U+05CF excluding U+05BE Hebrew combining marks, Hebrew punctuation Paseq, Sof Pasuq and Nun Hafukha207 continue;208 if (c <= 0x05CF)209 return Complex;210 211 if (c < 0x0600) // U+0600 through U+1059 Arabic, Syriac, Thaana, Devanagari, Bengali, Gurmukhi, Gujarati, Oriya, Tamil, Telugu, Kannada, Malayalam, Sinhala, Thai, Lao, Tibetan, Myanmar212 continue;213 if (c <= 0x1059)214 return Complex;215 216 if (c < 0x1100) // U+1100 through U+11FF Hangul Jamo (only Ancient Korean should be left here if you precompose; Modern Korean will be precomposed as a result of step A)217 continue;218 if (c <= 0x11FF)219 return Complex;220 221 if (c < 0x1780) // U+1780 through U+18AF Khmer, Mongolian222 continue;223 if (c <= 0x18AF)224 return Complex;225 226 if (c < 0x1900) // U+1900 through U+194F Limbu (Unicode 4.0)227 continue;228 if (c <= 0x194F)229 return Complex;230 231 if (c < 0x1E00) // U+1E00 through U+2000 characters with diacritics and stacked diacritics232 continue;233 if (c <= 0x2000)234 return SimpleWithGlyphOverflow;235 236 if (c < 0x20D0) // U+20D0 through U+20FF Combining marks for symbols237 continue;238 if (c <= 0x20FF)239 return Complex;240 241 if (c < 0xFE20) // U+FE20 through U+FE2F Combining half marks242 continue;243 if (c <= 0xFE2F)244 return Complex;245 }246 247 if (typesettingFeatures())248 return Complex;249 250 return Simple;251 }252 253 183 void Font::drawSimpleText(GraphicsContext* context, const TextRun& run, const FloatPoint& point, int from, int to) const 254 184 {
Note: See TracChangeset
for help on using the changeset viewer.