[librsvg/librsvg-2.44] (#337) - Don't panic with "ex" or "em" units in the font-size property
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg/librsvg-2.44] (#337) - Don't panic with "ex" or "em" units in the font-size property
- Date: Wed, 19 Sep 2018 18:23:43 +0000 (UTC)
commit e1dfcd19b5fc9bbe40977a4942f51458844343df
Author: Federico Mena Quintero <federico gnome org>
Date: Tue Sep 18 17:17:36 2018 -0500
(#337) - Don't panic with "ex" or "em" units in the font-size property
https://gitlab.gnome.org/GNOME/librsvg/issues/337
rsvg_internals/src/length.rs | 7 ++++++-
tests/fixtures/render-crash/337-font-ex.svg | 9 +++++++++
2 files changed, 15 insertions(+), 1 deletion(-)
---
diff --git a/rsvg_internals/src/length.rs b/rsvg_internals/src/length.rs
index 7fe2bcf4..306f9d8b 100644
--- a/rsvg_internals/src/length.rs
+++ b/rsvg_internals/src/length.rs
@@ -243,9 +243,14 @@ fn font_size_from_values(values: &ComputedValues, draw_ctx: &DrawingCtx) -> f64
LengthUnit::Inch => font_size_from_inch(v.length, v.dir, draw_ctx),
- LengthUnit::Percent | LengthUnit::FontEm | LengthUnit::FontEx => {
+ LengthUnit::Percent => {
unreachable!("ComputedValues can't have a relative font size")
}
+
+ LengthUnit::FontEm | LengthUnit::FontEx => {
+ // This is the same default as used in rsvg_node_svg_get_size()
+ v.hand_normalize(0.0, 0.0, 12.0)
+ }
}
}
diff --git a/tests/fixtures/render-crash/337-font-ex.svg b/tests/fixtures/render-crash/337-font-ex.svg
new file mode 100644
index 00000000..9b517e89
--- /dev/null
+++ b/tests/fixtures/render-crash/337-font-ex.svg
@@ -0,0 +1,9 @@
+<svg>
+ <style>
+ text {
+ font-size: 0ex;
+ }
+ </style>
+
+ <text>0</text>
+</svg>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]