]> git.lyx.org Git - lyx.git/blob - src/font.h
encoding + etc patch from dekel
[lyx.git] / src / font.h
1 // -*- C++ -*-
2 #ifndef FONT_H
3 #define FONT_H
4
5 #include <X11/Xlib.h>
6
7 #include "LString.h"
8
9 class LyXFont;
10
11 //namespace lyx {
12 //namespace font {
13
14 struct lyxfont {
15
16         static
17         int maxAscent(LyXFont const & f);
18
19         static
20         int maxDescent(LyXFont const & f);
21
22         static
23         int ascent(char c, LyXFont const & f);
24
25         static
26         int descent(char c, LyXFont const & f);
27
28         static
29         int lbearing(char c, LyXFont const & f);
30
31         static
32         int rbearing(char c, LyXFont const & f);
33
34         static
35         int width(char c, LyXFont const & f) {
36                 return width(&c, 1, f);
37         }
38
39         static
40         int width(char const * s, int n, LyXFont const & f);
41
42         static
43         int width(string const & s, LyXFont const & f) {
44                 if (s.empty()) return 0;
45                 return width(s.c_str(), s.length(), f);
46         }
47
48         static
49         int width(char const * s, LyXFont const & f) {
50                 return width(s, strlen(s), f);
51         }
52
53         static
54         int signedWidth(string const & s, LyXFont const & f);
55
56         static
57         int XTextWidth(LyXFont const & f, char * str, int count);
58
59         static
60         int width(XChar2b const * s, int n, LyXFont const & f);
61
62         static
63         int XTextWidth16(LyXFont const & f, XChar2b * str, int count);
64
65         static
66         void XSetFont(Display * display, GC gc, LyXFont const & f);
67 };
68
69 //} // end of namespace font
70
71 // import into namespace lyx
72 //using font::maxAscent;
73 //using font::maxDescent;
74 //using font::ascent;
75 //using font::descent;
76 //using font::lbearing;
77 //using font::rbearing;
78 //using font::width;
79 //using font::signedWidth;
80 //using font::XTextWidth;
81 //using font::XSetFont;
82
83 //} // end of namespace lyx
84
85 #endif