summaryrefslogtreecommitdiffstats
path: root/src/util/units.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/units.cpp')
-rw-r--r--src/util/units.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/util/units.cpp b/src/util/units.cpp
index 7bc910fcc..e7be3f5e6 100644
--- a/src/util/units.cpp
+++ b/src/util/units.cpp
@@ -220,6 +220,36 @@ Unit UnitTable::getUnit(Glib::ustring const &unit_abbr) const
return Unit();
}
}
+Unit UnitTable::getUnit(SVGLength::Unit const u) const
+{
+ Glib::ustring u_str;
+ switch(u) {
+ case 1:
+ u_str = "px"; break;
+ case 2:
+ u_str = "pt"; break;
+ case 3:
+ u_str = "pc"; break;
+ case 4:
+ u_str = "mm"; break;
+ case 5:
+ u_str = "cm"; break;
+ case 6:
+ u_str = "in"; break;
+ case 7:
+ u_str = "ft"; break;
+ case 8:
+ u_str = "em"; break;
+ case 9:
+ u_str = "ex"; break;
+ case 10:
+ u_str = "%"; break;
+ default:
+ u_str = "";
+ }
+
+ return getUnit(u_str);
+}
Quantity UnitTable::getQuantity(Glib::ustring const& q) const
{