summaryrefslogtreecommitdiff
path: root/pango/pango-layout.c
Commit message (Collapse)AuthorAgeFilesLines
...
* layout: Fix reshaping with hyphen runsMatthias Clasen2019-07-171-2/+15
| | | | | | When we are uninserting a hyphen run, we need to undo the modifications of the item we split it off from.
* layout: Correctly account for hyphen widthMatthias Clasen2019-07-171-8/+14
| | | | | | We were sometimes adding a hyphen width when the break we were taking did not actually require a hyphen, causing us to break prematurely.
* Merge branch 'tailor-break' into 'master'Matthias Clasen2019-07-161-35/+47
|\ | | | | | | | | Tailor break See merge request GNOME/pango!86
| * layout: Tailor breaks properlyMatthias Clasen2019-07-161-35/+47
| | | | | | | | | | | | Call pango_default_break on the entire text, and then pango_tailor_break on segments with homogeneous language and script.
* | layout: Don't free no_break_attributes prematurelyMatthias Clasen2019-07-161-4/+4
|/ | | | | We use them in a loop. Don't free them before the loop is done.
* layout: Avoid access-after-freeMatthias Clasen2019-07-151-2/+4
| | | | | insert_run (... TRUE) frees the need_hyphen array, so we need to check for the hyphen beforehand.
* layout: Improve soft hyphen handlingMatthias Clasen2019-07-141-1/+8
| | | | | | | | | | | Point the item that we create for the inserted hyphen at the SHY in the paragraph text, shortening the previous run by one character. It would be nicer to not insert an extra run at all and just reshape the previous one in a way that maps the SHY to a hyphen, but that is more difficult to do as long as we are going through the shape engine API.
* layout: Fix some offset-vs-index confusionMatthias Clasen2019-07-141-32/+54
| | | | | | | | | | | | | | | | | We had some sad cases where we used a char offset as a byte index, with the expected bad results once there are multibyte characters in the mix. Instead of poking at the text in the middle of line-breaking, go back to keeping a plain array of positions that need a hyphen inserted. We maintain this array in parallel to the existing log_widths array, so hopefully the offset math is working out now. It is tempting to look at log_attrs.is_white for this, but that gives us double hyphens when breaks are taken at explicit hyphens. So, keep this information separately.
* layout: Correct a field typeMatthias Clasen2019-07-141-1/+1
| | | | | We had a boolean member in ParaBreakState that was used as an int. Oops
* Add some more docsMatthias Clasen2019-07-131-1/+2
|
* layout: Don't break runs for font_featuresMatthias Clasen2019-07-111-19/+65
| | | | | | | | | | Don't pass font_features attributes into the itemize run, since we don't need to break runs for this. Split them off, and reapply them after itemization. We rapply them before line breaking, since we want them to affect the shaping. Closes: https://gitlab.gnome.org/GNOME/pango/issues/242
* Leave some more attributes out of shapingMatthias Clasen2019-07-111-0/+2
| | | | | | We already count foreground and background color as no-shape attributes, so it makes sense to treat alpha the same.
* Fix a compiler warningMatthias Clasen2019-07-091-1/+0
|
* Fix a typoMatthias Clasen2019-07-091-1/+1
|
* Merge branch 'kill-lang-engine' into 'master'Matthias Clasen2019-07-091-8/+3
|\ | | | | | | | | Remove lang engine use See merge request GNOME/pango!73
| * Remove language engine remnantsMatthias Clasen2019-07-091-8/+3
| | | | | | | | | | Drop all internal use of language engines. The lang_engine field in PangoAnalysis is now unused.
* | Don't rely on log attrs for soft hyphenMatthias Clasen2019-07-091-1/+12
| | | | | | | | | | Instead, look at the pre- and post-break text to figure out what is needed.
* | Separate out the soft hyphen handlingMatthias Clasen2019-07-091-29/+57
|/ | | | Move things into some helper functions.
* layout: Insert hyphens at soft hyphen breaksMatthias Clasen2019-07-071-1/+95
| | | | | When we take a break at a soft hyphen, insert a visible hyphen.
* Update docsMatthias Clasen2019-07-051-2/+2
| | | | Make a new image for layout parameters.
* layout: Add line-spacingMatthias Clasen2019-07-051-20/+93
| | | | | | | | | | | | | | If line-spacing is set to a non-zero value, we place lines so that baseline2 = baseline1 + line-spacing * height2 where height2 is the line height of the second line. In this case, we ignore spacing. If line-spacing is set to zero, spacing is applied as before.
* Add line heights to layout linesMatthias Clasen2019-07-051-39/+105
| | | | Add a getter for the line height of a layout line.
* Clarify docs around text inputMatthias Clasen2018-12-121-9/+11
| | | | | | | Make it clear that all text input must be valid UTF-8, except in the case pango_layout_set_text, which we now officially document as accepting and handling invalid input.
* Fix fallout from bidi deprecationMatthias Clasen2018-12-111-0/+5
| | | | | | | PangoDirection is still used in some public apis, so just keep it around. Closes: #339
* Add missing "(transfer none)" annotation to pango_layout_iter_get_line()Kouhei Sutou2018-07-291-1/+1
| | | | | It should have been included in feff5a6e2682048a07a6ba09af83254e290bf394 .
* PangoLayout: Optimize pango_layout_get_baselineTimm Bäder2017-10-271-5/+6
| | | | | | | | | | | | | | The baseline is the baseline of the first line of text in the layout, so we can simply _get_extents_internal and use the extents of the first line we get from that. This is not a perfect solution (e.g. gtk+ calls pango_layout_get_extents before a pango_layout_get_baseline call and the former calls get_extents_internal anyway, so we compute the extents twice...) but it improves the situation pointed out by the comment in pango_layout_get_baseline. https://bugzilla.gnome.org/show_bug.cgi?id=788643
* PangoLayoutIter: Allocate an array of Extents instead of a linked listTimm Bäder2017-10-271-57/+29
| | | | | | | | Since PangoLayout caches the amount of lines it contains in ->line_count, we can use this to pre-allocate an Extents array of the appropriate size. https://bugzilla.gnome.org/show_bug.cgi?id=788643
* layout/renderer: Don't heap-allocate short lived layout iteratorsTimm Bäder2017-10-271-28/+29
| | | | | | | Use the new _pango_layout_get_iter and _pango_layout_iter_destroy instead. https://bugzilla.gnome.org/show_bug.cgi?id=788643
* layout: Move PangoLayouIter struct to private headerTimm Bäder2017-10-271-57/+27
| | | | | | | And add _pango_layout_get_iter as well as _pango_layout_iter_destroy that can be used for internal, stack allocated PangoLayoutIters. https://bugzilla.gnome.org/show_bug.cgi?id=788643
* Avoid a compiler warningMatthias Clasen2017-04-081-1/+1
| | | | | The compiler complains that rightmost_space may be used uninitialized. And it may be right.
* Bug 779232 - Wrong introspection annotation for pango_layout_get_sizeBehdad Esfahbod2017-02-251-2/+2
|
* pango-layout: Add a clarifying assertionPhilip Withnall2017-02-161-0/+4
| | | | | | | | | | | | | | In pango_layout_index_to_pos(), it looks like layout_line could be dereferenced while still NULL in the first loop iteration. This is not the case, as other bits of PangoLayout ensure its start_index is always 0, so this branch is never taken. Add an assertion to clarify that and guide static analysis. Coverity ID: 1391700 Signed-off-by: Philip Withnall <withnall@endlessm.com> https://bugzilla.gnome.org/show_bug.cgi?id=778656
* Fix typo in pango_layout_xy_to_index() docsKhaled Hosny2016-02-141-1/+1
| | | | | It was referring to itself for further description, but I assume the intent was to refer to pango_layout_line_x_to_index().
* Improve justify_cluster() some moreBehdad Esfahbod2015-08-211-15/+40
| | | | | | Much better now. Now I see issues in justify_words() again :(.
* Fix bug in previous commitBehdad Esfahbod2015-08-211-1/+1
|
* Fix justify_clusters()Behdad Esfahbod2015-08-211-37/+45
| | | | Was totally b0rked. Much better now. Should be good enough...
* Fix offset calculation for justifyBehdad Esfahbod2015-08-211-6/+28
| | | | | | | Bug 753772 - Justify option inserts spaces in wrong positions https://bugzilla.gnome.org/show_bug.cgi?id=753772 Went unnoticed for 8 years...
* Fix crasher in justify codeBehdad Esfahbod2015-08-211-5/+8
| | | | Ouch!
* Use grapheme boundaries in justify_clusters()Khaled Hosny2015-08-181-31/+46
| | | | | Instead of relying on the fact that marks have the same cluster number as their bases, which will change in the next commit.
* Bug 738505 - Add fontfeatures support in PangoAttributes and markupBehdad Esfahbod2015-06-181-0/+5
| | | | | | | | | | | https://bugzilla.gnome.org/show_bug.cgi?id=738505 Patch from Matthias Clasen, based on early patch from Akira TAGOH. There's room for improvement in how this is done, but it works now for simple cases, which is what most people will be using it for. Finally!
* Bug 750383 - Issue in ellipsization when line space is mentionedBehdad Esfahbod2015-06-041-0/+2
|
* Fix a few warningsBehdad Esfahbod2015-05-051-1/+1
|
* Fix leading vs trailing grapheme edge docsBehdad Esfahbod2015-05-051-4/+4
| | | | | https://bugzilla.gnome.org/show_bug.cgi?id=748822 https://bugzilla.gnome.org/show_bug.cgi?id=744836
* Add many missing nullability annotations.Evan Nemerson2014-10-161-22/+25
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=731022
* Revert "Fix leftover markup in docs"Matthias Clasen2014-08-301-8/+9
| | | | This reverts commit 19a252d9a3d63e7816f9a77bab65bd161675440a.
* Fix leftover markup in docsMatthias Clasen2014-08-301-9/+8
|
* Bug 720379 - SIGFPE in pango_layout_iter_get_char_extents()Behdad Esfahbod2013-12-151-2/+9
| | | | Untested.
* Bug 685167 - migrate docs to no-tmpl flavourBehdad Esfahbod2013-09-271-1/+49
| | | | Patch from Rafał Mużyło.
* Correct an annotationMatthias Clasen2013-09-101-1/+1
| | | | | | The annotation for pango_layout_set_attributes should be 'transfer none', not 'transfer full'. Pointed out in https://bugzilla.gnome.org/show_bug.cgi?id=707874
* layout: Never return NULL from pango_layout_get_text()Benjamin Otte2013-09-091-0/+5
| | | | | | | | | | | layouts get initialized with text == NULL as an optimization (avoid a malloc). But pango_layout_set_text (layout, NULL, 0); will set the text to "", so it is impossible to set a NULL text. Fxies crashers in various places that assume NULL return values never happen. https://bugzilla.gnome.org/show_bug.cgi?id=707659