1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
22 #include <sal/config.h>
24 #include <vclpluginapi.h>
25 #include <font/PhysicalFontFace.hxx>
27 #include <tools/ref.hxx>
28 #include <vcl/fontcapabilities.hxx>
29 #include <vcl/fontcharmap.hxx>
31 #include <QtCore/QString>
32 #include <QtGui/QFont>
37 class FontSelectPattern
;
40 class QtFontFace final
: public vcl::font::PhysicalFontFace
43 static QtFontFace
* fromQFont(const QFont
& rFont
);
44 static QtFontFace
* fromQFontDatabase(const QString
& aFamily
, const QString
& aStyle
);
45 static void fillAttributesFromQFont(const QFont
& rFont
, FontAttributes
& rFA
);
47 VCLPLUG_QT_PUBLIC
static FontWeight
toFontWeight(const int nWeight
);
48 VCLPLUG_QT_PUBLIC
static FontWidth
toFontWidth(const int nStretch
);
49 VCLPLUG_QT_PUBLIC
static FontItalic
toFontItalic(const QFont::Style eStyle
);
51 sal_IntPtr
GetFontId() const override
;
53 QFont
CreateFont() const;
54 int GetFontTable(const char pTagName
[5], unsigned char*) const;
56 FontCharMapRef
GetFontCharMap() const override
;
57 bool GetFontCapabilities(vcl::FontCapabilities
&) const override
;
58 bool HasChar(sal_uInt32 cChar
) const;
60 rtl::Reference
<LogicalFontInstance
>
61 CreateFontInstance(const vcl::font::FontSelectPattern
& rFSD
) const override
;
64 typedef enum { Font
, FontDB
} FontIdType
;
66 QtFontFace(const QtFontFace
&);
67 QtFontFace(const FontAttributes
&, const QString
& rFontID
, const FontIdType
);
69 const QString m_aFontId
;
70 const FontIdType m_eFontIdType
;
71 mutable FontCharMapRef m_xCharMap
;
72 mutable vcl::FontCapabilities m_aFontCapabilities
;
73 mutable bool m_bFontCapabilitiesRead
;
76 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */