Chapter 13. Examples of I18N
114
/* make XLFD font name for pattern analysis */
if (fs) {
XFontStruct **fontstructs;
char **fontnames;
XFontsOfFontSet(fs, &fontstructs, &fontnames);
pattern = fontnames[0];
}
/* read elements of font name */
Font_GetElement(pattern, weight, FONT_ELEMENT_SIZE,
" medium ", " bold ", " demibold ", " regular ", NULL);
Font_GetElement(pattern, slant, FONT_ELEMENT_SIZE,
" r ", " i ", " o ", " ri ", " ro ", NULL);
Font_GetSize(pattern, &pixel_size);
/* modify elements of font name to fit usual font names */
if (!strcmp(weight, "*")) strncpy(weight, "medium", FONT_ELEMENT_SIZE);
if (!strcmp(slant,
"*")) strncpy(slant,
"r",
FONT_ELEMENT_SIZE);
if (pixel_size<3) pixel_size=3; else if (pixel_size>97) pixel_size=97;
/* build font pattern for better matching for various charsets */
bufsiz = strlen(pattern) + FONT_ELEMENT_SIZE*2 + 2*2 + 58;
pattern2 = (char *)malloc(bufsiz);
if (pattern2) {
snprintf(pattern2, bufsiz 1, "%s,"
" * * %s %s * * %d * * * * * * *,"
" * * * * * * %d * * * * * * *,*",
pattern,
weight, slant, pixel_size,
pixel_size);
pattern = pattern2;
}
if (*n_miss) XFreeStringList(*miss);
if (fs) XFreeFontSet(d, fs);
/* create fontset */
fs = XCreateFontSet(d, pattern, miss, n_miss, def);
if (pattern2) free(pattern2);
return fs;
}
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