diff options
| author | Dana Jansens <danakj@orodu.net> | 2002-12-03 08:54:51 +0000 |
|---|---|---|
| committer | Dana Jansens <danakj@orodu.net> | 2002-12-03 08:54:51 +0000 |
| commit | c6f228f3ff9ab7087669366a23d2ae61d8e5b9b9 (patch) | |
| tree | bbf89e7eaa23d8986efe071ad41d4433301ff7da /otk/style.cc | |
| parent | f77502100a32a6f875f33ef2ab01802f1cbc7c69 (diff) | |
xft2 works. and works good.
Diffstat (limited to 'otk/style.cc')
| -rw-r--r-- | otk/style.cc | 57 |
1 files changed, 16 insertions, 41 deletions
diff --git a/otk/style.cc b/otk/style.cc index 89c7b05d..a3d21788 100644 --- a/otk/style.cc +++ b/otk/style.cc @@ -234,53 +234,28 @@ BColor Style::readDatabaseColor(const std::string &rname, BFont *Style::readDatabaseFont(const std::string &rbasename, const Configuration &style) { - std::string fontname; + std::string fontstring, s; - std::string s; + // XXX: load all this font stuff from the style... - int i; - if (style.getValue(rbasename + "xft.font", s) && - style.getValue(rbasename + "xft.size", i)) { - std::string family = s; - bool bold = False; - bool italic = False; - bool dropShadow = False; - - if (style.getValue(rbasename + "xft.flags", s)) { - if (s.find("bold") != std::string::npos) - bold = True; - if (s.find("italic") != std::string::npos) - italic = True; - if (s.find("shadow") != std::string::npos) - dropShadow = True; - } + bool dropShadow = True; - unsigned char offset = 1; - if (style.getValue(rbasename + "xft.shadow.offset", s)) { - offset = atoi(s.c_str()); //doesn't detect errors - if (offset > CHAR_MAX) - offset = 1; - } - - unsigned char tint = 0x40; - if (style.getValue(rbasename + "xft.shadow.tint", s)) { - tint = atoi(s.c_str()); - } + unsigned char offset = 1; + if (style.getValue(rbasename + "xft.shadow.offset", s)) { + offset = atoi(s.c_str()); //doesn't detect errors + if (offset > CHAR_MAX) + offset = 1; + } - - BFont *b = new BFont(screen_number, family, i, bold, italic, - dropShadow && shadow_fonts, - offset, tint, aa_fonts); - if (b->valid()) - return b; - delete b; + unsigned char tint = 0x40; + if (style.getValue(rbasename + "xft.shadow.tint", s)) { + tint = atoi(s.c_str()); } - if (style.getValue(rbasename + "xft.font", s)) - printf("Unable to load font \"%s\". Exiting\n", s.c_str()); - else - printf("Font not defined by style. Exiting\n"); - exit(2); // can't continue without a font + fontstring = "Arial,Sans-8:bold"; + + // if this fails, it ::exit()'s + return new BFont(screen_number, fontstring, dropShadow, offset, tint); } } |
