]> git.lyx.org Git - lyx.git/blob - src/font.h
The forms resize patch, and small updates
[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-2000 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.c_str(), 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 };
82
83 //} // end of namespace font
84
85 // import into namespace lyx
86 //using font::maxAscent;
87 //using font::maxDescent;
88 //using font::ascent;
89 //using font::descent;
90 //using font::lbearing;
91 //using font::rbearing;
92 //using font::width;
93 //using font::signedWidth;
94 //using font::XTextWidth;
95 //using font::XSetFont;
96
97 //} // end of namespace lyx
98
99 #endif