summaryrefslogtreecommitdiff
path: root/pango/pango-layout.c
Commit message (Collapse)AuthorAgeFilesLines
...
* | Disable hyphen for COMMON charactersPeng Wu2019-09-021-0/+1
|/ | | | The COMMON characters like symbol only line don't need hyphen.
* Disable hyphen for some languagesPeng Wu2019-08-281-0/+13
| | | | | Some languages like CJK languages, usually don't use the hyphen character.
* Fix a problem with allow-breaksMatthias Clasen2019-08-251-2/+1
| | | | | | | 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.
* Pass the right attributes when shaping ellipsesMatthias Clasen2019-08-061-1/+1
| | | | | | | | | | | | | | | 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 an insert-hyphens attributeMatthias Clasen2019-08-041-2/+35
| | | | | | | | | 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.
* layout: Use the new glyph rounding optionMatthias Clasen2019-08-031-3/+9
| | | | | Take the glyph rounding option from PangoContext and translate it into a shape flag.
* Make line-spacing opt-inMatthias Clasen2019-08-021-2/+2
| | | | | | | | | 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.
* Fix some issues with hyphensMatthias Clasen2019-07-271-18/+37
| | | | | | | | | 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.
* layout: Don't zero the width of visible spaceMatthias Clasen2019-07-251-0/+4
| | | | | | | | | | | | | | 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.
* layout: Make tab visible tooMatthias Clasen2019-07-251-2/+24
| | | | | | When the 'show space' attribute is present, arrange for tab characters to be passed on to the rendering layer as non-empty.
* layout: Use a show attributeMatthias Clasen2019-07-251-0/+6
| | | | | Use an attribute to show line breaks in single-paragraph mode.
* layout: The show attribute affects shapingMatthias Clasen2019-07-251-0/+1
|
* layout: Flip the logic for attribute filteringMatthias Clasen2019-07-241-86/+88
| | | | | | | | | | | 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.
* layout: Fix misleading namingMatthias Clasen2019-07-241-17/+17
| | | | | | | 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.
* Remove an unused functionMatthias Clasen2019-07-231-9/+0
|
* Fix a comment typoMatthias Clasen2019-07-221-1/+1
|
* layout: Pass offset to pango_tailor_breakMatthias Clasen2019-07-201-31/+10
| | | | This is necessary to interpret the attributes.
* Insert hyphens in more placesMatthias Clasen2019-07-201-2/+31
| | | | | | Look for whether the char before the break is not whitespace and doesn't look like a hyphen.
* Don't insert extra runs for hyphensMatthias Clasen2019-07-201-103/+30
| | | | | | | | | 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.
* Fix more compiler warningsMatthias Clasen2019-07-181-1/+1
| | | | These are clang warnings.
* 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.