summaryrefslogtreecommitdiff
path: root/pango/pango-layout.c
Commit message (Collapse)AuthorAgeFilesLines
* layout: Fix some wrapped line start positionsblock-cursor-fixesMatthias Clasen2021-08-201-1/+2
| | | | | Make pango_layout_index_to_pos report non-empty pos for the first position in a wrapped line.
* layout: Fix some end-of-line positionMatthias Clasen2021-08-201-7/+8
| | | | | Make pango_layout_index_to_pos report non-empty rectangles at the end of a line.
* Fix pango_layout_index_to_pos resultsMatthias Clasen2021-08-201-6/+9
| | | | | We were returning wildly incorrect results for anything but the first run in a line.
* Document incompatibility of tabs and justificationdocument-tabsMatthias Clasen2021-08-191-1/+12
| | | | | | Not great, but these *are* conflicting features. Fixes: #595
* Add pango_justify_last_lineMatthias Clasen2021-08-101-2/+55
| | | | | | | Add a way to justify the last line in a justified paragraph. Fixes: #74
* Fix more corner cases around line endsMatthias Clasen2021-08-091-4/+18
| | | | | | We were miscounting the cursor positions in a line, causing us to jump down to the next line when moving backwards towards the start of the line.
* Fix corner cases around line endsMatthias Clasen2021-08-091-12/+16
| | | | | | | | | | pango_layout_index_to_line_and_extents needs to return a run rect even if the line has no non-empty runs. Failing to do so was causing cursors at the end of lines to have a height of 0 or 1, which is not what we want. Add a testcase.
* docs: Add an example for split cursorsMatthias Clasen2021-08-091-1/+15
| | | | | | | Show how weak and strong cursors look in practice. Fixes: #77
* docs: CosmeticsMatthias Clasen2021-08-081-3/+2
| | | | No need to link a function to itself.
* docs: Add one more dark mode imageMatthias Clasen2021-08-081-1/+4
|
* Fix up logical rectangle reportingMatthias Clasen2021-08-081-24/+76
| | | | | | | | | | | | | Fix up the various apis that are reporting logical rects to follow these rules: Logical rectangles of lines are affected by the line-height attribute, logical rectangles of smaller units (runs, clusters, chars, cursors, etc) are not. This fixes the text cursors and block cursors in GTK to be 'normal' height, even when applying line-height for double-spacing.
* layout: Handle line-height attributesMatthias Clasen2021-08-081-1/+30
| | | | | | | | | Modify the height and vertical origin of logical extents according to the line height attributes. We currently apply half the leading above and half below the content (i.e., lines are vertically centered in their modified height).
* Add line-height attributesMatthias Clasen2021-08-081-0/+3
| | | | | | | | | | | | Add attributes for line-height, in a relative and absolute variant. This will be used to grow the logical extents of runs in a way that is compatible with CSS semantics. In markup, we support a new line_height attribute that will be interpreted as absolute if it is an integer > 1024, and as a relative factor otherwise.
* docs: Add more detailsMatthias Clasen2021-08-081-0/+10
| | | | | Add some visualization of alignment and justification to the PangoLayout docs.
* docs: Some clarificationsMatthias Clasen2021-08-081-2/+7
| | | | | Add some more detail around baseline-to-baseline distances.
* Tweak the docsbidi-revengeMatthias Clasen2021-08-081-7/+6
| | | | | Make the docs for pango_layout_move_cursor_visually a bit more clear.
* Reimplement pango_layout_move_cursor_visuallyMatthias Clasen2021-08-081-171/+107
| | | | | | | | Reimplement this function based on pango_layout_get_cursor_pos. This is a bit less efficient, but it fixes cases where the old implementation would get stuck. Fixes: #587, #585, #157
* Try to improve pango_layout_get_cursor_posMatthias Clasen2021-08-081-9/+27
| | | | | Try to disambiguate run boundaries better. Not sure this works as intended, yet.
* Revert a non-longer needed changeMatthias Clasen2021-08-041-8/+0
| | | | | | | | | | | This reverts 681f92d78c2623, after adding the crash that it alludes to as a test case and verifying that it no longer crashes. This commit was causing split cursors to not work as intended at the end of a mixed-direction string. Broken since 2008...
* layout: Add some api for introspectionMatthias Clasen2021-08-011-0/+65
| | | | | | Add accessors for PangoLayoutLine fields. Fixes: #553
* CosmeticsMatthias Clasen2021-07-091-3/+3
|
* Merge branch 'fix-empty-line-spacing-2' into 'master'Matthias Clasen2021-07-091-13/+17
|\ | | | | | | | | | | | | layout: make the height of an empty line match a regular line Closes #577 See merge request GNOME/pango!363
| * layout: make the height of an empty line match a regular lineArtem Rebrov2021-07-081-13/+17
| | | | | | | | | | When using line-spacing, the height of an empty line is the same as when line-spacing has zero value. Take the value from font metrics.
* | docs: Small layout docs improvementsMatthias Clasen2021-07-091-6/+11
|/ | | | | Add some more default values, and correct the docs for pango_layout_set_spacing wrt to the default value.
* layout: Zero out log attrsMatthias Clasen2021-07-061-1/+1
| | | | This makes tests more reproducible.
* layout: Add a missing annotationMatthias Clasen2021-07-061-1/+1
| | | | pango_layout_get_tabs returns a copy.
* layout: Document default valuesMatthias Clasen2021-07-061-0/+8
| | | | | Since these are not properties, their default values aren't documented anywhere. Until now.
* layout: Correct a g_return_val_if_failMatthias Clasen2021-07-061-1/+1
| | | | | The convention is to return the initial value if the 'this' check fails. Correct this for auto_dir.
* layout: Explicitly initialize single_paragraphMatthias Clasen2021-07-061-0/+1
| | | | This makes it obvious what the initial value is.
* layout: Remove an overeager assertionMatthias Clasen2021-07-061-5/+3
| | | | | | | | | | pango_layout_get_direction contained an assertion that would be hit when just iterating over all chars in the text of the layout (it gets hit when you get to the final newline). Remove the assertion, so that this function is less of a trap.
* CosmeticsMatthias Clasen2021-07-061-2/+2
|
* docs: Reduce redundancydocs-cleanupsMatthias Clasen2021-05-201-4/+2
| | | | | | Remove a boatload of "or %NULL" from nullable parameters and return values. gi-docgen generates suitable text from the annotation that we don't need to duplicate.
* 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.