On 12/17/2013 10:06 AM, Nils Reuße wrote:
Hi suckless@,i tried to set a font and fontsize in config.h with the xft notation FONT-SIZE: static char font[] = "Source Code Pro Medium-18:style=Regular"; The font was recognized, but not the font size, defaulting to 12. The same was true when i used the size attribute: static char font[] = "Source Code Pro Medium:style=Regular:size=18"; After figuring out that only the attribute 'pixelsize' works, i changed all occurrences of FC_PIXEL_SIZE to FC_SIZE in st.c (latest git, patch below), and now it works with size (but obviously breaks with pixelsize). I prefer size over pixelsize because size scales to the current display resolution, while pixelsize has to be increased (either in config.h or on starting st), e.g. if you switch between a non-hd (home) and hd screen (work). What do you think? Best, Nils diff --git a/st.c b/st.c index f883ac1..e888f32 100644 --- a/st.c +++ b/st.c @@ -2841,11 +2841,11 @@ xloadfonts(char *fontstr, int fontsize) { die("st: can't open font %s\n", fontstr); if(fontsize > 0) { - FcPatternDel(pattern, FC_PIXEL_SIZE); - FcPatternAddDouble(pattern, FC_PIXEL_SIZE, (double)fontsize); + FcPatternDel(pattern, FC_SIZE); + FcPatternAddDouble(pattern, FC_SIZE, (double)fontsize); usedfontsize = fontsize; } else { - result = FcPatternGetDouble(pattern, FC_PIXEL_SIZE, 0, &fontval); + result = FcPatternGetDouble(pattern, FC_SIZE, 0, &fontval); if(result == FcResultMatch) { usedfontsize = (int)fontval; } else { @@ -2853,7 +2853,7 @@ xloadfonts(char *fontstr, int fontsize) { * Default font size is 12, if none given. This is to * have a known usedfontsize value. */ - FcPatternAddDouble(pattern, FC_PIXEL_SIZE, 12); + FcPatternAddDouble(pattern, FC_SIZE, 12); usedfontsize = 12; } }
Sorry for double posting, but i figured out that 'pixelsize' still works when my patch is applied. Didn't test bitmap fonts so far, though.
Nils
