Changeset 25611 in webkit


Ignore:
Timestamp:
Sep 17, 2007 5:36:51 PM (17 years ago)
Author:
hyatt
Message:

Fix for 14743, missing glyphs because of mlang's tiny font cache.

Location:
trunk/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r25610 r25611  
     12007-09-17  Dave Hyatt  <hyatt@apple.com>
     2
     3        Fix for bug 14743, missing glyphs on many international sites because of MLang's tiny cache.
     4       
     5        Bypass Mlang's cache entirely.  Get the mapped font from MLang, obtain the font name, and then feed
     6        the name back into our own system so that it gets created and cached again without MLang being involved.
     7        Then free up the font obtained from MLang immediately so that its cache just remains empty.
     8           
     9        Reviewed by aroben
     10
     11        * platform/FontData.h:
     12        (WebCore::FontData::isSystemFont):
     13        * platform/win/FontCacheWin.cpp:
     14        (WebCore::FontCache::getFontDataForCharacters):
     15        * platform/win/FontDataWin.cpp:
     16        (WebCore::FontData::platformInit):
     17        (WebCore::FontData::platformDestroy):
     18        * platform/win/UniscribeController.cpp:
     19        (WebCore::UniscribeController::shapeAndPlaceItem):
     20       
    1212007-09-17  Adam Roben  <aroben@apple.com>
    222
  • trunk/WebCore/platform/FontData.h

    r24835 r25611  
    8686#if PLATFORM(WIN)
    8787    bool isSystemFont() const { return m_isSystemFont; }
    88     void setIsMLangFont() { m_isMLangFont = true; }
    8988    SCRIPT_FONTPROPERTIES* scriptFontProperties() const;
    9089    SCRIPT_CACHE* scriptCache() const { return &m_scriptCache; }
     
    132131
    133132#if PLATFORM(WIN)
    134     bool m_isMLangFont;
    135133    bool m_isSystemFont;
    136134    mutable SCRIPT_CACHE m_scriptCache;
  • trunk/WebCore/platform/win/FontCacheWin.cpp

    r25543 r25611  
    8585        HFONT result;
    8686        if (langFontLink->MapFont(hdc, actualCodePages, characters[0], &result) == S_OK) {
    87             // MLang has an internal cache, which means it really will hand back the same HFONT pointer if it can.  We can
    88             // therefore safely use our hash on HFONT pointers (FontPlatformData -> FontData) and actually expect it to work.
    89             FontPlatformData platformData(result, font.fontDescription().computedPixelSize(), font.fontDescription().bold(), font.fontDescription().italic());
    90             fontData = getCachedFontData(&platformData);
    91             fontData->setIsMLangFont();
     87            // Fill in a log font with the returned font from MLang, and then use that to create a new font.
     88            LOGFONT lf;
     89            GetObject(result, sizeof(LOGFONT), &lf);
     90            langFontLink->ReleaseFont(result);
     91
     92            HFONT hfont = CreateFontIndirect(&lf);
     93            SelectObject(hdc, hfont);
     94
     95            WCHAR name[LF_FACESIZE];
     96            GetTextFace(hdc, LF_FACESIZE, name);
     97           
     98            String familyName(name);
     99            if (!familyName.isEmpty()) {
     100                FontPlatformData* result = getCachedFontPlatformData(font.fontDescription(), familyName);
     101                if (result)
     102                    return getCachedFontData(result);
     103            }
    92104        }
    93105    }
  • trunk/WebCore/platform/win/FontDataWin.cpp

    r25543 r25611  
    5959    GetTextFace(dc, faceLength, faceName.data());
    6060
    61     m_isMLangFont = false;
    62 
    6361    m_syntheticBoldOffset = m_font.syntheticBold() ? 1.0f : 0.f;
    6462
     
    114112{
    115113    CGFontRelease(m_font.cgFont());
    116 
    117     if (m_isMLangFont) {
    118         // We have to release the font instead of just deleting it, since we didn't make it.
    119         IMLangFontLink2* langFontLink = FontCache::getFontLinkInterface();
    120         if (langFontLink)
    121             langFontLink->ReleaseFont(m_font.hfont());
    122     } else
    123         DeleteObject(m_font.hfont());
     114    DeleteObject(m_font.hfont());
    124115
    125116    // We don't hash this on Win32, so it's effectively owned by us.
  • trunk/WebCore/platform/win/UniscribeController.cpp

    r25543 r25611  
    244244
    245245    // We now have a collection of glyphs.
    246     // FIXME: Use the cluster and visual attr information to do letter-spacing, word-spacing
    247     // and justification.
    248     // FIXME: Support rounding hacks.
    249     // FIXME: Support smallcaps (re-itemize and re-shape to do this?).
    250246    Vector<GOFFSET> offsets;
    251247    Vector<int> advances;
Note: See TracChangeset for help on using the changeset viewer.