| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
...when interpreting item->offset values.
I ran into this when executing tests of recent LibreOffice master with ASan on
Fedora 32 (with pango-1.44.7-2.fc32.x86_64), where one of the tests renders
various dialogs with a Tamil localization and failed with
> ==97247==ERROR: AddressSanitizer: SEGV on unknown address 0x60b000210006 (pc 0x7fd6c5b22b54 bp 0x61d0004b4150 sp 0x7fff107a0d18 T0)
> ==97247==The signal is caused by a READ memory access.
> #0 in g_utf8_get_char at ../glib/gutf8.c:319:37 (/lib64/libglib-2.0.so.0 +0x85b54)
> #1 in break_indic at ../pango/break-indic.c:119:17 (/lib64/libpango-1.0.so.0 +0x1076d)
> #2 in break_script at ../pango/break.c:1896:7 (/lib64/libpango-1.0.so.0 +0x1076d)
> #3 in tailor_break at ../pango/break.c:1606:9 (/lib64/libpango-1.0.so.0 +0x147db)
> #4 in pango_tailor_break at ../pango/break.c:1774:7 (/lib64/libpango-1.0.so.0 +0x147db)
> #5 in get_items_log_attrs at ../pango/pango-layout.c:4032:7 (/lib64/libpango-1.0.so.0 +0x2729c)
> #6 in pango_layout_check_lines at ../pango/pango-layout.c:4289:7 (/lib64/libpango-1.0.so.0 +0x2729c)
> #7 in pango_layout_get_extents_internal at ../pango/pango-layout.c:2623:3 (/lib64/libpango-1.0.so.0 +0x29068)
> #8 in gtk_label_get_measuring_layout at /usr/src/debug/gtk3-3.24.22-1.fc32.x86_64/gtk/gtklabel.c:3376:3 (/lib64/libgtk-3.so.0 +0x2454d0)
[...]
From some debugging, it smells like `pango_layout_check_lines` calls
`pango_itemize_with_base_dir` to compute `state.items` that are relative to the
beginning of `layout->text`, but then passes `state.items` together with the
offset'ed `start` into `get_items_log_attrs`, so that the latter misinterpreted
the items' locations relative to the offset'ed start.
Just adding
g_assert (item->offset <= length);
g_assert (item->length <= length - item->offset);
to the original `get_items_log_attrs` would make various tests in the `meson
test` suite fail, but which pass again with the complete fix, matching the above
speculation.
|
|
|
|
|
|
|
|
| |
I don't think this is a legitimate concern, but it is
faster to add a check than to argue about the use of
pango on fontless systems.
Fixes: #495
|
|
|
|
|
|
|
|
|
|
|
| |
You can call pango_layout_set_text() with a length that
is longer than the string (and there's code in the wild
that does that). We try to handle it by only looking at
the initial segment of the text, but we are forgetting
to set layout->length to the length of that segment,
leading us to access beyond the string end later.
This fixes #490
|
|
|
|
|
|
|
| |
Apparently, gtk2 assumes that calling pango_layout_set_attributes
guarantees that the attribute list gains a ref.
Fixes: #479
|
| |
|
|
|
|
|
| |
Make sure we have a valid iter here, which is of course always the case
in reality.
|
|
|
|
|
| |
pango_layout_get_effective_attributes can return
NULL. But not all callers were handling that.
|
|\
| |
| |
| |
| | |
Wip/baedert/for master2
See merge request GNOME/pango!190
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
| |
| |
| |
| | |
Instead of getting the logical rect and then not using it, try not to
compute it in the first place.
|
| |
| |
| |
| |
| |
| | |
This is a pretty weak check (think e.g. a layout containing the text
"a\na"), but it's very easy to do and still hits quite a few cases in
real-world applications.
|
|/
|
|
|
|
|
|
| |
We need to apply the right shape flags to the tab width calculation,
otherwise (when glyph positions get rounded, which is the default) our
tab width will be slightly off from what 8 spaces normally produce.
https://gitlab.gnome.org/GNOME/pango/issues/425
|
|
|
|
|
|
|
| |
When shaping the ellipsis, use the same shape flags
we use for the rest of the layout, otherwise we end
up with subtle size differences between an ellipsized
text and a plain …
|
|
|
|
|
|
| |
This matches what web browsers do.
Fixes https://gitlab.gnome.org/GNOME/pango/issues/432
|
| |
|
| |
|
|
|
|
|
|
|
| |
This lets callers access to resolved text direction
of a layout. GTK needs this.
Closes: https://gitlab.gnome.org/GNOME/pango/issues/14
|
|
|
|
|
|
| |
Deal with the fact that underlines and strikethroughs
are not constant across items, since we do not break
runs for these properties.
|
|
|
|
|
|
|
|
| |
It doesn't make sense to apply kerning between letters
if they are not on the same baseline. This was not noticed
so far, since it is very uncommon to have a rise without
an accompanying font change, which will cause the run to
be broken.
|
|
|
|
|
| |
We don't use ItemProperties in pango_layout_line_index_to_x
anymore, so no need to compute them either.
|
|
|
|
|
|
|
|
|
| |
This is what we used to do, and without it, we
lose kerning beween underlined and non-underlined
characters, which is most noticable with mnemonic
underlines.
Fixes: https://gitlab.gnome.org/GNOME/pango/issues/426
|
|\
| |
| |
| |
| |
| |
| | |
Drop some leftover code
Closes #418
See merge request GNOME/pango!144
|
| |
| |
| |
| |
| |
| |
| |
| | |
In d6bc8daa6935b53c1, we added code to remove "hyphen runs".
But we no longer create such runs, so this code is harmful
and can cause crashes under certain circumstances.
Closes: https://gitlab.gnome.org/GNOME/pango/issues/418
|
|/
|
|
| |
The COMMON characters like symbol only line don't need hyphen.
|
|
|
|
|
| |
Some languages like CJK languages,
usually don't use the hyphen character.
|
|
|
|
|
|
|
| |
Fix an oversight in the calculation of log
attributes. This was showing up as allow-breaks
attributes being applied to the wrong ranges
in later runs.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Now that we are splitting attributes into those that
are relevant for itemization and shaping, we need to
make sure to pass the right ones along when ellipsizing,
or we risk picking a wildly mismatching font for the
ellipsis run, causing things to shift vertically.
Test included.
Closes: https://gitlab.gnome.org/GNOME/pango/issues/397
Thanks to Jorge Luis Martinez Gomez for his help
in tracking this down.
|
|
|
|
|
|
|
|
|
| |
Add a text attribute that allows to suppress
insertion of hyphens at intra-word line breaks.
This is useful for non-paragraph-like contexts,
where line breaks are needed, but hyphens are not
expected.
|
|
|
|
|
| |
Take the glyph rounding option from PangoContext
and translate it into a shape flag.
|
|
|
|
|
|
|
|
|
| |
Default the new line-spacing property to 0, so
spacing continues to work. Applications can opt
in to the new line-spacing behavior by setting
a non-zero value.
This should make spacing in the Gimp work again.
|
|
|
|
|
|
|
|
|
| |
We were inserting hyphens after spaces, and in
some other places where they are not desirable.
Fix this by looking at the characters on both
sides of the break when deciding whether to
insert a hyphen.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Don't zero out a line separator at the end of line
if we turned it into an unknown glyph to render
it.
And if we zero out whitespace at the end of the line,
make sure we don't draw anything there by setting
the glyph to EMPTY.
Without this, we are getting the [LS] hex box
rendered on top of the last character in a line,
when the line separator ends up being visible.
|
|
|
|
|
|
| |
When the 'show space' attribute is present,
arrange for tab characters to be passed on
to the rendering layer as non-empty.
|
|
|
|
|
| |
Use an attribute to show line breaks in
single-paragraph mode.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
Instead of filtering out the attributes we don't
want to influence itemization, explicitly filter
only those attributes that we want to affect itemization.
This makes us no longer break items for custom
attributes, such as GtkTextAppearance attributes
that are created by GtkTextLayout.
Update expected output for layout testcases.
|
|
|
|
|
|
|
| |
What I called no_break_attrs are really
no_itemize_attrs - some of them explicitly
influence line breaking. So fix the misleading
naming and call them what they are.
|
| |
|
| |
|
|
|
|
| |
This is necessary to interpret the attributes.
|
|
|
|
|
|
| |
Look for whether the char before the break
is not whitespace and doesn't look like a
hyphen.
|
|
|
|
|
|
|
|
|
| |
Instead, reshape the pre-break run with the
soft hyphen replaced by an actual hyphen.
This is unfortunately inefficient, we copy
the entire text for this. The alternative
(scatter-gather populating the harfbuzz
buffer) is too hard to manage.
|
|
|
|
| |
These are clang warnings.
|