diff options
Diffstat (limited to 'src/tests/testFont.cc')
-rw-r--r-- | src/tests/testFont.cc | 19 |
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 | ||
107 | int main(int argc, char **argv) { | 107 | int 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; |