Changeset 46428 in webkit


Ignore:
Timestamp:
Jul 27, 2009 2:31:55 PM (15 years ago)
Author:
treat@webkit.org
Message:

2009-07-27 Mike Fenton <mike.fenton@torchmobile.com>

Reviewed by Adam Treat.

Add mapping FontWeight to QFont::Weight values as requested via FIXME.
https://bugs.webkit.org/show_bug.cgi?id=27663

  • platform/graphics/qt/FontCacheQt.cpp: (WebCore::FontPlatformDataCacheKey::FontPlatformDataCacheKey):
  • platform/graphics/qt/FontPlatformData.h: (WebCore::FontPlatformData::toQFontWeight):
  • platform/graphics/qt/FontPlatformDataQt.cpp: (WebCore::FontPlatformData::FontPlatformData):
Location:
trunk/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r46427 r46428  
     12009-07-27  Mike Fenton  <mike.fenton@torchmobile.com>
     2
     3        Reviewed by Adam Treat.
     4
     5        Add mapping FontWeight to QFont::Weight values as requested via FIXME.
     6        https://bugs.webkit.org/show_bug.cgi?id=27663
     7
     8        * platform/graphics/qt/FontCacheQt.cpp:
     9        (WebCore::FontPlatformDataCacheKey::FontPlatformDataCacheKey):
     10        * platform/graphics/qt/FontPlatformData.h:
     11        (WebCore::FontPlatformData::toQFontWeight):
     12        * platform/graphics/qt/FontPlatformDataQt.cpp:
     13        (WebCore::FontPlatformData::FontPlatformData):
     14
    1152009-07-27  Jakub Wieczorek  <faw217@gmail.com>
    216
  • trunk/WebCore/platform/graphics/qt/FontCacheQt.cpp

    r46124 r46428  
    6666    {
    6767        // FIXME: Map all FontWeight values to QFont weights in FontPlatformData's ctor and follow it here
    68         if (description.weight() >= FontWeight600)
     68        if (FontPlatformData::toQFontWeight(description.weight()) > QFont::Normal)
    6969            m_bold = true;
    7070
  • trunk/WebCore/platform/graphics/qt/FontPlatformData.h

    r46388 r46428  
    22    Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
    33    Copyright (C) 2008 Holger Hans Peter Freyther
     4    Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/
    45
    56    This library is free software; you can redistribute it and/or
     
    4142    FontPlatformData(const QFont&, bool bold);
    4243
     44    static inline QFont::Weight toQFontWeight(FontWeight fontWeight)
     45    {
     46        switch (fontWeight) {
     47        case FontWeight100:
     48        case FontWeight200:
     49            return QFont::Light;  // QFont::Light == Weight of 25
     50        case FontWeight600:
     51            return QFont::DemiBold;  // QFont::DemiBold == Weight of 63
     52        case FontWeight700:
     53        case FontWeight800:
     54            return QFont::Bold;  // QFont::Bold == Weight of 75
     55        case FontWeight900:
     56            return QFont::Black;  // QFont::Black == Weight of 87
     57        case FontWeight300:
     58        case FontWeight400:
     59        case FontWeight500:
     60        default:
     61            return QFont::Normal;  // QFont::Normal == Weight of 50
     62        }
     63    }
     64
    4365    QFont font() const { return m_font; }
    4466    float size() const { return m_size; }
  • trunk/WebCore/platform/graphics/qt/FontPlatformDataQt.cpp

    r46388 r46428  
    11/*
    22    Copyright (C) 2008 Holger Hans Peter Freyther
     3    Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/
    34
    45    This library is free software; you can redistribute it and/or
     
    4344    m_font.setPixelSize(qRound(description.computedSize()));
    4445    m_font.setItalic(description.italic());
    45     // FIXME: Map all FontWeight values to QFont weights.
    46     if (description.weight() >= FontWeight600) {
    47         m_font.setWeight(QFont::Bold);
    48         m_bold = true;
    49     } else
    50         m_font.setWeight(QFont::Normal);
     46
     47    m_font.setWeight(toQFontWeight(description.weight()));
     48    m_bold = m_font.bold();
    5149
    5250    bool smallCaps = description.smallCaps();
Note: See TracChangeset for help on using the changeset viewer.