2006-11-26 11:13:41 -07:00
|
|
|
/*
|
|
|
|
|
|
|
|
Copyright 1993 by Davor Matic
|
|
|
|
|
|
|
|
Permission to use, copy, modify, distribute, and sell this software
|
|
|
|
and its documentation for any purpose is hereby granted without fee,
|
|
|
|
provided that the above copyright notice appear in all copies and that
|
|
|
|
both that copyright notice and this permission notice appear in
|
|
|
|
supporting documentation. Davor Matic makes no representations about
|
|
|
|
the suitability of this software for any purpose. It is provided "as
|
|
|
|
is" without express or implied warranty.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_XNEST_CONFIG_H
|
|
|
|
#include <xnest-config.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <X11/X.h>
|
|
|
|
#include <X11/Xatom.h>
|
|
|
|
#include <X11/Xproto.h>
|
|
|
|
#include "misc.h"
|
|
|
|
#include "regionstr.h"
|
|
|
|
#include <X11/fonts/font.h>
|
|
|
|
#include <X11/fonts/fontstruct.h>
|
2017-12-08 08:01:59 -07:00
|
|
|
#include "dixfontstr.h"
|
2006-11-26 11:13:41 -07:00
|
|
|
#include "scrnintstr.h"
|
|
|
|
|
|
|
|
#include "Xnest.h"
|
|
|
|
|
|
|
|
#include "Display.h"
|
|
|
|
#include "XNFont.h"
|
|
|
|
|
|
|
|
int xnestFontPrivateIndex;
|
|
|
|
|
|
|
|
Bool
|
|
|
|
xnestRealizeFont(ScreenPtr pScreen, FontPtr pFont)
|
|
|
|
{
|
2014-09-27 11:52:59 -06:00
|
|
|
void *priv;
|
2012-06-10 07:21:05 -06:00
|
|
|
Atom name_atom, value_atom;
|
|
|
|
int nprops;
|
|
|
|
FontPropPtr props;
|
|
|
|
int i;
|
|
|
|
const char *name;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2017-12-08 08:01:59 -07:00
|
|
|
xfont2_font_set_private(pFont, xnestFontPrivateIndex, NULL);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
name_atom = MakeAtom("FONT", 4, True);
|
|
|
|
value_atom = 0L;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
nprops = pFont->info.nprops;
|
|
|
|
props = pFont->info.props;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
for (i = 0; i < nprops; i++)
|
|
|
|
if (props[i].name == name_atom) {
|
|
|
|
value_atom = props[i].value;
|
|
|
|
break;
|
|
|
|
}
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
if (!value_atom)
|
|
|
|
return False;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
name = NameForAtom(value_atom);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
if (!name)
|
|
|
|
return False;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2014-09-27 11:52:59 -06:00
|
|
|
priv = (void *) malloc(sizeof(xnestPrivFont));
|
2017-12-08 08:01:59 -07:00
|
|
|
xfont2_font_set_private(pFont, xnestFontPrivateIndex, priv);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
xnestFontPriv(pFont)->font_struct = XLoadQueryFont(xnestDisplay, name);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
if (!xnestFontStruct(pFont))
|
|
|
|
return False;
|
|
|
|
|
|
|
|
return True;
|
|
|
|
}
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
Bool
|
|
|
|
xnestUnrealizeFont(ScreenPtr pScreen, FontPtr pFont)
|
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
if (xnestFontPriv(pFont)) {
|
|
|
|
if (xnestFontStruct(pFont))
|
|
|
|
XFreeFont(xnestDisplay, xnestFontStruct(pFont));
|
|
|
|
free(xnestFontPriv(pFont));
|
2017-12-08 08:01:59 -07:00
|
|
|
xfont2_font_set_private(pFont, xnestFontPrivateIndex, NULL);
|
2012-06-10 07:21:05 -06:00
|
|
|
}
|
|
|
|
return True;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|