text: font: freetype2/pango: fix always setting real attributes

We copy the real attributes into the parent font structure only during
font-creation. However, if multiple renderers run simultaneously, they
might share fonts so we need to copy the attributes when reusing a font,
too.

This fixes a nasty division by zero bug during font rendering.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This commit is contained in:
David Herrmann 2012-08-11 14:35:01 +02:00
parent 66936a194c
commit 21092ba70f
2 changed files with 2 additions and 2 deletions

View File

@ -495,7 +495,6 @@ static int manager_get_face(struct face **out, struct kmscon_font_attr *attr)
}
}
memcpy(attr, &face->real_attr, sizeof(*attr));
kmscon_dlist_link(&manager__list, &face->list);
*out = face;
ret = 0;
@ -578,6 +577,7 @@ static int kmscon_font_freetype2_init(struct kmscon_font *out,
ret = manager_get_face(&face, &out->attr);
if (ret)
return ret;
memcpy(&out->attr, &face->real_attr, sizeof(out->attr));
out->baseline = face->baseline;
/* Shrinking is done to get a better width-value for fonts. As not all

View File

@ -320,7 +320,6 @@ static int manager_get_face(struct face **out, struct kmscon_font_attr *attr)
}
}
memcpy(attr, &face->real_attr, sizeof(*attr));
kmscon_dlist_link(&manager__list, &face->list);
*out = face;
ret = 0;
@ -370,6 +369,7 @@ static int kmscon_font_pango_init(struct kmscon_font *out,
ret = manager_get_face(&face, &out->attr);
if (ret)
return ret;
memcpy(&out->attr, &face->real_attr, sizeof(out->attr));
out->baseline = face->baseline;
out->data = face;