File indexing completed on 2024-04-28 05:50:51

0001 /*
0002     SPDX-FileCopyrightText: 2020-2020 Gustavo Carneiro <gcarneiroa@hotmail.com>
0003     SPDX-FileCopyrightText: 2007-2008 Robert Knight <robertknight@gmail.com>
0004     SPDX-FileCopyrightText: 1997, 1998 Lars Doelle <lars.doelle@on-line.de>
0005 
0006     SPDX-License-Identifier: GPL-2.0-or-later
0007 */
0008 
0009 #ifndef TERMINALFONTS_H
0010 #define TERMINALFONTS_H
0011 
0012 #include <QWidget>
0013 
0014 #include "konsoleprivate_export.h"
0015 #include "profile/Profile.h"
0016 
0017 class QFont;
0018 
0019 namespace Konsole
0020 {
0021 class KONSOLEPRIVATE_EXPORT TerminalFont
0022 {
0023 public:
0024     explicit TerminalFont(QWidget *parent = nullptr);
0025     ~TerminalFont() = default;
0026 
0027     void applyProfile(const Profile::Ptr &profile);
0028 
0029     void setVTFont(const QFont &f);
0030     QFont getVTFont() const;
0031 
0032     void increaseFontSize();
0033     void decreaseFontSize();
0034     void resetFontSize();
0035 
0036     void setLineSpacing(uint);
0037     uint lineSpacing() const;
0038 
0039     int fontHeight() const;
0040     int fontWidth() const;
0041     int fontAscent() const;
0042     int lineWidth() const;
0043     qreal underlinePos() const;
0044     int strikeOutPos() const;
0045     qreal overlinePos() const;
0046     bool boldIntense() const;
0047     bool antialiasText() const;
0048     bool useFontLineCharacters() const;
0049 
0050     bool hasExtraFont(int i) const;
0051     QFont getExtraFont(int i) const;
0052 
0053 protected:
0054     void fontChange(const QFont &);
0055 
0056 private:
0057     QWidget *m_parent = nullptr;
0058     uint m_lineSpacing = 0;
0059     int m_fontHeight = 1;
0060     int m_fontWidth = 1;
0061     int m_fontAscent = 1;
0062     int m_lineWidth = 1;
0063     qreal m_underlinePos = 1;
0064     int m_strikeOutPos = 1;
0065     qreal m_overlinePos = 1;
0066     bool m_boldIntense = false;
0067     bool m_antialiasText = true;
0068     bool m_useFontLineCharacters = false;
0069     QMap<int, QFont> extraFonts;
0070 
0071     Profile::Ptr m_profile;
0072 };
0073 
0074 }
0075 
0076 #endif