diff options
Diffstat (limited to 'src/3rdparty/webkit/WebCore/platform/graphics/qt/FontPlatformData.h')
-rw-r--r-- | src/3rdparty/webkit/WebCore/platform/graphics/qt/FontPlatformData.h | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/qt/FontPlatformData.h b/src/3rdparty/webkit/WebCore/platform/graphics/qt/FontPlatformData.h index 5e97678b8..92219fde6 100644 --- a/src/3rdparty/webkit/WebCore/platform/graphics/qt/FontPlatformData.h +++ b/src/3rdparty/webkit/WebCore/platform/graphics/qt/FontPlatformData.h @@ -1,6 +1,7 @@ /* Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) Copyright (C) 2008 Holger Hans Peter Freyther + Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/ This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public @@ -24,11 +25,12 @@ #define FontPlatformData_h #include "FontDescription.h" - #include <QFont> namespace WebCore { +class String; + class FontPlatformData { public: @@ -39,8 +41,38 @@ public: FontPlatformData(const FontDescription&, int wordSpacing = 0, int letterSpacing = 0); FontPlatformData(const QFont&, bool bold); + static inline QFont::Weight toQFontWeight(FontWeight fontWeight) + { + switch (fontWeight) { + case FontWeight100: + case FontWeight200: + return QFont::Light; // QFont::Light == Weight of 25 + case FontWeight600: + return QFont::DemiBold; // QFont::DemiBold == Weight of 63 + case FontWeight700: + case FontWeight800: + return QFont::Bold; // QFont::Bold == Weight of 75 + case FontWeight900: + return QFont::Black; // QFont::Black == Weight of 87 + case FontWeight300: + case FontWeight400: + case FontWeight500: + default: + return QFont::Normal; // QFont::Normal == Weight of 50 + } + } + QFont font() const { return m_font; } float size() const { return m_size; } + QString family() const { return m_font.family(); } + bool bold() const { return m_bold; } + bool italic() const { return m_font.italic(); } + bool smallCaps() const { return m_font.capitalization() == QFont::SmallCaps; } + int pixelSize() const { return m_font.pixelSize(); } + +#ifndef NDEBUG + String description() const; +#endif float m_size; bool m_bold; |