• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • kate
 

kate

  • kate
  • part
katefont.h
1/* This file is part of the KDE libraries
2 Copyright (C) 2002 Christian Couder <christian@kdevelop.org>
3 Copyright (C) 2001 Christoph Cullmann <cullmann@kde.org>
4 Copyright (C) 2001 Joseph Wenninger <jowenn@kde.org>
5 Copyright (C) 1999 Jochen Wilhelmy <digisnap@cs.tu-berlin.de>
6
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public
9 License version 2 as published by the Free Software Foundation.
10
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details.
15
16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 Boston, MA 02110-1301, USA.
20*/
21
22#ifndef __kate_font_h__
23#define __kate_font_h__
24
25#include <tqfont.h>
26#include <tqfontmetrics.h>
27
28//
29// KateFontMetrics implementation
30//
31
32class KateFontMetrics : public TQFontMetrics
33{
34 public:
35 KateFontMetrics(const TQFont& f);
36 ~KateFontMetrics();
37
38 int width(TQChar c);
39
40 int width(TQString s) { return TQFontMetrics::width(s); }
41
42 private:
43 short *createRow (short *wa, uchar row);
44
45 private:
46 short *warray[256];
47};
48
49//
50// KateFontStruct definition
51//
52
53class KateFontStruct
54{
55 public:
56 KateFontStruct();
57 ~KateFontStruct();
58
59 void setFont(const TQFont & font);
60
61 private:
62 void updateFontData ();
63
64 public:
65 inline int width (const TQString& text, int col, bool bold, bool italic, int tabWidth)
66 {
67 if (text[col] == TQChar('\t'))
68 return tabWidth * myFontMetrics.width(' ');
69
70 return (bold) ?
71 ( (italic) ?
72 myFontMetricsBI.charWidth(text, col) :
73 myFontMetricsBold.charWidth(text, col) ) :
74 ( (italic) ?
75 myFontMetricsItalic.charWidth(text, col) :
76 myFontMetrics.charWidth(text, col) );
77 }
78
79 inline int width (const TQChar& c, bool bold, bool italic, int tabWidth)
80 {
81 if (c == TQChar('\t'))
82 return tabWidth * myFontMetrics.width(' ');
83
84 return (bold) ?
85 ( (italic) ?
86 myFontMetricsBI.width(c) :
87 myFontMetricsBold.width(c) ) :
88 ( (italic) ?
89 myFontMetricsItalic.width(c) :
90 myFontMetrics.width(c) );
91 }
92
93 inline const TQFont& font(bool bold, bool italic) const
94 {
95 return (bold) ?
96 ( (italic) ? myFontBI : myFontBold ) :
97 ( (italic) ? myFontItalic : myFont );
98 }
99
100 inline bool fixedPitch() const { return m_fixedPitch; }
101
102 public:
103 TQFont myFont, myFontBold, myFontItalic, myFontBI;
104
105 KateFontMetrics myFontMetrics, myFontMetricsBold, myFontMetricsItalic, myFontMetricsBI;
106
107 int fontHeight;
108 int fontAscent;
109
110 private:
111 bool m_fixedPitch;
112};
113
114#endif

kate

Skip menu "kate"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kate

Skip menu "kate"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for kate by doxygen 1.9.4
This website is maintained by Timothy Pearson.