aboutsummaryrefslogtreecommitdiff
path: root/src/tests/testFont.cc
diff options
context:
space:
mode:
authormathias <mathias>2005-06-03 07:25:48 (GMT)
committermathias <mathias>2005-06-03 07:25:48 (GMT)
commitef76b45ab1857af1b12f0c336bfb8c0f19140aeb (patch)
treee380d87f9e4c5e1b27f7aeb8d3aa8acbe0e09d2c /src/tests/testFont.cc
parent9c27e2e7993c9ccd604f77219a1f07c1be22e75a (diff)
downloadfluxbox-ef76b45ab1857af1b12f0c336bfb8c0f19140aeb.zip
fluxbox-ef76b45ab1857af1b12f0c336bfb8c0f19140aeb.tar.bz2
- Usage of xft-fonts is prefered, except a font-description starts with '-'
- Removed "antialias"-option completly, to enable/disable "antialias" use either <fontname>:antialias=<bool> in the style or use Xft.antialias: <bool> in your .Xdefaults - Added new styleresources: *.font.effect: <halo|shadow> *.font.shadow.x : <int> - shadow x offset *.font.shadow.y : <int> - shadow y offset *.font.shadow.color : <color> - color of shadow *.font.halo.color : <color> - color of halo - Removed 'shadow' and 'halo' options from fontdefinitions: !! Style authors have to update their styles !! - Simplified XmbFontImp to not try all possible fonts to match locale - Style authors may specify multiple fonts: <font1>|<font2>|<font3> if loading of font1 fails, fluxbox probes <font2>, etc. The last font is "fixed". Hints for style authors: - if xft tries to load a font it will _ALWAYS_ return a valid font, it doesnt have to look like the one you want to have, read more about it: http://fontconfig.org/fontconfig-user.html - export XFT_DEBUG=1 before running fluxbox helps to see which fonts are picked. eg: *.font: Verdana,Arial-12:antialias=true|-artwiz-snap-*- if fluxbox is compiled with xft this will NEVER try to load "-artwiz-snap-*-" since xft gives for sure a font, most likely Verdana or Arial but noone knows. So, if fluxbox has no xft support the first fontpattern fails and fluxbox tries the next one, which might be successful. if everything fails, it will use "fixed" - Added caching of fonts, fonts are only loaded once. - Fixed #1090902 (slow utf8 start)
Diffstat (limited to 'src/tests/testFont.cc')
-rw-r--r--src/tests/testFont.cc19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/tests/testFont.cc b/src/tests/testFont.cc
index 281a780..9a1433f 100644
--- a/src/tests/testFont.cc
+++ b/src/tests/testFont.cc
@@ -1,4 +1,3 @@
1// testFont.cc for fbtk test suite
2// Copyright (c) 2002 - 2005 Henrik Kinnunen (fluxgen at fluxbox dot org) 1// Copyright (c) 2002 - 2005 Henrik Kinnunen (fluxgen at fluxbox dot org)
3// 2//
4// Permission is hereby granted, free of charge, to any person obtaining a 3// Permission is hereby granted, free of charge, to any person obtaining a
@@ -56,12 +55,13 @@ public:
56 XLookupString(&ke, keychar, 1, &ks, 0); 55 XLookupString(&ke, keychar, 1, &ks, 0);
57 if (ks == XK_Escape) 56 if (ks == XK_Escape)
58 end(); 57 end();
58 /*
59 else { // toggle antialias 59 else { // toggle antialias
60 m_font.setAntialias(!m_font.isAntialias()); 60 m_font.setAntialias(!m_font.isAntialias());
61 cerr<<boolalpha; 61 cerr<<boolalpha;
62 cerr<<"antialias: "<<m_font.isAntialias()<<endl; 62 cerr<<"antialias: "<<m_font.isAntialias()<<endl;
63 redraw(); 63 redraw();
64 } 64 } */
65 } 65 }
66 66
67 void exposeEvent(XExposeEvent &event) { 67 void exposeEvent(XExposeEvent &event) {
@@ -86,7 +86,7 @@ public:
86 m_win.drawLine(wingc.gc(), 86 m_win.drawLine(wingc.gc(),
87 x, y, x + text_w, y); 87 x, y, x + text_w, y);
88 wingc.setForeground(FbTk::Color(m_foreground.c_str(), m_win.screenNumber())); 88 wingc.setForeground(FbTk::Color(m_foreground.c_str(), m_win.screenNumber()));
89 cerr<<"text width: "<<m_font.textWidth(m_text.c_str(), m_text.size())<<endl; 89 //cerr<<"text width: "<<m_font.textWidth(m_text.c_str(), m_text.size())<<endl;
90 m_font.drawText(m_win, 90 m_font.drawText(m_win,
91 0, wingc.gc(), 91 0, wingc.gc(),
92 m_text.c_str(), m_text.size(), 92 m_text.c_str(), m_text.size(),
@@ -105,9 +105,10 @@ private:
105}; 105};
106 106
107int main(int argc, char **argv) { 107int main(int argc, char **argv) {
108 bool antialias = false; 108 //bool antialias = false;
109 bool rotate = false; 109 bool rotate = false;
110 string fontname("fixed"); 110 bool xft = false;
111 string fontname("");
111 string displayname(""); 112 string displayname("");
112 string background("black"); 113 string background("black");
113 string foreground("white"); 114 string foreground("white");
@@ -115,8 +116,8 @@ int main(int argc, char **argv) {
115 for (int a=1; a<argc; ++a) { 116 for (int a=1; a<argc; ++a) {
116 if (strcmp("-font", argv[a])==0 && a + 1 < argc) { 117 if (strcmp("-font", argv[a])==0 && a + 1 < argc) {
117 fontname = argv[++a]; 118 fontname = argv[++a];
118 } else if (strcmp("-antialias", argv[a]) == 0) { 119 } else if (strcmp("-xft", argv[a])==0) {
119 antialias = true; 120 xft = true;
120 } else if (strcmp("-display", argv[a]) == 0 && a + 1 < argc) { 121 } else if (strcmp("-display", argv[a]) == 0 && a + 1 < argc) {
121 displayname = argv[++a]; 122 displayname = argv[++a];
122 } else if (strcmp("-text", argv[a]) == 0 && a + 1 < argc) { 123 } else if (strcmp("-text", argv[a]) == 0 && a + 1 < argc) {
@@ -130,7 +131,7 @@ int main(int argc, char **argv) {
130 } else if (strcmp("-h", argv[a]) == 0) { 131 } else if (strcmp("-h", argv[a]) == 0) {
131 cerr<<"Arguments: "<<endl; 132 cerr<<"Arguments: "<<endl;
132 cerr<<"-font <fontname>"<<endl; 133 cerr<<"-font <fontname>"<<endl;
133 cerr<<"-antialias"<<endl; 134 // cerr<<"-antialias"<<endl;
134 cerr<<"-display <display>"<<endl; 135 cerr<<"-display <display>"<<endl;
135 cerr<<"-text <text>"<<endl; 136 cerr<<"-text <text>"<<endl;
136 cerr<<"-rotate"<<endl; 137 cerr<<"-rotate"<<endl;
@@ -144,7 +145,7 @@ int main(int argc, char **argv) {
144 145
145 146
146 App app(displayname.c_str(), foreground, background); 147 App app(displayname.c_str(), foreground, background);
147 app.font().setAntialias(antialias); 148 //app.font().setAntialias(antialias);
148 if (!app.font().load(fontname.c_str())) 149 if (!app.font().load(fontname.c_str()))
149 cerr<<"Failed to load: "<<fontname<<endl; 150 cerr<<"Failed to load: "<<fontname<<endl;
150 cerr<<"Setting text: "<<text<<endl; 151 cerr<<"Setting text: "<<text<<endl;