Match fallback font FC_SIZE to original font
This commit is contained in:
		
							
								
								
									
										5
									
								
								window.c
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								window.c
									
									
									
									
									
								
							@@ -48,6 +48,7 @@ static GC gc;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
static XftFont *font;
 | 
					static XftFont *font;
 | 
				
			||||||
static int fontheight;
 | 
					static int fontheight;
 | 
				
			||||||
 | 
					static double fontsize;
 | 
				
			||||||
static int barheight;
 | 
					static int barheight;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Atom atoms[ATOM_COUNT];
 | 
					Atom atoms[ATOM_COUNT];
 | 
				
			||||||
@@ -60,6 +61,7 @@ void win_init_font(const win_env_t *e, const char *fontstr)
 | 
				
			|||||||
	if ((font = XftFontOpenName(e->dpy, e->scr, fontstr)) == NULL)
 | 
						if ((font = XftFontOpenName(e->dpy, e->scr, fontstr)) == NULL)
 | 
				
			||||||
		error(EXIT_FAILURE, 0, "Error loading font '%s'", fontstr);
 | 
							error(EXIT_FAILURE, 0, "Error loading font '%s'", fontstr);
 | 
				
			||||||
	fontheight = font->ascent + font->descent;
 | 
						fontheight = font->ascent + font->descent;
 | 
				
			||||||
 | 
						FcPatternGetDouble(font->pattern, FC_SIZE, 0, &fontsize);
 | 
				
			||||||
	barheight = fontheight + 2 * V_TEXT_PAD;
 | 
						barheight = fontheight + 2 * V_TEXT_PAD;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -414,7 +416,8 @@ int win_draw_text(win_t *win, XftDraw *d, const XftColor *color, int x, int y,
 | 
				
			|||||||
			fccharset = FcCharSetCreate();
 | 
								fccharset = FcCharSetCreate();
 | 
				
			||||||
			FcCharSetAddChar(fccharset, rune);
 | 
								FcCharSetAddChar(fccharset, rune);
 | 
				
			||||||
			f = XftFontOpen(win->env.dpy, win->env.scr, FC_CHARSET, FcTypeCharSet,
 | 
								f = XftFontOpen(win->env.dpy, win->env.scr, FC_CHARSET, FcTypeCharSet,
 | 
				
			||||||
			                fccharset, FC_SCALABLE, FcTypeBool, FcTrue, NULL);
 | 
								                fccharset, FC_SCALABLE, FcTypeBool, FcTrue,
 | 
				
			||||||
 | 
								                FC_SIZE, FcTypeDouble, fontsize, NULL);
 | 
				
			||||||
			FcCharSetDestroy(fccharset);
 | 
								FcCharSetDestroy(fccharset);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		XftTextExtentsUtf8(win->env.dpy, f, (XftChar8*)t, next - t, &ext);
 | 
							XftTextExtentsUtf8(win->env.dpy, f, (XftChar8*)t, next - t, &ext);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user