add option to the rc file to use/not use AA for Xft fonts
This commit is contained in:
parent
858af98b90
commit
20bc088a99
4 changed files with 32 additions and 21 deletions
27
src/Font.cc
27
src/Font.cc
|
@ -44,23 +44,23 @@ using std::endl;
|
||||||
#include "GCCache.hh"
|
#include "GCCache.hh"
|
||||||
#include "Color.hh"
|
#include "Color.hh"
|
||||||
|
|
||||||
bool BFont::_antialias = True;
|
|
||||||
string BFont::_fallback_font = "fixed";
|
string BFont::_fallback_font = "fixed";
|
||||||
|
|
||||||
|
|
||||||
#ifdef XFT
|
#ifdef XFT
|
||||||
BFont::BFont(Display *d, BScreen *screen, const string &family, int size,
|
BFont::BFont(Display *d, BScreen *screen, const string &family, int size,
|
||||||
bool bold, bool italic) : _display(d),
|
bool bold, bool italic, bool antialias) :
|
||||||
_screen(screen),
|
_display(d),
|
||||||
_family(family),
|
_screen(screen),
|
||||||
_simplename(False),
|
_family(family),
|
||||||
_size(size),
|
_simplename(False),
|
||||||
_bold(bold),
|
_size(size),
|
||||||
_italic(italic),
|
_bold(bold),
|
||||||
_xftfont(0),
|
_italic(italic),
|
||||||
_font(0),
|
_antialias(antialias),
|
||||||
_fontset(0),
|
_xftfont(0),
|
||||||
_fontset_extents(0) {
|
_font(0),
|
||||||
|
_fontset(0),
|
||||||
|
_fontset_extents(0) {
|
||||||
_valid = False;
|
_valid = False;
|
||||||
|
|
||||||
_xftfont = XftFontOpen(_display, _screen->getScreenNumber(),
|
_xftfont = XftFontOpen(_display, _screen->getScreenNumber(),
|
||||||
|
@ -90,6 +90,7 @@ BFont::BFont(Display *d, BScreen *screen, const string &xlfd) :
|
||||||
_display(d),
|
_display(d),
|
||||||
_screen(screen),
|
_screen(screen),
|
||||||
#ifdef XFT
|
#ifdef XFT
|
||||||
|
_antialias(False),
|
||||||
_xftfont(0),
|
_xftfont(0),
|
||||||
#endif // XFT
|
#endif // XFT
|
||||||
_font(0),
|
_font(0),
|
||||||
|
|
|
@ -47,13 +47,9 @@ class BFont {
|
||||||
* static members
|
* static members
|
||||||
*/
|
*/
|
||||||
private:
|
private:
|
||||||
static bool _antialias;
|
|
||||||
static std::string _fallback_font;
|
static std::string _fallback_font;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
inline static bool antialias(void) { return _antialias; }
|
|
||||||
inline static void setAntialias(bool a) { _antialias = a; }
|
|
||||||
|
|
||||||
// the fallback is only used for X fonts, not for Xft fonts, since it is
|
// the fallback is only used for X fonts, not for Xft fonts, since it is
|
||||||
// assumed that X fonts will be the fallback from Xft.
|
// assumed that X fonts will be the fallback from Xft.
|
||||||
inline static std::string fallbackFont(void) { return _fallback_font; }
|
inline static std::string fallbackFont(void) { return _fallback_font; }
|
||||||
|
@ -74,6 +70,8 @@ private:
|
||||||
bool _italic;
|
bool _italic;
|
||||||
|
|
||||||
#ifdef XFT
|
#ifdef XFT
|
||||||
|
bool _antialias;
|
||||||
|
|
||||||
XftFont *_xftfont;
|
XftFont *_xftfont;
|
||||||
|
|
||||||
bool createXftFont(void);
|
bool createXftFont(void);
|
||||||
|
@ -97,7 +95,7 @@ public:
|
||||||
#ifdef XFT
|
#ifdef XFT
|
||||||
// loads an Xft font
|
// loads an Xft font
|
||||||
BFont(Display *d, BScreen *screen, const std::string &family, int size,
|
BFont(Display *d, BScreen *screen, const std::string &family, int size,
|
||||||
bool bold, bool italic);
|
bool bold, bool italic, bool antialias = True);
|
||||||
#endif
|
#endif
|
||||||
// loads a standard X font
|
// loads a standard X font
|
||||||
BFont(Display *d, BScreen *screen, const std::string &xlfd);
|
BFont(Display *d, BScreen *screen, const std::string &xlfd);
|
||||||
|
|
|
@ -388,6 +388,13 @@ void BScreen::saveFocusLast(bool f) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void BScreen::saveAAFonts(bool f) {
|
||||||
|
resource.aa_fonts = f;
|
||||||
|
reconfigure();
|
||||||
|
config->setValue(screenstr + "antialiasFonts", resource.aa_fonts);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void BScreen::saveHideToolbar(bool h) {
|
void BScreen::saveHideToolbar(bool h) {
|
||||||
resource.hide_toolbar = h;
|
resource.hide_toolbar = h;
|
||||||
if (resource.hide_toolbar)
|
if (resource.hide_toolbar)
|
||||||
|
@ -497,6 +504,7 @@ void BScreen::save_rc(void) {
|
||||||
saveSloppyFocus(resource.sloppy_focus);
|
saveSloppyFocus(resource.sloppy_focus);
|
||||||
saveAutoRaise(resource.auto_raise);
|
saveAutoRaise(resource.auto_raise);
|
||||||
saveImageDither(doImageDither());
|
saveImageDither(doImageDither());
|
||||||
|
saveAAFonts(resource.aa_fonts);
|
||||||
saveOpaqueMove(resource.opaque_move);
|
saveOpaqueMove(resource.opaque_move);
|
||||||
saveFullMax(resource.full_max);
|
saveFullMax(resource.full_max);
|
||||||
saveFocusNew(resource.focus_new);
|
saveFocusNew(resource.focus_new);
|
||||||
|
@ -540,6 +548,9 @@ void BScreen::load_rc(void) {
|
||||||
if (! config->getValue(screenstr + "opaqueMove", resource.opaque_move))
|
if (! config->getValue(screenstr + "opaqueMove", resource.opaque_move))
|
||||||
resource.opaque_move = false;
|
resource.opaque_move = false;
|
||||||
|
|
||||||
|
if (! config->getValue(screenstr + "antialiasFonts", resource.aa_fonts))
|
||||||
|
resource.aa_fonts = true;
|
||||||
|
|
||||||
if (! config->getValue(screenstr + "hideToolbar", resource.hide_toolbar))
|
if (! config->getValue(screenstr + "hideToolbar", resource.hide_toolbar))
|
||||||
resource.hide_toolbar = false;
|
resource.hide_toolbar = false;
|
||||||
|
|
||||||
|
@ -2158,7 +2169,7 @@ BFont *BScreen::readDatabaseFont(const string &rbasename,
|
||||||
}
|
}
|
||||||
|
|
||||||
BFont *b = new BFont(blackbox->getXDisplay(), this, family, i, bold,
|
BFont *b = new BFont(blackbox->getXDisplay(), this, family, i, bold,
|
||||||
italic);
|
italic, resource.aa_fonts);
|
||||||
if (b->valid())
|
if (b->valid())
|
||||||
return b;
|
return b;
|
||||||
else
|
else
|
||||||
|
|
|
@ -26,7 +26,6 @@
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
#include <X11/Xresource.h>
|
|
||||||
|
|
||||||
#ifdef TIME_WITH_SYS_TIME
|
#ifdef TIME_WITH_SYS_TIME
|
||||||
# include <sys/time.h>
|
# include <sys/time.h>
|
||||||
|
@ -150,7 +149,7 @@ private:
|
||||||
|
|
||||||
bool sloppy_focus, auto_raise, auto_edge_balance, ordered_dither,
|
bool sloppy_focus, auto_raise, auto_edge_balance, ordered_dither,
|
||||||
opaque_move, full_max, focus_new, focus_last, click_raise,
|
opaque_move, full_max, focus_new, focus_last, click_raise,
|
||||||
hide_toolbar, window_to_window_snap, window_corner_snap;
|
hide_toolbar, window_to_window_snap, window_corner_snap, aa_fonts;
|
||||||
BColor border_color;
|
BColor border_color;
|
||||||
|
|
||||||
unsigned int workspaces;
|
unsigned int workspaces;
|
||||||
|
@ -205,6 +204,7 @@ public:
|
||||||
inline bool doAutoRaise(void) const { return resource.auto_raise; }
|
inline bool doAutoRaise(void) const { return resource.auto_raise; }
|
||||||
inline bool doClickRaise(void) const { return resource.click_raise; }
|
inline bool doClickRaise(void) const { return resource.click_raise; }
|
||||||
inline bool isScreenManaged(void) const { return managed; }
|
inline bool isScreenManaged(void) const { return managed; }
|
||||||
|
inline bool doAAFonts(void) const { return resource.aa_fonts; }
|
||||||
inline bool doImageDither(void) const { return image_control->doDither(); }
|
inline bool doImageDither(void) const { return image_control->doDither(); }
|
||||||
inline bool doOrderedDither(void) const { return resource.ordered_dither; }
|
inline bool doOrderedDither(void) const { return resource.ordered_dither; }
|
||||||
inline bool doOpaqueMove(void) const { return resource.opaque_move; }
|
inline bool doOpaqueMove(void) const { return resource.opaque_move; }
|
||||||
|
@ -268,6 +268,7 @@ public:
|
||||||
void saveColPlacementDirection(int d);
|
void saveColPlacementDirection(int d);
|
||||||
void saveEdgeSnapThreshold(int t);
|
void saveEdgeSnapThreshold(int t);
|
||||||
void saveImageDither(bool d);
|
void saveImageDither(bool d);
|
||||||
|
void saveAAFonts(bool f);
|
||||||
void saveOpaqueMove(bool o);
|
void saveOpaqueMove(bool o);
|
||||||
void saveFullMax(bool f);
|
void saveFullMax(bool f);
|
||||||
void saveFocusNew(bool f);
|
void saveFocusNew(bool f);
|
||||||
|
|
Loading…
Reference in a new issue