summaryrefslogtreecommitdiff
path: root/pango/pango-layout.c
Commit message (Collapse)AuthorAgeFilesLines
* docs: Convert gtk-doc syntax leftoversdocs-cleanupMatthias Clasen2021-05-191-167/+180
| | | | | Remove leftovers like #Type, reduce indentations to avoid markdown block quotes, etc.
* introspection: Stop using allow-noneMatthias Clasen2021-05-191-31/+31
| | | | | The allow-none annotation has been deprecated for a long time already. Instead use optional and nullable everywhere.
* Fix a thinkoMatthias Clasen2021-05-101-4/+6
| | | | | | | | | The commit message for d476d2a944500f8553 said "word boundaries", but the code checked for line breaks. That was wrong, since it also made hyphens disappear at SHY, where we very much want them. Update affected tests.
* Merge branch 'fix-layout-line-height' into 'master'Matthias Clasen2021-05-091-2/+2
|\ | | | | | | | | | | | | Make pango_layout_line_get_height work Closes #487 See merge request GNOME/pango!327
| * Make pango_layout_line_get_height workfix-layout-line-heightMatthias Clasen2021-05-081-2/+2
| | | | | | | | | | | | | | We were just never setting the height. Ouch! Test included. Fixes: #487
* | layout: handle empty lines betterfix-empty-line-spacingMatthias Clasen2021-05-081-2/+9
|/ | | | | | | When using line-spacing, we were not giving empty lines their expected width. Fix that. Fixes: #499
* layout: Remove a broken optimizationMatthias Clasen2021-05-081-5/+0
| | | | | | | pango_layout_set_width was trying to avoid invalidating lines in some cases, but it failed. Which is good, since this is incorrect, since it did not take possible ellipsization into account.
* layout: Don't insert hyphens at word boundariesword-break-hyphensMatthias Clasen2021-05-081-0/+3
| | | | | | | | | | We only want to insert hyphens when we are breaking inside a word. Update affected tests (hyphen-or-not shows up in the analysis flags in the output of test-layout). Fixes: #558
* Fix typo in PangoLayout: add missing backtickVictor Mireyev2021-04-081-1/+1
|
* Revert "Merge branch 'fix-deadlocks' into 'master'"revert-1fedc11aMatthias Clasen2021-03-311-12/+0
| | | This reverts merge request !309
* Add dashed and dotted lineslinesMatthias Clasen2021-03-301-0/+12
| | | | | | | Extend the PangoUnderline and PangoOverline enumerations to cover dashed and dotted variants of the various lines, add api to PangoRenderer to render such lines, and implement it in the cairo renderer.
* Use g_memdup2()memdup2Matthias Clasen2021-03-181-2/+2
| | | | | The g_memdup() function is replaced by a safer version in newer versions of GLib.
* Fix various broken linksMatthias Clasen2021-03-111-1/+1
| | | | All these were pointed out by gi-docgen warnings.
* docs: Tweak layout docsMatthias Clasen2021-03-111-95/+125
| | | | Add summaries, convert markup, etc.
* docs: Port PangoLayout to the new doc formatMatthias Clasen2021-03-111-1770/+1744
| | | | Replace gtk-doc'isms and use gi-docgen links instead.
* docs: Replace lots of vestigial xml markupMatthias Clasen2021-03-111-27/+25
| | | | | We want to use pure markdown, since docbook is going away as the intermediate format.
* docs: Move layout docs into the long descriptionMatthias Clasen2021-03-111-7/+6
| | | | | g-ir-scanner picks the long description over the struct docs, when the id matches.
* docs: Remove xml formatting from PangoLayoutMatthias Clasen2021-03-111-9/+8
| | | | This is in preparation for going to pure markdown.
* Docs: fix a typoMatthias Clasen2021-01-031-1/+1
|
* Let get_items_log_attrs take the start-of-text offset into accountStephan Bergmann2020-09-101-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ...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.
* Handle analysis.font being NULLMatthias Clasen2020-08-181-0/+3
| | | | | | | | 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
* layout: Avoid a crash with short stringsMatthias Clasen2020-07-301-0/+1
| | | | | | | | | | | 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
* Fix a crash in gtk2Matthias Clasen2020-06-101-5/+0
| | | | | | | Apparently, gtk2 assumes that calling pango_layout_set_attributes guarantees that the attribute list gains a ref. Fixes: #479
* layout: Ignore setting the attributes to the same listTimm Bäder2020-06-101-0/+4
|
* pango-layout: Help static analysis a bitTimm Bäder2020-06-101-0/+2
| | | | | Make sure we have a valid iter here, which is of course always the case in reality.
* layout: Fix a crashMatthias Clasen2020-06-091-12/+16
| | | | | pango_layout_get_effective_attributes can return NULL. But not all callers were handling that.
* Merge branch 'wip/baedert/for-master2' into 'master'Matthias Clasen2020-06-081-62/+113
|\ | | | | | | | | Wip/baedert/for master2 See merge request GNOME/pango!190
| * layout: Treat empty attr lists like NULL onesTimm Bäder2020-06-081-0/+6
| |
| * layout: Unconditionally unref attr listsTimm Bäder2020-06-081-5/+2
| |
| * pango-layout: Try to avoid allocating a new PangoAttrListTimm Bäder2020-06-081-5/+21
| |
| * layout: Avoid getting the text length if we know it alreadyTimm Bäder2020-06-081-7/+14
| |
| * Allocate internal PangoAttrLists on the stackTimm Bäder2020-06-081-11/+11
| |
| * layout: Add missing (nullable) annotationTimm Bäder2020-06-081-1/+2
| |
| * layotu: Avoid invalidating when setting attrs from NULL to NULLTimm Bäder2020-06-081-1/+5
| |
| * Allocate internal PangoAttrListIterators on the stackTimm Bäder2020-06-081-29/+31
| |
| * layout: Try to avoid some work when creating itersTimm Bäder2020-06-081-6/+19
| | | | | | | | | | Instead of getting the logical rect and then not using it, try not to compute it in the first place.
| * layout: Ignore setting the width if it won't have any effectTimm Bäder2020-06-081-0/+5
| | | | | | | | | | | | 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.
* | Use shape flags for tab widthJan Alexander Steffens (heftig)2020-02-111-1/+5
|/ | | | | | | | 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
* Use shape flags for ellipsisMatthias Clasen2019-11-031-1/+6
| | | | | | | 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 …
* Don’t use underline position in overlinesKhaled Hosny2019-11-021-2/+2
| | | | | | This matches what web browsers do. Fixes https://gitlab.gnome.org/GNOME/pango/issues/432
* layout: Handle overline attributesMatthias Clasen2019-10-311-3/+24
|
* layout: Handle new underline valuesMatthias Clasen2019-10-311-0/+4
|
* Add pango_layout_get_directionMatthias Clasen2019-10-311-0/+26
| | | | | | | This lets callers access to resolved text direction of a layout. GTK needs this. Closes: https://gitlab.gnome.org/GNOME/pango/issues/14
* Fix ItemProperties handlingMatthias Clasen2019-10-281-29/+54
| | | | | | Deal with the fact that underlines and strikethroughs are not constant across items, since we do not break runs for these properties.
* Don't treat rise as a no-shape attributeMatthias Clasen2019-10-281-0/+1
| | | | | | | | 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.
* Drop an unused ItemProperties useMatthias Clasen2019-10-281-3/+0
| | | | | We don't use ItemProperties in pango_layout_line_index_to_x anymore, so no need to compute them either.
* Go back to ignoring underlines for itemizationMatthias Clasen2019-10-281-5/+2
| | | | | | | | | 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
* Merge branch 'hyphen-crash' into 'master'Matthias Clasen2019-09-031-14/+1
|\ | | | | | | | | | | | | Drop some leftover code Closes #418 See merge request GNOME/pango!144
| * Drop some leftover codeMatthias Clasen2019-09-021-14/+1
| | | | | | | | | | | | | | | | 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
* | Disable hyphen for COMMON charactersPeng Wu2019-09-021-0/+1
|/ | | | The COMMON characters like symbol only line don't need hyphen.