]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/xfont_metrics.h
font_metrics part 1
[lyx.git] / src / frontends / xforms / xfont_metrics.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 font_metrics {
26 //namespace lyx {
27 //namespace font {
28 ///
29 //istruct lyxfont {
30         ///
31         int maxAscent(LyXFont const & f);
32         ///
33         int maxDescent(LyXFont const & f);
34         ///
35         int ascent(char c, LyXFont const & f);
36         ///
37         int descent(char c, LyXFont const & f);
38         ///
39         int lbearing(char c, LyXFont const & f);
40         ///
41         int rbearing(char c, LyXFont const & f);
42         ///
43         int width(char const * s, size_t n, LyXFont const & f);
44         ///
45         int width(char c, LyXFont const & f);
46         ///
47         int width(string const & s, LyXFont const & f);
48         ///
49         //static
50         //int width(char const * s, LyXFont const & f) {
51         //      return width(s, strlen(s), f);
52         //}
53         ///
54         int signedWidth(string const & s, LyXFont const & f);
55         ///
56         int XTextWidth(LyXFont const & f, char const * str, int count);
57         ///
58         int width(XChar2b const * s, int n, LyXFont const & f);
59         ///
60         int XTextWidth16(LyXFont const & f, XChar2b const * str, int count);
61         ///
62         void XSetFont(Display * display, GC gc, LyXFont const & f);
63         // A couple of more high-level metrics
64         ///
65         void rectText(string const & str, LyXFont const & font,
66                       int & width, int & ascent, int & descent);
67         ///
68         void buttonText(string const & str, LyXFont const & font,
69                         int & width, int & ascent, int & descent);
70 //};
71 }
72
73 //} // end of namespace font
74
75 // import into namespace lyx
76 //using font::maxAscent;
77 //using font::maxDescent;
78 //using font::ascent;
79 //using font::descent;
80 //using font::lbearing;
81 //using font::rbearing;
82 //using font::width;
83 //using font::signedWidth;
84 //using font::XTextWidth;
85 //using font::XSetFont;
86
87 //} // end of namespace lyx
88
89 #endif