Changeset 61001 in webkit


Ignore:
Timestamp:
Jun 11, 2010 2:58:29 AM (14 years ago)
Author:
jocelyn.turcotte@nokia.com
Message:

Move the text code path detection code from FontFastPath.cpp to Font.cpp.
https://bugs.webkit.org/show_bug.cgi?id=40077

Reviewed by Simon Hausmann.

This is a patch preliminary to the implementation of the
simple font code path for the Qt port.

  • platform/graphics/Font.cpp:

(WebCore::Font::setCodePath):
(WebCore::Font::codePath):

  • platform/graphics/Font.h:
  • platform/graphics/FontFastPath.cpp:
Location:
trunk/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r61000 r61001  
     12010-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
    1172010-06-11  Sterling Swigart  <sswigart@google.com>
    218
  • trunk/WebCore/platform/graphics/Font.cpp

    r60063 r61001  
    5050    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
    5151};
     52#endif
    5253
    5354Font::CodePath Font::s_codePath = Auto;
    54 #endif
    5555
    5656// ============================================================================================
     
    269269}
    270270
    271 }
     271void Font::setCodePath(CodePath p)
     272{
     273    s_codePath = p;
     274}
     275
     276Font::CodePath Font::codePath()
     277{
     278    return s_codePath;
     279}
     280
     281Font::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  
    152152    static bool shouldUseSmoothing();
    153153
    154 #if USE(FONT_FAST_PATH)
    155154    enum CodePath { Auto, Simple, Complex, SimpleWithGlyphOverflow };
    156 #endif
    157155
    158156private:
     
    166164
    167165#if USE(FONT_FAST_PATH)
    168     CodePath codePath(const TextRun&) const;
    169166    void drawSimpleText(GraphicsContext*, const TextRun&, const FloatPoint&, int from, int to) const;
    170167    void drawGlyphs(GraphicsContext*, const SimpleFontData*, const GlyphBuffer&, int from, int to, const FloatPoint&) const;
     
    177174#endif
    178175
     176    CodePath codePath(const TextRun&) const;
    179177    void drawComplexText(GraphicsContext*, const TextRun&, const FloatPoint&, int from, int to) const;
    180178    float floatWidthForComplexText(const TextRun&, HashSet<const SimpleFontData*>* fallbackFonts = 0, GlyphOverflow* = 0) const;
     
    186184public:
    187185    // Useful for debugging the different font rendering code paths.
    188 #if USE(FONT_FAST_PATH)
    189186    static void setCodePath(CodePath);
    190187    static CodePath codePath();
    191188    static CodePath s_codePath;
    192189
     190#if USE(FONT_FAST_PATH)
    193191    static const uint8_t gRoundingHackCharacterTable[256];
    194192    static bool isRoundingHackCharacter(UChar32 c)
  • trunk/WebCore/platform/graphics/FontFastPath.cpp

    r58585 r61001  
    181181}
    182182
    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) const
    194 {
    195     if (s_codePath != Auto)
    196         return s_codePath;
    197 
    198     // Start from 0 since drawing and highlighting also measure the characters before run->from
    199     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 marks
    202             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 Hafukha
    207             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, Myanmar
    212             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, Mongolian
    222             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 diacritics
    232             continue;
    233         if (c <= 0x2000)
    234             return SimpleWithGlyphOverflow;
    235 
    236         if (c < 0x20D0)     // U+20D0 through U+20FF Combining marks for symbols
    237             continue;
    238         if (c <= 0x20FF)
    239             return Complex;
    240 
    241         if (c < 0xFE20)     // U+FE20 through U+FE2F Combining half marks
    242             continue;
    243         if (c <= 0xFE2F)
    244             return Complex;
    245     }
    246 
    247     if (typesettingFeatures())
    248         return Complex;
    249 
    250     return Simple;
    251 }
    252 
    253183void Font::drawSimpleText(GraphicsContext* context, const TextRun& run, const FloatPoint& point, int from, int to) const
    254184{
Note: See TracChangeset for help on using the changeset viewer.