text: font: pango: fix font width being 0
We must avoid having a width of zero, otherwise, the text renderers might divide by zero. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This commit is contained in:
parent
1ef98f6ee4
commit
a0c8fd5f83
@ -364,13 +364,15 @@ static int kmscon_font_pango_init(struct kmscon_font *out,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!num) {
|
if (!num) {
|
||||||
log_warning("cannot measure font, using pango hints...");
|
log_warning("cannot measure font");
|
||||||
|
out->attr.width = out->attr.height;
|
||||||
|
out->baseline = 0;
|
||||||
} else {
|
} else {
|
||||||
out->attr.width = width;
|
out->attr.width = width;
|
||||||
out->attr.height = asc + desc;
|
out->attr.height = asc + desc;
|
||||||
out->baseline = desc;
|
out->baseline = desc;
|
||||||
kmscon_font_attr_normalize(&out->attr);
|
|
||||||
}
|
}
|
||||||
|
kmscon_font_attr_normalize(&out->attr);
|
||||||
|
|
||||||
out->data = face;
|
out->data = face;
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user