summaryrefslogtreecommitdiff
path: root/pango
Commit message (Collapse)AuthorAgeFilesLines
* Fix line heights in improper gravitiesgravity-fixesMatthias Clasen2021-11-271-1/+1
| | | | | | | | | | | Without this, we end up with line height being zero in gravity north or west. The visible symptom is that wrapped lines are drawn on top of each other with line-height != 0. Affected tests have been updated. Fixes: #631
* Fix misplaced glyphs in gravity eastMatthias Clasen2021-11-271-1/+4
| | | | | This was showing up as glyphs placed outside their logical extents.
* font: Avoid cosmetic uglinessMatthias Clasen2021-11-271-2/+3
| | | | | | | | When setting variations to "", font descriptions would add an ugly useless " @" at the end of their serialization. Avoid that. Test included.
* Avoid an out-of-bound accessMatthias Clasen2021-11-271-1/+1
| | | | | We can only use the width of the previous char if we are not at the first char. Found by asan.
* Make sure glyphinfo is fully initializedMatthias Clasen2021-11-261-0/+1
| | | | | The alternative is random test failures, now that we check all these fields in test-layout.
* Merge branch 'hinted-metrics-fixes' into 'main'Matthias Clasen2021-11-262-4/+30
|\ | | | | | | | | | | | | Hinted metrics fixes Closes #626 See merge request GNOME/pango!518
| * Calculate hinted font height based on the hinted extentsSebastian Keller2021-11-221-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | The previous code was calculating the rounded up version of the difference between the unhinted ascender and uninted descender. This however would only result in the correct height if both unhinted extentss together only differ by less then an a Pango unit from their hinted counterparts. Otherwise the resulting height would be 1 unit too short. Fix this by using the difference between the hinted extents as height. Fixes: https://gitlab.gnome.org/GNOME/pango/-/issues/626
| * Introduce and use FLOOR and CEIL macros in Pango unitsSebastian Keller2021-11-222-4/+30
| | | | | | | | | | | | | | This replaces the code that was trying to implement those via the ROUND macro. This avoids a potential issue with values that already were on whole units being rounded up to the next whole unit in the code that was implementing CEIL this way.
* | Add a newline to serialization resultsMatthias Clasen2021-11-251-1/+5
| | | | | | | | | | | | | | | | Otherwise editing the output in an editor is likely to make the data not match anymore, since most editors will add a final newline. Update all tests
* | serializer: Include unknown glyphs countMatthias Clasen2021-11-241-0/+3
| |
* | Add pango_font_serializeMatthias Clasen2021-11-242-0/+58
| | | | | | | | | | | | | | Another debug api. This function produces a serialization of a font that is enough to uniquely identify the font. This is more detailed than what pango_font_describe creates.
* | serializer: Support a "comment" fieldMatthias Clasen2021-11-241-0/+47
| | | | | | | | | | | | Json doesn't have comments, so we have to add an explicit comment value. This will be useful to describe what test cases are about.
* | Optionally serialize outputMatthias Clasen2021-11-242-1/+384
| | | | | | | | | | | | | | If requested, serialize lines, runs, and log attrs. This will let us use the serialization format to record not just the test inputs, but outputs as well.
* | Add a way to get the font matrixMatthias Clasen2021-11-243-0/+44
| | | | | | | | | | | | Add some private api for the serializer to get the font matrix. This is needed to let the serializer write a unique fingerprint for the font.
* | More context serialization workMatthias Clasen2021-11-241-3/+61
| |
* | serializer: CosmeticsMatthias Clasen2021-11-241-11/+16
| | | | | | | | Avoid writing out empty attributes or tabs.
* | Allow serializing context informationMatthias Clasen2021-11-242-10/+134
| | | | | | | | | | | | | | | | | | Optionally include context information in the serialization and restore it. This will be useful for transporting for giving tests complete data that affects their output. Some tests included.
* | Add flags to serialize and deserializeMatthias Clasen2021-11-242-14/+52
| | | | | | | | | | | | | | This gives us some room to add more things to these apis, e.g. a way to store not just the input part of a layout, but also the output.
* | Refactor enum serialization error handlingMatthias Clasen2021-11-241-54/+68
| |
* | Rename the serialize errorsMatthias Clasen2021-11-242-31/+49
| | | | | | | | | | They are produced by deserialization, so call them that.
* | CosmeticsMatthias Clasen2021-11-241-3/+3
| |
* | Fix visible space handlingMatthias Clasen2021-11-241-3/+5
| | | | | | | | | | Make space actually show up as visible space when we want that.
* | Fix handling of extra widthline-breaking-fixes4Matthias Clasen2021-11-221-5/+23
| | | | | | | | | | | | | | When handling items that fix completely, we were not consistently taking extra width into account, leading to hyphens sticking out in some cases.
* | break: Fix hyphen conditionMatthias Clasen2021-11-221-2/+7
| | | | | | | | | | | | | | When looking at scripts, we want to look at the script of the *previous* character. And then we need to exclude SHY from the common script.
* | Fix a case of unintended hyphenationMatthias Clasen2021-11-221-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | When we take a complete item because there are no breakpoints, we were inserting a hyphen at the end even though there may not be a breakpoint there, and ending up with a hyphen in the middle of an (overlong) line: Brat-wurst. Test included. This but was discovered with the help of http://gitlab.gnome.org/matthiasc/layout-editor
* | Add more autoptr definitionsMatthias Clasen2021-11-225-0/+14
|/
* Don't replace | with hyphensMatthias Clasen2021-11-191-2/+1
| | | | | | | | | | | I went a bit overboard in #603. The vertical bar is too common, and this usage to specialized to do it by default. To enable this, we should rather make log attrs tweakable. We still replace hyphenation points with hyphens. Fixes: #630
* Tweak word and sentence attributesMatthias Clasen2021-11-191-2/+2
| | | | | | The value does not really matter for these, but it looks more natural if they have a value of 1, and not 0.
* Add layout serialization apiMatthias Clasen2021-11-184-3/+963
| | | | | | | | Add api to serialize PangoLayout, for the benefit of testing and debugging. Currently, this uses json, but that is an implementation detail. Some tests included.
* Neuter g_debug in line-breakingtake-out-gdebugMatthias Clasen2021-11-181-35/+37
| | | | | | This code gets run for gtks size-allocation, and we don't want it to be any slower than it has to be, when not debugging it.
* Add pango_tab_array_to/from_stringserialize-attrs-and-tabsMatthias Clasen2021-11-172-0/+106
|
* Add pango_attr_list_to/from_stringMatthias Clasen2021-11-172-0/+548
| | | | | | Add an api to serialize PangoAttrList. This will be useful in testing and debugging.
* Merge branch 'rewrite-line-breaking' into 'main'Matthias Clasen2021-11-171-215/+312
|\ | | | | | | | | Rewrite process_item See merge request GNOME/pango!509
| * Fix a thinko in zero_line_final_spaceMatthias Clasen2021-11-161-1/+0
| | | | | | | | | | | | | | | | | | | | | | We must not add the width of the space back to remaining_width, since we're just correcting the glyphs to match the accounting that process_item has already done. This was showing up as justification operating on wrong numbers when justifying lines with a final space, leading to uneven margins.
| * Correct the extra_width accountingMatthias Clasen2021-11-161-2/+5
| |
| * Rewrite process_itemMatthias Clasen2021-11-161-214/+309
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is not an entire rewrite, the basic approach to fitting items is still the same. The main difference here is that we shape and measure a possible breakpoint before accepting it as candidate for breaking. This is necessary to ensure that we have accurate width information when making decisions about this breakpoint - the width we are calculating based on log widths is only an approximation (due to things like clusters, hyphens, final spaces, etc). To avoid excessive shaping, we only do this extra work when we are close to the end of the line.
* | build: Bump the harfbuzz reqMatthias Clasen2021-11-161-8/+4
|/ | | | | | | We are using the hb metrics api in more places now, so just require 2.6.0 where it was introduced. That version is almost 2 years old now, so that is hopefully not too much of a burden.
* More tweaks, and commentsMatthias Clasen2021-11-151-15/+22
|
* Go back to an array for disabled breakpointsMatthias Clasen2021-11-151-10/+24
| | | | | It turns out that we do need to look for longer breakpoints after all if we want to find optimal solutions.
* Fix line-break accounting moreMatthias Clasen2021-11-151-5/+11
| | | | | | | | | | | | | | | When looking for breakpoints, we were assuming that there is no point to keep looking forward once we hit a spot where the broken off part is too long. But with hyphen insertion, that is no longer true, necessarily. Consider 'bli '. Breaking after 'bl' will insert 'bl-', which might be longer than 'bli', which is what will be inserted when we break after the i. To fix this, keep looking for breakpoints as long as there is still a chance to find one.
* Improve the BREAK_ALL_FIT caseMatthias Clasen2021-11-151-9/+30
| | | | | We always need to check if we still fit, after shaping. The width we use before is just an estimate.
* layout: Simplify things one more timeMatthias Clasen2021-11-141-16/+9
| | | | | | | | | | | | | The key insight here is that if we find a broken item does not fit, we are only interested in finding an *earlier* breakpoint - the later ones aren't going to produce a shorter run. So we can just keep track of the last char we want to allow breaking at. This fixes the case of finding the minimum width with wrap mode PANGO_WRAP_WORD.
* CosmeticsMatthias Clasen2021-11-141-1/+0
|
* Fix a bug in Small Caps handlingMatthias Clasen2021-11-131-2/+2
| | | | | | | | | We were not passing the correct split_offset to pango_item_split(). Testcase included. Fixes: #627
* Fix a thinkoltr-line-breaking-fixesMatthias Clasen2021-11-121-1/+1
|
* Fix another corner case of space-handlingMatthias Clasen2021-11-121-5/+17
| | | | This keeps spiraling :(
* Fix up one more case of break-after-spaceMatthias Clasen2021-11-121-11/+11
| | | | | | If the break is at the end of the item, we were forgetting to check for the space before the break.
* Handle break-after-space correctlyMatthias Clasen2021-11-121-1/+15
| | | | | | | | | | | | | | When we are breaking after a space, we must not count the width of the space towards the line, since we are zeroing it later. It is a bit annoying that there are multiple places where this has to be taken into account. Another missing bit in this code is that we are only looking at a single whitespace character before the break, when we should really look for a sequence of spaces.
* Correctly reinstate remaining_widthMatthias Clasen2021-11-121-1/+3
| | | | | When unsplitting an item, we were sometimes calculating the remaining_width incorrectly.
* Simplify find_break_extra_widthMatthias Clasen2021-11-121-25/+1
| | | | We can use the log_widths that we already have.