katefont.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef __kate_font_h__
00023 #define __kate_font_h__
00024
00025 #include <qfont.h>
00026 #include <qfontmetrics.h>
00027
00028
00029
00030
00031
00032 class KateFontMetrics : public QFontMetrics
00033 {
00034 public:
00035 KateFontMetrics(const QFont& f);
00036 ~KateFontMetrics();
00037
00038 int width(QChar c);
00039
00040 int width(QString s) { return QFontMetrics::width(s); }
00041
00042 private:
00043 short *createRow (short *wa, uchar row);
00044
00045 private:
00046 short *warray[256];
00047 };
00048
00049
00050
00051
00052
00053 class FontStruct
00054 {
00055 public:
00056 FontStruct();
00057 ~FontStruct();
00058
00059 int width(const QString& text, int col, bool bold, bool italic, int tabWidth);
00060 int width(const QChar& c, bool bold, bool italic, int tabWidth);
00061
00062 inline const QFont& font(bool bold, bool italic) const
00063 {
00064 return (bold) ?
00065 ( (italic) ? myFontBI : myFontBold ) :
00066 ( (italic) ? myFontItalic : myFont );
00067 }
00068
00069 void setFont(const QFont & font);
00070
00071 private:
00072 void updateFontData ();
00073
00074 public:
00075 QFont myFont, myFontBold, myFontItalic, myFontBI;
00076
00077 KateFontMetrics myFontMetrics, myFontMetricsBold, myFontMetricsItalic, myFontMetricsBI;
00078
00079 int fontHeight;
00080 int fontAscent;
00081 };
00082
00083 #endif
This file is part of the documentation for kate Library Version 3.2.0.