1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 2 /* 3 * This file is part of the LibreOffice project. 4 * 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/. 8 * 9 * This file incorporates work covered by the following license notice: 10 * 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 . 18 */ 19 20 #pragma once 21 22 #include <vclpluginapi.h> 23 #include <PhysicalFontFace.hxx> 24 25 #include <tools/ref.hxx> 26 #include <vcl/fontcapabilities.hxx> 27 #include <vcl/fontcharmap.hxx> 28 29 #include <QtCore/QString> 30 #include <QtGui/QFont> 31 32 class FontAttributes; 33 class FontSelectPattern; 34 35 class Qt5FontFace : public PhysicalFontFace 36 { 37 public: 38 static Qt5FontFace* fromQFont(const QFont& rFont); 39 static Qt5FontFace* fromQFontDatabase(const QString& aFamily, const QString& aStyle); 40 static void fillAttributesFromQFont(const QFont& rFont, FontAttributes& rFA); 41 42 VCLPLUG_QT5_PUBLIC static FontWeight toFontWeight(const int nWeight); 43 VCLPLUG_QT5_PUBLIC static FontWidth toFontWidth(const int nStretch); 44 VCLPLUG_QT5_PUBLIC static FontItalic toFontItalic(const QFont::Style eStyle); 45 46 sal_IntPtr GetFontId() const override; 47 48 int GetFontTable(const char pTagName[5], unsigned char*) const; 49 50 const FontCharMapRef& GetFontCharMap() const; 51 bool GetFontCapabilities(vcl::FontCapabilities& rFontCapabilities) const; 52 bool HasChar(sal_uInt32 cChar) const; 53 54 rtl::Reference<LogicalFontInstance> 55 CreateFontInstance(const FontSelectPattern& rFSD) const override; 56 57 protected: 58 Qt5FontFace(const Qt5FontFace&); 59 Qt5FontFace(const FontAttributes& rFA, const QString& rFontID); 60 61 private: 62 const QString m_aFontId; 63 mutable FontCharMapRef m_xCharMap; 64 mutable vcl::FontCapabilities m_aFontCapabilities; 65 mutable bool m_bFontCapabilitiesRead; 66 }; 67 68 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 69