Skip to content

Commit

Permalink
Fix font-family parsing.
Browse files Browse the repository at this point in the history
Closes #702
  • Loading branch information
RazrFalcon committed Jan 27, 2024
1 parent c6fd7f4 commit b241d35
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
This changelog also contains important changes in dependencies.

## [Unreleased]
### Fixed
- `font-family` parsing.

## [0.38.0] - 2024-01-21
### Added
Expand Down
4 changes: 2 additions & 2 deletions crates/usvg-parser/src/text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,8 @@ fn convert_font(node: SvgNode, state: &converter::State) -> Font {
for mut family in font_family.split(',') {
// TODO: to a proper parser

family = family.trim();

if family.starts_with(['\'', '"']) {
family = &family[1..];
}
Expand All @@ -399,8 +401,6 @@ fn convert_font(node: SvgNode, state: &converter::State) -> Font {
family = &family[..family.len() - 1];
}

family = family.trim();

if !family.is_empty() {
families.push(family.to_string());
}
Expand Down

0 comments on commit b241d35

Please sign in to comment.