| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
| |
We can't break in a tab run.
This fixes an assertion found by afl.
Testcase included.
Fixes: #638
|
|
|
|
|
|
|
|
|
|
| |
We an only use the line_width - remaining_width
shortcut if we are actually maintaining remaining_width,
i.e. not if we don't wrap lines.
Testcase included.
Fixes: #635
|
|
|
|
|
|
|
|
|
|
| |
When we uninsert the current tab run, we need to reset
our tab state to prevent last_tab->glyphs to become a
dangling pointer.
Test included.
Fixes: #634
|
| |
|
|
|
|
|
| |
Don't calculate line width the hard way when
we can do it much easier.
|
|
|
|
|
|
| |
We don't need to iterate the entire tab array
every time, we just continue from the previous
tab stop position.
|
|
|
|
|
| |
We want to optimize access to tab stops,
and will assume they are ordered.
|
|
|
|
| |
Introduce a LastTab struct, and use it.
|
|
|
|
|
|
|
| |
This is useful for PANGO_TAB_DECIMAL.
Implement this in PangoLayout, in the
serializer, and update tests.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Implement the other tab alignments by adjusting
the tab width as we go.
Based on an old patch by Itai Bar-Haim.
This also includes a fix for the previously
supported left tab alignment in the presence
of indent.
Fixes: #34
|
|
|
|
|
| |
Explain that tabs really only work with
PANGO_ALIGN_LEFT.
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
| |
We can only use the width of the previous char
if we are not at the first char. Found by asan.
|
|
|
|
|
| |
The alternative is random test failures, now
that we check all these fields in test-layout.
|
|
|
|
|
|
|
| |
When handling items that fix completely,
we were not consistently taking extra width
into account, leading to hyphens sticking
out in some cases.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
| |
It turns out that we do need to look for longer breakpoints
after all if we want to find optimal solutions.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
We always need to check if we still fit, after shaping.
The width we use before is just an estimate.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
|
|
|
| |
This keeps spiraling :(
|
|
|
|
|
|
| |
If the break is at the end of the item, we
were forgetting to check for the space before
the break.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
When unsplitting an item, we were sometimes
calculating the remaining_width incorrectly.
|
|
|
|
| |
We can use the log_widths that we already have.
|
|
|
|
|
|
| |
We only want this inside process_item, so we can
make this a purely local thing, without modifying
log_attrs.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
Our accounting for run lengths is imperfect (mainly
due to log widths for clusters being evenly distributed),
so it can happen that after reshaping the split item,
we find that it does not actually fit in the remaining
width. Previously, we would just use the split run
at that point and produce an overlong line. Instead,
undo the split, disable the breakpoint we used, and
try again.
|
| |
|
|
|
|
|
| |
In some cases, we were forgetting to account
for the width of a hyphen.
|
|
|
|
|
|
|
|
|
|
|
| |
Split the post-processing off into a separate function
that can take log attrs in addition. This will allow
us to handle word starts when dealing with text transforms
for emulated Small Caps.
So far, this is all private API that is used from PangoLayout.
Please file an issue if you want to access Small Caps emulation
without PangoLayout.
|
|
|
|
|
| |
Add some missing details about new enumerations
and run baselines.
|
| |
|
|
|
|
|
|
|
| |
For empty runs, we were sometimes using line height,
which may be scaled up by the line-height attribute.
Fix that.
|
|
|
|
|
|
| |
Fix the calculation of line height for empty lines
to take the line-height attributes into account like
we do for non-empty lines.
|
|
|
|
|
| |
These were showing up as warnings about garbage
values in the gtk static-scan build.
|
|
|
|
|
|
|
|
|
|
|
|
| |
We don't really have firm control over the way
attributes are ordered in the list, so the
assumtion that we see proper nesting for baseline
shifts was a bit optimistic.
Just look through all open stack items for a match,
and remove that.
Test included.
|
|
|
|
|
|
|
|
|
|
|
| |
Apply horizontal displacements for superscripts and subscripts
that are provided in font metrics. This noticably improves the
placement of superscripts in italics.
Currently, we only apply these displacements in post-processing,
and ignore the width changes during line-breaking. This could
be improved by moving the baseline handling into the line-breaking
proper.
|
|
|
|
|
|
|
| |
Add a new font-scale attribute to indicate font size
changes due to super- and subscript shifts, and handle
it during item post-processing to find the right font
sizes.
|
|
|
|
|
|
|
|
|
|
|
| |
Add a new baseline-shift attribute, which is similar to
rise, but accumulates. In addition, it supports font-
relative values such as superscript and subscript.
We implement support for this by computing baseline
shifts for run during line post-processing, and storing
them in the runs. The renderer now takes these shifts
into account when rendering layout lines.
|
| |
|
|
|
|
| |
This is useful information.
|
|
|
|
| |
This has been broken all along. :(
|