all repos — fluxbox @ 4acb333856c159ffcf1b252930e944ca6b8083bb

custom fork of the fluxbox windowmanager

antialias check
fluxgen fluxgen
commit

4acb333856c159ffcf1b252930e944ca6b8083bb

parent

a904d7b6b790396d396a57472467d4f2578b4f53

2 files changed, 15 insertions(+), 9 deletions(-)

jump to
M src/Font.ccsrc/Font.cc

@@ -19,7 +19,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -//$Id: Font.cc,v 1.12 2002/10/14 18:25:37 fluxgen Exp $ +//$Id: Font.cc,v 1.13 2002/10/15 10:56:49 fluxgen Exp $ #include "Font.hh"

@@ -65,7 +65,9 @@

bool Font::m_multibyte = false; bool Font::m_utf8mode = false; -Font::Font(const char *name, bool antialias) { +Font::Font(const char *name, bool antialias): +m_fontimp(0), +m_antialias(false) { // MB_CUR_MAX returns the size of a char in the current locale if (MB_CUR_MAX > 1) // more than one byte, then we're multibyte

@@ -81,10 +83,11 @@ m_utf8mode = true;

} // create the right font implementation + // antialias is prio 1 #ifdef USE_XFT - antialias = true; if (antialias) { m_fontimp = std::auto_ptr<FontImp>(new XftFontImp()); + m_antialias = true; } #endif //USE_XFT // if we didn't create a Xft font then create basic font

@@ -108,18 +111,19 @@

void Font::setAntialias(bool flag) { #ifdef USE_XFT - bool is_antialias = typeid(m_fontimp) == typeid(XftFontImp); - - if (flag && !is_antialias) { + if (flag && !isAntialias()) { m_fontimp = std::auto_ptr<FontImp>(new XftFontImp(m_fontstr.c_str())); - } else if (!flag && is_antialias) + } else if (!flag && isAntialias()) #endif // USE_XFT { if (m_multibyte || m_utf8mode) m_fontimp = std::auto_ptr<FontImp>(new XmbFontImp(m_fontstr.c_str(), m_utf8mode)); - else + else { m_fontimp = std::auto_ptr<FontImp>(new XFontImp(m_fontstr.c_str())); + } } + + m_antialias = flag; } bool Font::load(const char *name) {
M src/Font.hhsrc/Font.hh

@@ -19,7 +19,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -//$Id: Font.hh,v 1.5 2002/10/13 22:24:14 fluxgen Exp $ +//$Id: Font.hh,v 1.6 2002/10/15 10:55:30 fluxgen Exp $ #ifndef FBTK_FONT_HH #define FBTK_FONT_HH

@@ -61,12 +61,14 @@ */

unsigned int textWidth(const char *text, unsigned int size) const; unsigned int height() const; void drawText(Drawable w, int screen, GC gc, const char *text, size_t len, int x, int y) const; + bool isAntialias() const { return m_antialias; } private: std::auto_ptr<FontImp> m_fontimp; std::string m_fontstr; static bool m_multibyte; static bool m_utf8mode; + bool m_antialias; }; }; //end namespace FbTk