diff options
| author | Felipe CorrĂȘa da Silva Sanches <juca@members.fsf.org> | 2017-06-13 00:08:50 +0000 |
|---|---|---|
| committer | Felipe CorrĂȘa da Silva Sanches <juca@members.fsf.org> | 2017-06-22 00:04:53 +0000 |
| commit | 0edfdf950796befdb42ab9b2ef76c76483d9dbb1 (patch) | |
| tree | 5ef162470f99f836f88858140ca575c710fe6eaf /src/style-internal.cpp | |
| parent | Do not strip file extension in CUSTOM_TYPE Windows native file save dialogs (diff) | |
| download | inkscape-0edfdf950796befdb42ab9b2ef76c76483d9dbb1.tar.gz inkscape-0edfdf950796befdb42ab9b2ef76c76483d9dbb1.zip | |
parsing font-variation-settings (CSS Fonts Module Level 4)
Diffstat (limited to 'src/style-internal.cpp')
| -rw-r--r-- | src/style-internal.cpp | 61 |
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 -------------------------------------------------------------- |
