mirror of
https://github.com/Kozea/WeasyPrint.git
synced 2024-10-05 08:27:22 +03:00
Don’t insert the same layout attributes multiple times
Using pango_attr_list_change is slower, but it prevents spacing attributes to be set twice, breaking the line-splitting algorithm for some reason. I don’t know if it is possible to add a simple test for that. Fix #1025.
This commit is contained in:
parent
cb610e88f0
commit
d2278aee69
@ -205,6 +205,8 @@ ffi.cdef('''
|
||||
void pango_attr_list_unref (PangoAttrList *list);
|
||||
void pango_attr_list_insert (
|
||||
PangoAttrList *list, PangoAttribute *attr);
|
||||
void pango_attr_list_change (
|
||||
PangoAttrList *list, PangoAttribute *attr);
|
||||
PangoAttribute * pango_attr_font_features_new (const gchar *features);
|
||||
PangoAttribute * pango_attr_letter_spacing_new (int letter_spacing);
|
||||
void pango_attribute_destroy (PangoAttribute *attr);
|
||||
@ -776,7 +778,7 @@ class Layout(object):
|
||||
# TODO: attributes should be freed
|
||||
attr = pango.pango_attr_letter_spacing_new(spacing)
|
||||
attr.start_index, attr.end_index = start, end
|
||||
pango.pango_attr_list_insert(attr_list, attr)
|
||||
pango.pango_attr_list_change(attr_list, attr)
|
||||
|
||||
add_attr(0, len(bytestring) + 1, letter_spacing)
|
||||
position = bytestring.find(b' ')
|
||||
|
Loading…
Reference in New Issue
Block a user