check font metric sanity
This commit is contained in:
parent
ecc402414b
commit
2210a592b6
21
termite.cc
21
termite.cc
|
@ -531,19 +531,20 @@ void window_title_cb(VteTerminal *vte, gboolean *dynamic_title) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void update_font_size(VteTerminal *vte, int update) {
|
static void update_font_size(VteTerminal *vte, int update) {
|
||||||
const PangoFontDescription *vte_desc = vte_terminal_get_font(vte);
|
const PangoFontDescription *desc = vte_terminal_get_font(vte);
|
||||||
PangoFontDescription *font_desc = pango_font_description_copy(vte_desc);
|
int size = pango_font_description_get_size(desc);
|
||||||
|
|
||||||
bool abs = pango_font_description_get_size_is_absolute(font_desc);
|
if (!pango_font_description_get_size_is_absolute(desc))
|
||||||
int size = pango_font_description_get_size(font_desc);
|
|
||||||
|
|
||||||
if (!abs)
|
|
||||||
update *= PANGO_SCALE;
|
update *= PANGO_SCALE;
|
||||||
size += update;
|
|
||||||
|
|
||||||
pango_font_description_set_size(font_desc, size);
|
size += update;
|
||||||
vte_terminal_set_font(vte, font_desc);
|
if (size > 0) {
|
||||||
pango_font_description_free(font_desc);
|
PangoFontDescription *new_desc = pango_font_description_copy(desc);
|
||||||
|
|
||||||
|
pango_font_description_set_size(new_desc, size);
|
||||||
|
vte_terminal_set_font(vte, new_desc);
|
||||||
|
pango_font_description_free(new_desc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean key_press_cb(VteTerminal *vte, GdkEventKey *event, keybind_info *info) {
|
gboolean key_press_cb(VteTerminal *vte, GdkEventKey *event, keybind_info *info) {
|
||||||
|
|
Loading…
Reference in New Issue