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

Added font support for SVG text #1850

Merged
merged 4 commits into from
Jul 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ You can find its changes [documented below](#070---2021-01-01).

### Added

- System fonts loaded so that SVG images render text ([#1850] by [@DrGabble])
Copy link
Member

Choose a reason for hiding this comment

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

you'll also need to add the link to the PR below. :)

Copy link
Member

Choose a reason for hiding this comment

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

@DrGabble this is ready to merge except for this missing link!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@cmyr done!

- Add `scroll()` method in WidgetExt ([#1600] by [@totsteps])
- `write!` for `RichTextBuilder` ([#1596] by [@Maan2003])
- Sub windows: Allow opening windows that share state with arbitrary parts of the widget hierarchy ([#1254] by [@rjwittams])
Expand Down Expand Up @@ -497,6 +498,7 @@ Last release without a changelog :(
[@r-ml]: https://github.com/r-ml
[@djeedai]: https://github.com/djeedai
[@bjorn]: https://github.com/bjorn
[@DrGabble]: https://github.com/DrGabble
[@lisael]: https://github.com/lisael

[#599]: https://github.com/linebender/druid/pull/599
Expand Down Expand Up @@ -748,6 +750,7 @@ Last release without a changelog :(
[#1820]: https://github.com/linebender/druid/pull/1820
[#1825]: https://github.com/linebender/druid/pull/1825
[#1843]: https://github.com/linebender/druid/pull/1843
[#1850]: https://github.com/linebender/druid/pull/1850
[#1851]: https://github.com/linebender/druid/pull/1851
[#1860]: https://github.com/linebender/druid/pull/1860
[#1861]: https://github.com/linebender/druid/pull/1861
Expand Down
4 changes: 3 additions & 1 deletion druid/src/widget/svg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,11 +201,13 @@ impl FromStr for SvgData {
type Err = Box<dyn Error>;

fn from_str(svg_str: &str) -> Result<Self, Self::Err> {
let re_opt = usvg::Options {
let mut re_opt = usvg::Options {
keep_named_groups: false,
..usvg::Options::default()
};

re_opt.fontdb.load_system_fonts();

match usvg::Tree::from_str(svg_str, &re_opt) {
Ok(tree) => Ok(SvgData {
tree: Arc::new(tree),
Expand Down