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

New text integration #1182

Merged
merged 1 commit into from
Sep 9, 2020
Merged

New text integration #1182

merged 1 commit into from
Sep 9, 2020

Conversation

cmyr
Copy link
Member

@cmyr cmyr commented Sep 4, 2020

This is a first pass at bringing the new piet stuff into druid.

Mostly this involves a new TextLayout type in druid, that is intended to be used as a component of other widgets that display text. This is intended to handle the bookkeeping around invalidating and recomputing layouts, resolving attributes from the environment, and retaining other layout attributes.

This first patch is intended mostly to get us to parity with the existing code; it doesn't expose things like wrap width or alignment, yet.

retaining the text

I chose not to have this object own a copy of the text, because that is already retained in the piet layout, and also already exists in whatever form it was passed to the widget in. This is annoying! It would be much nicer if you could pass in the initial text at construction time.

This may change if we settle on some data type(s) for strings that are clone friendly, which I think we should do but which is out of scope for now.

This now retains the text, which is shared between this object and piet as an Arc<str>.

Base automatically changed from font-descriptor to master September 6, 2020 15:44
@cmyr cmyr mentioned this pull request Sep 6, 2020
Copy link
Contributor

@raphlinus raphlinus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good. Most of what I found was comment issues. Looking forward to see it all land!

druid/src/text/layout.rs Outdated Show resolved Hide resolved
druid/src/text/layout.rs Show resolved Hide resolved
druid/src/text/layout.rs Outdated Show resolved Hide resolved
druid/src/text/layout.rs Show resolved Hide resolved
druid/src/text/layout.rs Show resolved Hide resolved
druid/src/widget/checkbox.rs Show resolved Hide resolved
druid/src/widget/radio.rs Show resolved Hide resolved
@cmyr cmyr force-pushed the new-text-integration branch 3 times, most recently from 15b92e1 to ec8cf37 Compare September 8, 2020 19:35
@cmyr cmyr marked this pull request as ready for review September 8, 2020 22:22
This introduces a new type, TextLayout, that is intended to be
a component used by widgets that wish to display text, and which
exposes the functionality of the Piet text API.

This commit is a checkpoint; it adds only a small amount of new
functionality, and largely tries to keep things working as they
do currently.
@cmyr cmyr merged commit 861bfbf into master Sep 9, 2020
@cmyr cmyr deleted the new-text-integration branch September 9, 2020 13:31
@cmyr cmyr mentioned this pull request Sep 9, 2020
7 tasks
cmyr added a commit that referenced this pull request Sep 10, 2020
This was broken slightly by #1182. This patch also cleans up a few
changes from that patch in the styled_text example that I had
not intended to commit.

As reported by @totsteps
cmyr added a commit that referenced this pull request Sep 11, 2020
This was broken slightly by #1182. This patch also cleans up a few
changes from that patch in the styled_text example that I had
not intended to commit.

As reported by @totsteps
@cmyr cmyr mentioned this pull request Oct 9, 2020
12 tasks
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.

2 participants