Chapter 13. Examples of I18N
115
QuasiXFontStruct *QuasiXLoadQueryFont(Display *d, const char *fontset_name)
{
char **miss, *def, *pattern;
int n_miss;
XFontSet fontset;
QuasiXFontStruct *wxfs;
int pixel_size=16, bufsiz;
char family[FONT_ELEMENT_SIZE], weight[FONT_ELEMENT_SIZE],
slant[FONT_ELEMENT_SIZE];
wxfs = (QuasiXFontStruct *)malloc(sizeof(QuasiXFontStruct));
if (!wxfs) return NULL;
/* create fontset */
fontset = XCreateFontSetWithGuess(d, fontset_name, &miss, &n_miss, &def);
if (!fontset) {free(wxfs); return NULL;}
if (n_miss) {
int j;
fprintf(stderr,
"QuasiXLoadQueryFont: lacks the font(s) for the following charset(s)\n");
for (j=0; j
fprintf(stderr, "
%s\n", miss[j]);
}
XFreeStringList(miss);
}
/* emulating XFontStruct */
wxfs >fs
= fontset;
wxfs >ascent
= XExtentsOfFontSet(fontset) >max_logical_extent.y;
wxfs >descent = XExtentsOfFontSet(fontset) >max_logical_extent.height
+XExtentsOfFontSet(fontset) >max_logical_extent.y;
return wxfs;
}
void QuasiXFreeFont(Display *d, QuasiXFontStruct *wxfs)
{
if (!wxfs) return;
XFreeFontSet(d, wxfs >fs);
free(wxfs);
}
void QuasiXDrawString(Display *d, Window w, QuasiXFontStruct *qxfs, GC gc,
footer
Our partners:
PHP: Hypertext Preprocessor Best Web Hosting
Java Web Hosting
Inexpensive Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Jsp Hosting
Cheap Hosting
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved