diff options
author | Gary Wong <gtw@gnu.org> | 2009-08-28 17:15:42 -0600 |
---|---|---|
committer | Gary Wong <gtw@gnu.org> | 2009-08-28 17:15:42 -0600 |
commit | a71d93565fd4d3e916444c4bb57329fb6a92f26f (patch) | |
tree | 09ac1c8c171cd1469c5939b2cad36e92f81da2c9 | |
parent | 65acbd9998ea9125309c192edec99a783202b912 (diff) |
Replace FONT_FAMILY, FONT_WEIGHT, FONT_PIXEL_SIZE, etc. with FONT_NAME.
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | decorate-render.c | 25 |
2 files changed, 17 insertions, 14 deletions
@@ -1,5 +1,11 @@ 2009-08-28 Gary Wong <gtw@gnu.org> + * decorate-render.c (query_metrics, render_text, render_update_window, + decorate_render_init): Replace FONT_FAMILY, FONT_WEIGHT, + FONT_PIXEL_SIZE, FONT_LOAD_TARGET with FONT_NAME. + +2009-08-28 Gary Wong <gtw@gnu.org> + * decorate-render.c (query_metrics, replace_glyph): Don't bother comparing the first cache line with itself. diff --git a/decorate-render.c b/decorate-render.c index 78f6243..853608d 100644 --- a/decorate-render.c +++ b/decorate-render.c @@ -39,13 +39,14 @@ #include "decorate-render.h" /* FIXME make this configurable */ -#define FONT_FAMILY "sans" -#define FONT_WEIGHT FC_WEIGHT_BOLD -#define FONT_PIXEL_SIZE 12 -#define FONT_LOAD_TARGET FT_LOAD_TARGET_LIGHT +#define FONT_SIZE 12 +#define STRING2(x) #x +#define STRING(x) STRING2(x) +#define FONT_SIZE_STRING STRING( FONT_SIZE ) +#define FONT_NAME "sans:pixelsize=" FONT_SIZE_STRING ":bold" static FT_Library ftl; -static FT_Face ftf; +static FT_Face ftf; /* FIXME allow multiple faces per fontconfig pattern */ static const uint16_t decoration_cols[ NUM_COLS ][ 3 ] = { { 0x2222, 0x3333, 0xEEEE }, /* COL_FRAME_ACTIVE */ @@ -101,7 +102,7 @@ static void query_metrics( uint32_t c, int *x_off, int *y_off ) { } /* Cache miss. */ - if( FT_Load_Char( ftf, c, FONT_LOAD_TARGET ) ) { + if( FT_Load_Char( ftf, c, FT_LOAD_DEFAULT ) ) { /* Couldn't load metrics. Don't bother evicting anything. */ *x_off = *y_off = 0; return; @@ -327,8 +328,7 @@ static xcb_void_cookie_t render_text( xcb_drawable_t drawable, int screen, room for later glyphs. */ break; - if( FT_Load_Char( ftf, buf[ i ], FT_LOAD_RENDER | - FONT_LOAD_TARGET ) || + if( FT_Load_Char( ftf, buf[ i ], FT_LOAD_RENDER ) || ( bitmap_size = ( ( ftf->glyph->bitmap.width + 3 ) & ~3 ) * ftf->glyph->bitmap.rows ) > sizeof data ) { /* We couldn't load the character, or it was so @@ -426,7 +426,7 @@ extern void render_update_window( struct gwm_window *window ) { render_text( window->w, window->screen, window == focus_frame ? COL_TITLE_ACTIVE : COL_TITLE_INACTIVE, FRAME_BUTTON_SIZE + FRAME_BORDER_WIDTH * 3, - FONT_PIXEL_SIZE, name ? name : "(Untitled)", + FONT_SIZE, name ? name : "(Untitled)", &window->update ); } else if( window->type == WINDOW_FEEDBACK ) { char *p, text[ 32 ]; @@ -629,10 +629,7 @@ extern void decorate_render_init( void ) { FcInit(); - pat = FcPatternBuild( NULL, FC_FAMILY, FcTypeString, FONT_FAMILY, - FC_WEIGHT, FcTypeInteger, FONT_WEIGHT, - FC_PIXEL_SIZE, FcTypeDouble, (double) FONT_PIXEL_SIZE, - NULL ); + pat = FcNameParse( FONT_NAME ); FcConfigSubstitute( NULL, pat, FcMatchPattern ); @@ -656,7 +653,7 @@ extern void decorate_render_init( void ) { FcFini(); - if( ( err = FT_Set_Char_Size( ftf, 0, FONT_PIXEL_SIZE << 6, 0, 0 ) ) ) + if( ( err = FT_Set_Char_Size( ftf, 0, FONT_SIZE << 6, 0, 0 ) ) ) fatal( "%s: could not scale font (%d)", filename, err ); if( ( err = FT_Select_Charmap( ftf, FT_ENCODING_UNICODE ) ) ) |