Skip to content

Commit

Permalink
Added font support for SVG text (#1850)
Browse files Browse the repository at this point in the history
* Added font support for SVG text

* Updated changelog

* Added PR link to changelog

Co-authored-by: Colin Rofls <[email protected]>
  • Loading branch information
DrGabble and cmyr authored Jul 14, 2021
1 parent e473150 commit bb04818
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
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])
- 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

0 comments on commit bb04818

Please sign in to comment.