-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace a special
Color32::PLACEHOLDER
with widget fallback color (#…
…3727) This introduces a special `Color32::PLACEHOLDER` which, during text painting, will be replaced with `TextShape::fallback_color`. The fallback color is mandatory to set in all text painting. Usually this comes from the current visual style. This lets users color only parts of a `WidgetText` (using e.g. a `LayoutJob` or a `Galley`), where the uncolored parts (using `Color32::PLACEHOLDER`) will be replaced by a default widget color (e.g. blue for a hyperlink). For instance, you can color the `⚠️ `-emoji red in a piece of text red and leave the rest of the text uncolored. The color of the rest of the text will then depend on wether or not you put that text in a label, a button, or a hyperlink. Overall this simplifies a lot of complexity in the code but comes with a few breaking changes: * `TextShape::new`, `Shape::galley`, and `Painter::galley` now take a fallback color by argument * `Shape::galley_with_color` has been deprecated (use `Shape::galley` instead) * `Painter::galley_with_color` has been deprecated (use `Painter::galley` instead) * `WidgetTextGalley` is gone (use `Arc<Galley>` instead) * `WidgetTextJob` is gone (use `LayoutJob` instead) * `RichText::into_text_job` has been replaced with `RichText::into_layout_job` * `WidgetText::into_text_job` has been replaced with `WidgetText::into_layout_job`
- Loading branch information
Showing
23 changed files
with
267 additions
and
306 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.