Changeset 58068 in webkit


Ignore:
Timestamp:
Apr 22, 2010 12:29:58 AM (14 years ago)
Author:
eric@webkit.org
Message:

2010-04-22 Stephan Aßmus <superstippi@gmx.de>

Reviewed by David Levin.

[Haiku] Improve SimpleFontDataHaiku
https://bugs.webkit.org/show_bug.cgi?id=37411

Covered by existing tests.

  • platform/graphics/haiku/SimpleFontDataHaiku.cpp:
    • Cleaned up includes
    • Removed prototype "charUnicodeToUTF8HACK"

(WebCore::SimpleFontData::platformInit):

  • Use const BFont pointer

(WebCore::SimpleFontData::smallCapsFontData):

  • "fontPlatformData" was leaked. It is only used as the key for the font cache lookup.

(WebCore::SimpleFontData::platformMetricsForGlyph):

  • Use existing WebCore encoding infrastructure instead of adding a hack for Haiku.
Location:
trunk/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r58061 r58068  
     12010-04-22  Stephan Aßmus  <superstippi@gmx.de>
     2
     3        Reviewed by David Levin.
     4
     5        [Haiku] Improve SimpleFontDataHaiku
     6        https://bugs.webkit.org/show_bug.cgi?id=37411
     7
     8        Covered by existing tests.
     9
     10        * platform/graphics/haiku/SimpleFontDataHaiku.cpp:
     11            - Cleaned up includes
     12            - Removed prototype "charUnicodeToUTF8HACK"
     13        (WebCore::SimpleFontData::platformInit):
     14            - Use const BFont pointer
     15        (WebCore::SimpleFontData::smallCapsFontData):
     16            - "fontPlatformData" was leaked. It is only
     17              used as the key for the font cache lookup.
     18        (WebCore::SimpleFontData::platformMetricsForGlyph):
     19            - Use existing WebCore encoding infrastructure
     20              instead of adding a hack for Haiku.
     21
    1222010-04-21  Steve Block  <steveblock@google.com>
    223
  • trunk/WebCore/platform/graphics/haiku/SimpleFontDataHaiku.cpp

    r57215 r58068  
    3535#include "FontDescription.h"
    3636#include "NotImplemented.h"
    37 #include <Rect.h>
    38 #include <unicode/uchar.h>
    39 #include <unicode/unorm.h>
     37#include "TextEncoding.h"
     38#include <wtf/text/CString.h>
    4039
    41 
    42 extern int charUnicodeToUTF8HACK(unsigned short, char*);
    4340
    4441namespace WebCore {
     
    4643void SimpleFontData::platformInit()
    4744{
    48     BFont* font = m_platformData.font();
     45    const BFont* font = m_platformData.font();
    4946    if (!font)
    5047        return;
     
    7774        FontDescription desc = FontDescription(fontDescription);
    7875        desc.setSpecifiedSize(0.70f * fontDescription.computedSize());
    79         const FontPlatformData* fontPlatformData = new FontPlatformData(desc, desc.family().family());
    80         m_smallCapsFontData = new SimpleFontData(*fontPlatformData);
     76        FontPlatformData fontPlatformData(desc, desc.family().family());
     77        m_smallCapsFontData = new SimpleFontData(fontPlatformData);
    8178    }
    8279    return m_smallCapsFontData;
     
    9693GlyphMetrics SimpleFontData::platformMetricsForGlyph(Glyph glyph, GlyphMetricsMode) const
    9794{
     95    GlyphMetrics metrics;
    9896    if (!m_platformData.font())
    99         return 0;
     97        return metrics;
    10098
    101     char charArray[4];
     99    CString encoded = UTF8Encoding().encode(static_cast<UChar*>(&glyph), 1,
     100                                            URLEncodedEntitiesForUnencodables);
    102101    float escapements[1];
    103 
    104     charUnicodeToUTF8HACK(glyph, charArray);
    105     m_platformData.font()->GetEscapements(charArray, 1, escapements);
    106     GlyphMetrics metrics;
     102    m_platformData.font()->GetEscapements(encoded.data(), 1, escapements);
    107103    metrics.horizontalAdvance = escapements[0] * m_platformData.font()->Size();
    108104    return metrics;
Note: See TracChangeset for help on using the changeset viewer.