mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Added QSystemFont implementation
This commit is contained in:
parent
4131b7ed74
commit
ba583e4595
@ -46,6 +46,11 @@
|
||||
#include <fontconfig/fontconfig.h>
|
||||
#include "nsSystemFontsQt.h"
|
||||
#include "gfxPlatformQt.h"
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QMenu>
|
||||
#include <QAction>
|
||||
#include <QPushButton>
|
||||
|
||||
nsSystemFontsQt::nsSystemFontsQt()
|
||||
: mDefaultFontName(NS_LITERAL_STRING("sans-serif"))
|
||||
@ -53,14 +58,51 @@ nsSystemFontsQt::nsSystemFontsQt()
|
||||
, mFieldFontName(NS_LITERAL_STRING("sans-serif"))
|
||||
, mMenuFontName(NS_LITERAL_STRING("sans-serif"))
|
||||
{
|
||||
QLabel *label = new QLabel();
|
||||
if (label) {
|
||||
GetSystemFontInfo(label->font(), &mDefaultFontName, &mDefaultFontStyle);
|
||||
delete label;
|
||||
}
|
||||
|
||||
QLineEdit *entry = new QLineEdit();
|
||||
if (entry) {
|
||||
GetSystemFontInfo(entry->font(), &mFieldFontName, &mFieldFontStyle);
|
||||
delete entry;
|
||||
}
|
||||
|
||||
QMenu *menu = new QMenu();
|
||||
QAction *action = new QAction(menu);
|
||||
if (action) {
|
||||
GetSystemFontInfo(action->font(), &mMenuFontName, &mMenuFontStyle);
|
||||
delete action;
|
||||
}
|
||||
|
||||
QPushButton *button = new QPushButton();
|
||||
if (button) {
|
||||
GetSystemFontInfo(button->font(), &mButtonFontName, &mButtonFontStyle);
|
||||
delete button;
|
||||
}
|
||||
}
|
||||
|
||||
nsSystemFontsQt::~nsSystemFontsQt()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsSystemFontsQt::GetSystemFontInfo(const QFont &aFont, nsString *aFontName,
|
||||
gfxFontStyle *aFontStyle) const
|
||||
{
|
||||
aFontStyle->style = FONT_STYLE_NORMAL;
|
||||
aFontStyle->systemFont = PR_TRUE;
|
||||
NS_NAMED_LITERAL_STRING(quote, "\"");
|
||||
nsString family((PRUnichar*)aFont.family().data());
|
||||
*aFontName = quote + family + quote;
|
||||
aFontStyle->weight = aFont.weight();
|
||||
aFontStyle->size = aFont.pointSizeF();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
nsresult
|
||||
nsSystemFontsQt::GetSystemFont(nsSystemFontID anID, nsString *aFontName,
|
||||
gfxFontStyle *aFontStyle) const
|
||||
|
@ -41,6 +41,8 @@
|
||||
|
||||
#include <gfxFont.h>
|
||||
|
||||
class QFont;
|
||||
|
||||
class nsSystemFontsQt
|
||||
{
|
||||
public:
|
||||
@ -52,6 +54,9 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
nsresult GetSystemFontInfo(const QFont &aFont, nsString *aFontName,
|
||||
gfxFontStyle *aFontStyle) const;
|
||||
|
||||
/*
|
||||
* The following system font constants exist:
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user