From a0ed5b5138836e368e409b9ced656f970b225b38 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Sun, 3 May 2015 18:58:35 +0200 Subject: First batch (bzr r14095) --- src/style.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/style.cpp') diff --git a/src/style.cpp b/src/style.cpp index b65bff53f..943a12f3b 100644 --- a/src/style.cpp +++ b/src/style.cpp @@ -118,6 +118,14 @@ SPStyle::SPStyle(SPDocument *document_in, SPObject *object_in) : font(), // SPIFont font_specification( "-inkscape-font-specification" ), // SPIString + // Font variants + font_variant_ligatures( "font-variant-ligatures", enum_font_variant_ligatures, SP_CSS_FONT_VARIANT_LIGATURES_NORMAL ), + font_variant_position( "font-variant-position", enum_font_variant_position, SP_CSS_FONT_VARIANT_POSITION_NORMAL ), + font_variant_caps( "font-variant-caps", enum_font_variant_caps, SP_CSS_FONT_VARIANT_CAPS_NORMAL ), + font_variant_numeric( "font-variant-numeric", enum_font_variant_numeric, SP_CSS_FONT_VARIANT_NUMERIC_NORMAL ), + font_variant_alternates("font-variant-alternates", enum_font_variant_alternates, SP_CSS_FONT_VARIANT_ALTERNATES_NORMAL ), + font_variant_east_asian("font-variant-east_asian", enum_font_variant_east_asian, SP_CSS_FONT_VARIANT_EAST_ASIAN_NORMAL ), + // Text related properties text_indent( "text-indent", 0.0 ), // SPILength text_align( "text-align", enum_text_align, SP_CSS_TEXT_ALIGN_START ), -- cgit v1.2.3 From c7ce360901e191572b207df27dd3e972bff3929f Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Sun, 3 May 2015 19:01:45 +0200 Subject: Revert bad commit (commited to wrong branch). (bzr r14096) --- src/style.cpp | 8 -------- 1 file changed, 8 deletions(-) (limited to 'src/style.cpp') diff --git a/src/style.cpp b/src/style.cpp index 943a12f3b..b65bff53f 100644 --- a/src/style.cpp +++ b/src/style.cpp @@ -118,14 +118,6 @@ SPStyle::SPStyle(SPDocument *document_in, SPObject *object_in) : font(), // SPIFont font_specification( "-inkscape-font-specification" ), // SPIString - // Font variants - font_variant_ligatures( "font-variant-ligatures", enum_font_variant_ligatures, SP_CSS_FONT_VARIANT_LIGATURES_NORMAL ), - font_variant_position( "font-variant-position", enum_font_variant_position, SP_CSS_FONT_VARIANT_POSITION_NORMAL ), - font_variant_caps( "font-variant-caps", enum_font_variant_caps, SP_CSS_FONT_VARIANT_CAPS_NORMAL ), - font_variant_numeric( "font-variant-numeric", enum_font_variant_numeric, SP_CSS_FONT_VARIANT_NUMERIC_NORMAL ), - font_variant_alternates("font-variant-alternates", enum_font_variant_alternates, SP_CSS_FONT_VARIANT_ALTERNATES_NORMAL ), - font_variant_east_asian("font-variant-east_asian", enum_font_variant_east_asian, SP_CSS_FONT_VARIANT_EAST_ASIAN_NORMAL ), - // Text related properties text_indent( "text-indent", 0.0 ), // SPILength text_align( "text-align", enum_text_align, SP_CSS_TEXT_ALIGN_START ), -- cgit v1.2.3 From 7e3aabae24c09340fd06cb69b0678158abb4a375 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Mon, 4 May 2015 12:57:06 +0200 Subject: Shorthands are not allowed as presentation attributes. (bzr r14107) --- src/style.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/style.cpp') diff --git a/src/style.cpp b/src/style.cpp index b65bff53f..8b41bbbd7 100644 --- a/src/style.cpp +++ b/src/style.cpp @@ -573,7 +573,15 @@ SPStyle::read( SPObject *object, Inkscape::XML::Node *repr ) { /* 3 Presentation attributes */ // std::cout << " MERGING PRESENTATION ATTRIBUTES" << std::endl; for(std::vector::size_type i = 0; i != _properties.size(); ++i) { - _properties[i]->readAttribute( repr ); + + // Shorthands are not allowed as presentation properites. + // Note: text-decoration is converted to a shorthand in CSS 3 but can still be + // read as a non-shorthand so it should not be in this list. + // We could add a flag to SPIBase to avoid string comparison. + if( _properties[i]->name.compare( "font" ) != 0 && + _properties[i]->name.compare( "marker" ) != 0 ) { + _properties[i]->readAttribute( repr ); + } } // for(SPPropMap::iterator i = _propmap.begin(); i != _propmap.end(); ++i ) { // (this->*(i->second)).readAttribute( repr ); -- cgit v1.2.3 From 5af8924e1de466080dc116b47edd7c8d8591652b Mon Sep 17 00:00:00 2001 From: Raphael Rosch Date: Tue, 5 May 2015 13:26:20 -0400 Subject: show filter usage count Fixed bugs: - https://launchpad.net/bugs/1169123 (bzr r14111) --- src/style.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/style.cpp') diff --git a/src/style.cpp b/src/style.cpp index 8b41bbbd7..fa8aed68e 100644 --- a/src/style.cpp +++ b/src/style.cpp @@ -1177,10 +1177,12 @@ void sp_style_filter_ref_changed(SPObject *old_ref, SPObject *ref, SPStyle *style) { if (old_ref) { + (dynamic_cast( old_ref ))->_refcount--; style->filter_modified_connection.disconnect(); } if ( SP_IS_FILTER(ref)) { + (dynamic_cast( ref ))->_refcount++; style->filter_modified_connection = ref->connectModified(sigc::bind(sigc::ptr_fun(&sp_style_filter_ref_modified), style)); } -- cgit v1.2.3 From d71254cf07e2258ab3f8b80fc09b565e4a90f422 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Wed, 6 May 2015 15:44:14 +0200 Subject: Start of implementing CSS 3 font variants (access to OpenType features). (bzr r14115) --- src/style.cpp | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 53 insertions(+), 4 deletions(-) (limited to 'src/style.cpp') diff --git a/src/style.cpp b/src/style.cpp index fa8aed68e..49a13604b 100644 --- a/src/style.cpp +++ b/src/style.cpp @@ -14,7 +14,7 @@ * Copyright (C) 2001 Ximian, Inc. * Copyright (C) 2005 Monash University * Copyright (C) 2012 Kris De Gussem - * Copyright (C) 2014 Tavmjong Bah + * Copyright (C) 2014-2015 Tavmjong Bah * * Released under GNU GPL, read the file 'COPYING' for more information */ @@ -118,6 +118,15 @@ SPStyle::SPStyle(SPDocument *document_in, SPObject *object_in) : font(), // SPIFont font_specification( "-inkscape-font-specification" ), // SPIString + // Font variants + font_variant_ligatures( "font-variant-ligatures", enum_font_variant_ligatures, SP_CSS_FONT_VARIANT_LIGATURES_NORMAL ), + font_variant_position( "font-variant-position", enum_font_variant_position, SP_CSS_FONT_VARIANT_POSITION_NORMAL ), + font_variant_caps( "font-variant-caps", enum_font_variant_caps, SP_CSS_FONT_VARIANT_CAPS_NORMAL ), + font_variant_numeric( "font-variant-numeric", enum_font_variant_numeric, SP_CSS_FONT_VARIANT_NUMERIC_NORMAL ), + font_variant_alternates("font-variant-alternates", enum_font_variant_alternates, SP_CSS_FONT_VARIANT_ALTERNATES_NORMAL ), + font_variant_east_asian("font-variant-east_asian", enum_font_variant_east_asian, SP_CSS_FONT_VARIANT_EAST_ASIAN_NORMAL ), + font_feature_settings( "font-feature-settings", "normal" ), + // Text related properties text_indent( "text-indent", 0.0 ), // SPILength text_align( "text-align", enum_text_align, SP_CSS_TEXT_ALIGN_START ), @@ -288,6 +297,15 @@ SPStyle::SPStyle(SPDocument *document_in, SPObject *object_in) : _properties.push_back( &font ); _properties.push_back( &font_specification ); + // Font variants + _properties.push_back( &font_variant_ligatures ); + _properties.push_back( &font_variant_position ); + _properties.push_back( &font_variant_caps ); + _properties.push_back( &font_variant_numeric ); + _properties.push_back( &font_variant_alternates ); + _properties.push_back( &font_variant_east_asian ); + _properties.push_back( &font_feature_settings ); + _properties.push_back( &text_indent ); _properties.push_back( &text_align ); @@ -374,6 +392,14 @@ SPStyle::SPStyle(SPDocument *document_in, SPObject *object_in) : // _propmap.insert( std::make_pair( font.name, reinterpret_cast(&SPStyle::font ) ) ); // _propmap.insert( std::make_pair( font_specification.name, reinterpret_cast(&SPStyle::font_specification ) ) ); + // font_variant_ligatures ); + // font_variant_position ); + // font_variant_caps ); + // font_variant_numeric ); + // font_variant_alternates ); + // font_variant_east_asian ); + // font_feature_settings ); + // _propmap.insert( std::make_pair( text_indent.name, reinterpret_cast(&SPStyle::text_indent ) ) ); // _propmap.insert( std::make_pair( text_align.name, reinterpret_cast(&SPStyle::text_align ) ) ); @@ -574,9 +600,9 @@ SPStyle::read( SPObject *object, Inkscape::XML::Node *repr ) { // std::cout << " MERGING PRESENTATION ATTRIBUTES" << std::endl; for(std::vector::size_type i = 0; i != _properties.size(); ++i) { - // Shorthands are not allowed as presentation properites. - // Note: text-decoration is converted to a shorthand in CSS 3 but can still be - // read as a non-shorthand so it should not be in this list. + // Shorthands are not allowed as presentation properites. Note: text-decoration and + // font-variant are converted to shorthands in CSS 3 but can still be read as a + // non-shorthand for compatability with older renders, so they should not be in this list. // We could add a flag to SPIBase to avoid string comparison. if( _properties[i]->name.compare( "font" ) != 0 && _properties[i]->name.compare( "marker" ) != 0 ) { @@ -694,6 +720,29 @@ SPStyle::readIfUnset( gint id, gchar const *val ) { font.readIfUnset( val ); break; + /* Font Variants CSS 3 */ + case SP_PROP_FONT_VARIANT_LIGATURES: + font_variant_ligatures.readIfUnset( val ); + break; + case SP_PROP_FONT_VARIANT_POSITION: + font_variant_position.readIfUnset( val ); + break; + case SP_PROP_FONT_VARIANT_CAPS: + font_variant_caps.readIfUnset( val ); + break; + case SP_PROP_FONT_VARIANT_NUMERIC: + font_variant_numeric.readIfUnset( val ); + break; + case SP_PROP_FONT_VARIANT_ALTERNATES: + font_variant_alternates.readIfUnset( val ); + break; + case SP_PROP_FONT_VARIANT_EAST_ASIAN: + font_variant_east_asian.readIfUnset( val ); + break; + case SP_PROP_FONT_FEATURE_SETTINGS: + font_feature_settings.readIfUnset( val ); + break; + /* Text */ case SP_PROP_TEXT_INDENT: text_indent.readIfUnset( val ); -- cgit v1.2.3