3 Copyright 1993 by Davor Matic
5 Permission to use, copy, modify, distribute, and sell this software
6 and its documentation for any purpose is hereby granted without fee,
7 provided that the above copyright notice appear in all copies and that
8 both that copyright notice and this permission notice appear in
9 supporting documentation. Davor Matic makes no representations about
10 the suitability of this software for any purpose. It is provided "as
11 is" without express or implied warranty.
15 #ifdef HAVE_XNEST_CONFIG_H
16 #include <xnest-config.h>
20 #include <X11/Xatom.h>
21 #include <X11/Xproto.h>
23 #include "regionstr.h"
24 #include <X11/fonts/font.h>
25 #include <X11/fonts/fontstruct.h>
26 #include "scrnintstr.h"
33 int xnestFontPrivateIndex
;
36 xnestRealizeFont(ScreenPtr pScreen
, FontPtr pFont
)
39 Atom name_atom
, value_atom
;
45 FontSetPrivate(pFont
, xnestFontPrivateIndex
, NULL
);
47 if (requestingClient
&& XpClientIsPrintClient(requestingClient
, NULL
))
50 name_atom
= MakeAtom("FONT", 4, True
);
53 nprops
= pFont
->info
.nprops
;
54 props
= pFont
->info
.props
;
56 for (i
= 0; i
< nprops
; i
++)
57 if (props
[i
].name
== name_atom
) {
58 value_atom
= props
[i
].value
;
62 if (!value_atom
) return False
;
64 name
= (char *)NameForAtom(value_atom
);
66 if (!name
) return False
;
68 priv
= (pointer
)xalloc(sizeof(xnestPrivFont
));
69 FontSetPrivate(pFont
, xnestFontPrivateIndex
, priv
);
71 xnestFontPriv(pFont
)->font_struct
= XLoadQueryFont(xnestDisplay
, name
);
73 if (!xnestFontStruct(pFont
)) return False
;
80 xnestUnrealizeFont(ScreenPtr pScreen
, FontPtr pFont
)
82 if (xnestFontPriv(pFont
)) {
83 if (xnestFontStruct(pFont
))
84 XFreeFont(xnestDisplay
, xnestFontStruct(pFont
));
85 xfree(xnestFontPriv(pFont
));
86 FontSetPrivate(pFont
, xnestFontPrivateIndex
, NULL
);