]> git.lyx.org Git - lyx.git/blob - src/font.h
ws cleanup
[lyx.git] / src / font.h
1 // -*- C++ -*-
2 /* This file is part of
3  * ======================================================
4  *
5  *           LyX, The Document Processor
6  *
7  *           Copyright 1995 Matthias Ettrich
8  *           Copyright 1995-2001 The LyX Team.
9  *
10  * ====================================================== */
11
12 #ifndef FONT_H
13 #define FONT_H
14
15 #ifdef __GNUG__
16 #pragma interface
17 #endif
18
19 #include <X11/Xlib.h>
20
21 #include "LString.h"
22
23 class LyXFont;
24
25 //namespace lyx {
26 //namespace font {
27 ///
28 struct lyxfont {
29         ///
30         static
31         int maxAscent(LyXFont const & f);
32         ///
33         static
34         int maxDescent(LyXFont const & f);
35         ///
36         static
37         int ascent(char c, LyXFont const & f);
38         ///
39         static
40         int descent(char c, LyXFont const & f);
41         ///
42         static
43         int lbearing(char c, LyXFont const & f);
44         ///
45         static
46         int rbearing(char c, LyXFont const & f);
47         ///
48         static
49         int width(char c, LyXFont const & f) {
50                 return width(&c, 1, f);
51         }
52         ///
53         static
54         int width(char const * s, size_t n, LyXFont const & f);
55         ///
56         static
57         int width(string const & s, LyXFont const & f) {
58                 if (s.empty()) return 0;
59                 return width(s.data(), s.length(), f);
60         }
61         ///
62         //static
63         //int width(char const * s, LyXFont const & f) {
64         //      return width(s, strlen(s), f);
65         //}
66         ///
67         static
68         int signedWidth(string const & s, LyXFont const & f);
69         ///
70         static
71         int XTextWidth(LyXFont const & f, char const * str, int count);
72         ///
73         static
74         int width(XChar2b const * s, int n, LyXFont const & f);
75         ///
76         static
77         int XTextWidth16(LyXFont const & f, XChar2b const * str, int count);
78         ///
79         static
80         void XSetFont(Display * display, GC gc, LyXFont const & f);
81         // A couple of more high-level metrics
82         ///
83         static
84         void rectText(string const & str, LyXFont const & font,
85                       int & width, int & ascent, int & descent);
86         ///
87         static
88         void buttonText(string const & str, LyXFont const & font,
89                         int & width, int & ascent, int & descent);
90 };
91
92 //} // end of namespace font
93
94 // import into namespace lyx
95 //using font::maxAscent;
96 //using font::maxDescent;
97 //using font::ascent;
98 //using font::descent;
99 //using font::lbearing;
100 //using font::rbearing;
101 //using font::width;
102 //using font::signedWidth;
103 //using font::XTextWidth;
104 //using font::XSetFont;
105
106 //} // end of namespace lyx
107
108 #endif