Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pango take two #425

Merged
merged 2 commits into from
Mar 26, 2021
Merged

Pango take two #425

merged 2 commits into from
Mar 26, 2021

Conversation

cmyr
Copy link
Member

@cmyr cmyr commented Mar 25, 2021

I want to open a new branch for this so that I can force push and not screw up the previous history.

This is still a draft, but I think it's getting close.

@cmyr cmyr force-pushed the pango-take-two branch 4 times, most recently from eedfc58 to 412627a Compare March 25, 2021 20:03
@cmyr cmyr marked this pull request as ready for review March 26, 2021 00:08
Hook up some word wrap

Start building LineMetric from Pango provided data

Get hit testing hooked up with Pango

Generate decent line metrics from Pango data

Add note to `load_font` for Pango

Plumb in all remaining range attributes to Pango

Use UnicodeSegmentation to determine trailing index instead of Pango

Plumb in text alignment to Pango

Fix Pango font size being much to large

Fix Pango wrapping for `trailing_whitespace_width` text

Remove dead code from old Cairo toy text based implementation

Cleanup some comments in Pango wrapping code

Include newline char(s) in line metrics built from Pango

Add comment on `unsafe` block getting Pango line layout offsets

Do PangoAttribute building on AttributeWithRange & simplify font failure

Update comment on Pango alignment wrt left-to-right text

Don't munch blank lines when including newlines in line metric

Count UTF-8 bytes instead of codepoints (including newline chars

Use `PangoLayoutIter` to get baseline information

Fix `eol_hit_testing` under Pango & improve baseline calculation

Use whitespaceless logical width for overall layout width

Use layout ink size for `image_bounds`

Prevent preferring downstream affinity with no following metrics

Ignore trailing ws when finding metric for checking newline affinity

Make `empty_layout_size` test slightly more tolerant

Fix `test_hit_test_point_basic_0`

Fix `test_multiline_hit_test_point_basic`

Fix `test_hit_test_point_complex_0`

Take logical rect offset into account for paint & idx hit tests

Don't use GraphemeCursor to handling trailing hit test

This was originally an attempt to fix a bug but just seems nicer

Take logical rect offset into account for point hit test

Cleanup `CairoTextLayout` and make it cheaper to clone

Improve some comments

Add `UNBOUNDED_WRAP_WIDTH` constant

Add FIXME to `empty_layout_size` test

Make text color conversion slightly less weird

Use our own copy of layout text instead of asking Pango for it

Slightly improve comments/logic when moving to new line at soft break

Improve point hit test metric lookup logic

Update piet-snapshots submodule

Disable Pango hyphenation

Use `WrapMode::WordChar`
Panic when hit_test_position passed non char boundary

This matches the behaviour on the other platforms.

Remove a bunch of old cairo text tests

These were always fragile, and are now replaced by the shared tests
in piet-common.

Fixup hit-testing

- Keep track of the line x_offsets, to correctly resolve positions
  within lines
- For hit_test_position, don't use text.len()

Fixup hit_test_position again

Fixup trailing whitespace and ink rect calculations

Update snapshots

Increase fudge factor in tests to accomodate pango

Last bit of pre-merge cleanup
@cmyr cmyr merged commit 0b5696c into master Mar 26, 2021
@cmyr cmyr deleted the pango-take-two branch March 26, 2021 13:53
@runiq
Copy link

runiq commented Mar 26, 2021

Is this the replacement for #389?

@cmyr
Copy link
Member Author

cmyr commented Mar 26, 2021

@runiq yep!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants