1 #pragma once 2 3 /* 4 * SPDX-FileCopyrightText: 2003-2007 Craig Drummond <craig@kde.org> 5 * SPDX-License-Identifier: GPL-2.0-or-later 6 */ 7 8 #include "FcEngine.h" 9 #include "KfiConstants.h" 10 #include <QImage> 11 #include <QPaintEvent> 12 #include <QSize> 13 #include <QWidget> 14 15 class QWheelEvent; 16 17 namespace KFI 18 { 19 class CCharTip; 20 class CFcEngine; 21 22 class CFontPreview : public QWidget 23 { 24 Q_OBJECT 25 26 public: 27 CFontPreview(QWidget *parent); 28 ~CFontPreview() override; 29 30 void paintEvent(QPaintEvent *) override; 31 void mouseMoveEvent(QMouseEvent *event) override; 32 void wheelEvent(QWheelEvent *e) override; 33 QSize sizeHint() const override; 34 QSize minimumSizeHint() const override; 35 36 void showFont(const QString &name, // Thsi is either family name, or filename 37 unsigned long styleInfo = KFI_NO_STYLE_INFO, 38 int face = 0); 39 void showFont(); 40 void showFace(int face); 41 engine()42 CFcEngine *engine() 43 { 44 return itsEngine; 45 } 46 47 public Q_SLOTS: 48 49 void setUnicodeRange(const QList<CFcEngine::TRange> &r); 50 void zoomIn(); 51 void zoomOut(); 52 53 Q_SIGNALS: 54 55 void status(bool); 56 void atMax(bool); 57 void atMin(bool); 58 59 private: 60 QImage itsImage; 61 int itsCurrentFace, itsLastWidth, itsLastHeight, itsStyleInfo; 62 QString itsFontName; 63 QList<CFcEngine::TRange> itsRange; 64 QList<CFcEngine::TChar> itsChars; 65 CFcEngine::TChar itsLastChar; 66 CCharTip *itsTip; 67 CFcEngine *itsEngine; 68 69 friend class CCharTip; 70 }; 71 72 } 73