summaryrefslogtreecommitdiffstats
path: root/src/style-internal.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/style-internal.cpp')
-rw-r--r--src/style-internal.cpp61
1 files changed, 61 insertions, 0 deletions
diff --git a/src/style-internal.cpp b/src/style-internal.cpp
index 54d1a0867..34e737452 100644
--- a/src/style-internal.cpp
+++ b/src/style-internal.cpp
@@ -521,6 +521,67 @@ SPILengthOrNormal::operator==(const SPIBase& rhs) {
}
+// SPIVariableFontAxisOrNormal ----------------------------------------------------
+
+void
+SPIVariableFontAxisOrNormal::read( gchar const *str ) {
+
+ if( !str ) return;
+
+ if ( !strcmp(str, "normal") ) {
+ set = true;
+ inherit = false;
+ unit = SP_CSS_UNIT_NONE;
+ value = computed = 0.0;
+ normal = true;
+ return;
+ }
+
+ if (strlen(str) >= 6 && str[4]==' ') {
+ strncpy(axis_name, str, 4);
+ axis_name[4] = '\0';
+
+ SPILength::read( str + 5);
+ normal = false;
+ }
+};
+
+const Glib::ustring
+SPIVariableFontAxisOrNormal::write( guint const flags, SPStyleSrc const &style_src_req, SPIBase const *const base) const {
+
+ SPILength const *const my_base = dynamic_cast<const SPILength*>(base);
+ bool dfp = (!inherits || !my_base || (my_base != this)); // Different from parent
+ bool src = (style_src_req == style_src || !(flags & SP_STYLE_FLAG_IFSRC));
+ if (should_write(flags, set, dfp, src)) {
+ if (this->normal) {
+ return (name + ":normal;");
+ } else {
+ return "\"" + Glib::ustring(axis_name) + "\" " + SPILength::write(flags, style_src_req, base);
+ }
+ }
+ return Glib::ustring("");
+}
+
+void
+SPIVariableFontAxisOrNormal::cascade( const SPIBase* const parent ) {
+ std::cerr << "SPIVariableFontAxisOrNormal::cascade(): TODO: Implement-me!" << std::endl;
+}
+
+void
+SPIVariableFontAxisOrNormal::merge( const SPIBase* const parent ) {
+ std::cerr << "SPIVariableFontAxisOrNormal::merge(): TODO: Implement-me!" << std::endl;
+}
+
+bool
+SPIVariableFontAxisOrNormal::operator==(const SPIBase& rhs) {
+ if( const SPIVariableFontAxisOrNormal* r = dynamic_cast<const SPIVariableFontAxisOrNormal*>(&rhs) ) {
+ if( normal && r->normal ) { return true; }
+ if( normal != r->normal ) { return false; }
+ return SPILength::operator==(rhs) && !strncmp(axis_name, r->axis_name, 4);
+ } else {
+ return false;
+ }
+}
// SPIEnum --------------------------------------------------------------