- XFontSet fontset = 0;
- if (style.getValue(rname, s) && (fontset = createFontSet(s)))
- load_default = False;
-
- if (load_default) {
- fontset = createFontSet(defaultFont);
-
- if (! fontset) {
- fprintf(stderr,
- i18n(ScreenSet, ScreenDefaultFontLoadFail,
- "BScreen::setCurrentStyle(): couldn't load default font.\n"));
- exit(2);
- }
- }
-
- return fontset;
-}
-
-
-XFontStruct *BScreen::readDatabaseFont(const string &rname,
- Configuration &style) {
- char *defaultFont = "fixed";
-
- bool load_default = False;
- string s;
- XFontStruct *font = 0;
- if (style.getValue(rname, s)) {
- if ((font = XLoadQueryFont(blackbox->getXDisplay(), s.c_str())) == NULL) {
- fprintf(stderr,
- i18n(ScreenSet, ScreenFontLoadFail,
- "BScreen::setCurrentStyle(): couldn't load font '%s'\n"),
- s.c_str());
-
- load_default = True;
- }
- } else {
- load_default = True;
- }
-
- if (load_default) {
- font = XLoadQueryFont(blackbox->getXDisplay(), defaultFont);
- if (font == NULL) {
- fprintf(stderr,
- i18n(ScreenSet, ScreenDefaultFontLoadFail,
- "BScreen::setCurrentStyle(): couldn't load default font.\n"));
- exit(2);
- }
- }
-
- return font;
-}
-
-
-#ifndef HAVE_STRCASESTR
-static const char * strcasestr(const char *str, const char *ptn) {
- const char *s2, *p2;
- for(; *str; str++) {
- for(s2=str,p2=ptn; ; s2++,p2++) {
- if (! *p2) return str;
- if (toupper(*s2) != toupper(*p2)) break;
- }
- }
- return NULL;
-}
-#endif // HAVE_STRCASESTR
-
-
-static const char *getFontElement(const char *pattern, char *buf,
- int bufsiz, ...) {
- const char *p, *v;
- char *p2;
- va_list va;
-
- va_start(va, bufsiz);
- buf[bufsiz-1] = 0;
- buf[bufsiz-2] = '*';
- while((v = va_arg(va, char *)) != NULL) {
- p = strcasestr(pattern, v);
- if (p) {
- strncpy(buf, p+1, bufsiz-2);
- p2 = strchr(buf, '-');
- if (p2) *p2=0;
- va_end(va);
- return p;
- }
- }
- va_end(va);
- strncpy(buf, "*", bufsiz);
- return NULL;
-}
-