Changeset 80489 in webkit


Ignore:
Timestamp:
Mar 7, 2011 12:43:34 PM (13 years ago)
Author:
commit-queue@webkit.org
Message:

2011-03-07 Takayoshi Kochi <kochi@chromium.org>

Reviewed by Tony Chang.

[chromium] Use preferred locale information when choosing fallback
font using fontconfig on Linux platform.
http://bugs.webkit.org/show_bug.cgi?id=55453

No new tests, as it depends on ICU and locale setting, so it will be
covered by Chromium side.

  • platform/chromium/PlatformBridge.h:
  • platform/graphics/chromium/FontCacheLinux.cpp:

2011-03-07 Takayoshi Kochi <kochi@chromium.org>

Reviewed by Tony Chang.

Use preferred locale information when choosing fallback font using
fontconfig on Linux platform.
https://bugs.webkit.org/show_bug.cgi?id=55453

Tests will be covered by Chromium side.

  • public/gtk/WebFontInfo.h: (WebKit::WebFontInfo::familyForChars): added 3rd parameter |preferredLocale|
  • public/linux/WebSandboxSupport.h: (WebKit::WebSandboxSupport::getFontFamilyForCharacters): added 3rd parameter |preferredLocale|
  • src/PlatformBridge.cpp:
  • src/gtk/WebFontInfo.cpp:
Location:
trunk/Source
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r80488 r80489  
     12011-03-07  Takayoshi Kochi  <kochi@chromium.org>
     2
     3        Reviewed by Tony Chang.
     4
     5        [chromium] Use preferred locale information when choosing fallback
     6        font using fontconfig on Linux platform.
     7        http://bugs.webkit.org/show_bug.cgi?id=55453
     8
     9        No new tests, as it depends on ICU and locale setting, so it will be
     10        covered by Chromium side.
     11
     12        * platform/chromium/PlatformBridge.h:
     13        * platform/graphics/chromium/FontCacheLinux.cpp:
     14
    1152011-03-07  Adam Barth  <abarth@webkit.org>
    216
  • trunk/Source/WebCore/platform/chromium/PlatformBridge.h

    r80177 r80489  
    151151#if OS(LINUX) || OS(FREEBSD)
    152152    static void getRenderStyleForStrike(const char* family, int sizeAndStyle, FontRenderStyle* result);
    153     static String getFontFamilyForCharacters(const UChar*, size_t numCharacters);
     153    static String getFontFamilyForCharacters(const UChar*, size_t numCharacters, const char* preferredLocale);
    154154#endif
    155155#if OS(DARWIN)
  • trunk/Source/WebCore/platform/graphics/chromium/FontCacheLinux.cpp

    r76340 r80489  
    4444#include "SkUtils.h"
    4545
     46#include <unicode/locid.h>
    4647#include <wtf/Assertions.h>
    4748#include <wtf/text/AtomicString.h>
     
    5859                                                          int length)
    5960{
    60     String family = PlatformBridge::getFontFamilyForCharacters(characters, length);
     61    icu::Locale locale = icu::Locale::getDefault();
     62    String family = PlatformBridge::getFontFamilyForCharacters(characters, length, locale.getLanguage());
    6163    if (family.isEmpty())
    6264        return 0;
  • trunk/Source/WebKit/chromium/ChangeLog

    r80482 r80489  
     12011-03-07  Takayoshi Kochi  <kochi@chromium.org>
     2
     3        Reviewed by Tony Chang.
     4
     5        Use preferred locale information when choosing fallback font using
     6        fontconfig on Linux platform.
     7        https://bugs.webkit.org/show_bug.cgi?id=55453
     8
     9        Tests will be covered by Chromium side.
     10
     11        * public/gtk/WebFontInfo.h:
     12        (WebKit::WebFontInfo::familyForChars): added 3rd parameter |preferredLocale|
     13        * public/linux/WebSandboxSupport.h:
     14        (WebKit::WebSandboxSupport::getFontFamilyForCharacters): added 3rd parameter |preferredLocale|
     15        * src/PlatformBridge.cpp:
     16        * src/gtk/WebFontInfo.cpp:
     17
    1182011-03-07  James Robinson  <jamesr@chromium.org>
    219
  • trunk/Source/WebKit/chromium/public/gtk/WebFontInfo.h

    r55089 r80489  
    4646    //   characters: a native-endian UTF16 string
    4747    //   numCharacters: the number of 16-bit words in |utf16|
     48    //   preferredLocale: preferred locale identifier for the |characters|
     49    //                    (e.g. "en", "ja", "zh-CN")
    4850    //
    4951    // Returns: the font family or an empty string if the request could not be
    5052    // satisfied.
    51     WEBKIT_API static WebCString familyForChars(const WebUChar* characters, size_t numCharacters);
     53    WEBKIT_API static WebCString familyForChars(const WebUChar* characters, size_t numCharacters, const char* preferredLocale = 0);
    5254
    5355    // Fill out the given WebFontRenderStyle with the user's preferences for
  • trunk/Source/WebKit/chromium/public/linux/WebSandboxSupport.h

    r55089 r80489  
    4848    //   characters: a UTF-16 encoded string
    4949    //   numCharacters: the number of 16-bit words in |characters|
     50    //   preferredLocale: preferred locale identifier for the |characters|
     51    //                    (e.g. "en", "ja", "zh-CN")
    5052    //
    5153    // Returns a string with the font family on an empty string if the
    5254    // request cannot be satisfied.
    53     virtual WebString getFontFamilyForCharacters(const WebUChar* characters, size_t numCharacters) = 0;
     55    virtual WebString getFontFamilyForCharacters(const WebUChar* characters, size_t numCharacters, const char* preferredLocale) = 0;
    5456    virtual void getRenderStyleForStrike(const char* family, int sizeAndStyle, WebFontRenderStyle* style) = 0;
    5557};
  • trunk/Source/WebKit/chromium/src/PlatformBridge.cpp

    r80177 r80489  
    438438
    439439#if OS(LINUX) || OS(FREEBSD)
    440 String PlatformBridge::getFontFamilyForCharacters(const UChar* characters, size_t numCharacters)
     440String PlatformBridge::getFontFamilyForCharacters(const UChar* characters, size_t numCharacters, const char* preferredLocale)
    441441{
    442442    if (webKitClient()->sandboxSupport())
    443         return webKitClient()->sandboxSupport()->getFontFamilyForCharacters(characters, numCharacters);
    444 
    445     WebCString family = WebFontInfo::familyForChars(characters, numCharacters);
     443        return webKitClient()->sandboxSupport()->getFontFamilyForCharacters(characters, numCharacters, preferredLocale);
     444
     445    WebCString family = WebFontInfo::familyForChars(characters, numCharacters, preferredLocale);
    446446    if (family.data())
    447447        return WebString::fromUTF8(family.data());
  • trunk/Source/WebKit/chromium/src/gtk/WebFontInfo.cpp

    r63780 r80489  
    3939namespace WebKit {
    4040
    41 WebCString WebFontInfo::familyForChars(const WebUChar* characters, size_t numCharacters)
     41WebCString WebFontInfo::familyForChars(const WebUChar* characters, size_t numCharacters, const char* preferredLocale)
    4242{
    4343    FcCharSet* cset = FcCharSetCreate();
     
    6262    fcvalue.u.b = FcTrue;
    6363    FcPatternAdd(pattern, FC_SCALABLE, fcvalue, FcFalse);
     64
     65    if (preferredLocale) {
     66        FcLangSet* langset = FcLangSetCreate();
     67        FcLangSetAdd(langset, reinterpret_cast<const FcChar8 *>(preferredLocale));
     68        FcPatternAddLangSet(pattern, FC_LANG, langset);
     69        FcLangSetDestroy(langset);
     70    }
    6471
    6572    FcConfigSubstitute(0, pattern, FcMatchPattern);
Note: See TracChangeset for help on using the changeset viewer.