Laxkit
0.0.7.1
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
lax
fontmanager-xlib.h
1
//
2
//
3
// The Laxkit, a windowing toolkit
4
// Please consult http://laxkit.sourceforge.net about where to send any
5
// correspondence about this software.
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 as published by the Free Software Foundation; either
10
// version 2 of the License, or (at your option) any later version.
11
//
12
// This library is distributed in the hope that it will be useful,
13
// but WITHOUT ANY WARRANTY; without even the implied warranty of
14
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
// Library General Public License for more details.
16
//
17
// You should have received a copy of the GNU Library General Public
18
// License along with this library; if not, write to the Free Software
19
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20
//
21
// Copyright (C) 2012 by Tom Lechner
22
//
23
#ifndef _LAX_FONTMANAGER_XLIB_H
24
#define _LAX_FONTMANAGER_XLIB_H
25
26
#include <X11/Xlib.h>
27
#include <X11/Xft/Xft.h>
28
#include <lax/lists.h>
29
#include <lax/refptrstack.h>
30
#include <lax/fontmanager.h>
31
32
33
namespace
Laxkit {
34
35
36
//---------------------------- LaxFontXlib -------------------------------
37
class
LaxFontXlib
:
public
LaxFont
38
{
39
protected
:
40
public
:
41
int
numcharsinfont,firstchar;
42
unsigned
long
textstyle;
43
int
*charwidths,*realcharwidths;
44
char
cntlchar;
45
46
XftFont *font;
47
48
LaxFontXlib
();
49
LaxFontXlib
(XftFont *f,
int
nid);
50
LaxFontXlib
(Display *dpy,
const
char
*xlfd,
int
nid);
51
virtual
~
LaxFontXlib
();
52
53
virtual
int
SetupMetrics
();
54
virtual
double
charwidth
(
unsigned
long
chr,
int
real,
double
*width=NULL,
double
*height=NULL);
55
virtual
double
contextcharwidth
(
char
*start,
char
*pos,
int
real,
double
*width=NULL,
double
*height=NULL);
56
virtual
double
textheight();
57
virtual
double
ascent();
58
virtual
double
descent();
59
virtual
double
Resize(
double
newsize);
60
};
61
62
63
//---------------------------- FontManager -------------------------------
64
class
FontManagerXlib
:
public
FontManager
,
protected
RefPtrStack
<LaxFont>
65
{
66
public
:
67
FontManagerXlib
();
68
virtual
~
FontManagerXlib
() {}
69
70
virtual
LaxFont
*
Add
(XftFont *xftfont,
int
nid);
71
72
virtual
LaxFont
*
MakeFontFromFile
(
const
char
*file,
double
size,
int
nid);
73
virtual
LaxFont
*
MakeFontFromStr
(
const
char
*fcstr,
int
nid);
74
virtual
LaxFont
*
MakeFont
(
const
char
*family,
const
char
*style,
double
size,
int
nid);
75
virtual
LaxFont
*
Add
(
LaxFont
*font,
int
nid);
76
virtual
LaxFont
*
CheckOut
(
int
id
);
77
};
78
79
80
//--------------------------- FontManagerCairo ------------------------------------------
81
FontManager
*newFontManager_xlib();
82
83
84
85
}
//namespace Laxkit
86
87
#endif
88
Mon Feb 17 2014 11:52:56, Laxkit