diff options
| author | Tavmjong Bah <tavmjong@free.fr> | 2015-11-18 09:06:09 +0000 |
|---|---|---|
| committer | tavmjong-free <tavmjong@free.fr> | 2015-11-18 09:06:09 +0000 |
| commit | 97fd7f4c6b6532fd70149726c61c98605dda4067 (patch) | |
| tree | 23a178189c8eaa22557f415fb3e654f0f8c317ca /src | |
| parent | Replace leading by more useful x-height. Use OS/2 font metrics when available. (diff) | |
| download | inkscape-97fd7f4c6b6532fd70149726c61c98605dda4067.tar.gz inkscape-97fd7f4c6b6532fd70149726c61c98605dda4067.zip | |
Read/write 'dominant-baseline' property.
(bzr r14430.1.6)
Diffstat (limited to 'src')
| -rw-r--r-- | src/style-enums.h | 33 | ||||
| -rw-r--r-- | src/style.cpp | 9 | ||||
| -rw-r--r-- | src/style.h | 2 |
3 files changed, 38 insertions, 6 deletions
diff --git a/src/style-enums.h b/src/style-enums.h index c9a558e0f..06207852c 100644 --- a/src/style-enums.h +++ b/src/style-enums.h @@ -191,10 +191,24 @@ enum SPWhiteSpace { SP_CSS_WHITE_SPACE_PRELINE }; +// Not complete list +enum SPCSSBaseline { + SP_CSS_BASELINE_AUTO, + SP_CSS_BASELINE_ALPHABETIC, + SP_CSS_BASELINE_IDEOGRAPHIC, + SP_CSS_BASELINE_HANGING, + SP_CSS_BASELINE_MATHEMATICAL, + SP_CSS_BASELINE_CENTRAL, + SP_CSS_BASELINE_MIDDLE, + SP_CSS_BASELINE_TEXT_BEFORE_EDGE, + SP_CSS_BASELINE_TEXT_AFTER_EDGE, + SP_CSS_BASELINE_SIZE // Size of enum, keep last. +}; + enum SPCSSBaselineShift { - SP_CSS_BASELINE_SHIFT_BASELINE, - SP_CSS_BASELINE_SHIFT_SUB, - SP_CSS_BASELINE_SHIFT_SUPER + SP_CSS_BASELINE_SHIFT_BASELINE, + SP_CSS_BASELINE_SHIFT_SUB, + SP_CSS_BASELINE_SHIFT_SUPER }; enum SPVisibility { @@ -520,6 +534,19 @@ static SPStyleEnum const enum_text_orientation[] = { {NULL, -1} }; +static SPStyleEnum const enum_baseline[] = { + {"auto", SP_CSS_BASELINE_AUTO}, // Default + {"alphabetic", SP_CSS_BASELINE_ALPHABETIC}, + {"ideographic", SP_CSS_BASELINE_IDEOGRAPHIC}, + {"hanging", SP_CSS_BASELINE_HANGING}, + {"mathematical", SP_CSS_BASELINE_MATHEMATICAL}, + {"central", SP_CSS_BASELINE_CENTRAL}, + {"middle", SP_CSS_BASELINE_MIDDLE}, + {"text-before-edge", SP_CSS_BASELINE_TEXT_BEFORE_EDGE}, + {"text-after-edge", SP_CSS_BASELINE_TEXT_AFTER_EDGE}, + {NULL, -1} +}; + static SPStyleEnum const enum_baseline_shift[] = { {"baseline", SP_CSS_BASELINE_SHIFT_BASELINE}, {"sub", SP_CSS_BASELINE_SHIFT_SUB}, diff --git a/src/style.cpp b/src/style.cpp index 369127792..0bad376a4 100644 --- a/src/style.cpp +++ b/src/style.cpp @@ -138,6 +138,7 @@ SPStyle::SPStyle(SPDocument *document_in, SPObject *object_in) : direction( "direction", enum_direction, SP_CSS_DIRECTION_LTR ), writing_mode( "writing-mode", enum_writing_mode, SP_CSS_WRITING_MODE_LR_TB ), text_orientation( "text-orientation",enum_text_orientation,SP_CSS_TEXT_ORIENTATION_MIXED ), + dominant_baseline("dominant-baseline",enum_baseline, SP_CSS_BASELINE_AUTO ), baseline_shift(), text_anchor( "text-anchor", enum_text_anchor, SP_CSS_TEXT_ANCHOR_START ), white_space( "white-space", enum_white_space, SP_CSS_WHITE_SPACE_NORMAL ), @@ -321,6 +322,7 @@ SPStyle::SPStyle(SPDocument *document_in, SPObject *object_in) : _properties.push_back( &writing_mode ); _properties.push_back( &direction ); _properties.push_back( &text_orientation ); + _properties.push_back( &dominant_baseline ); _properties.push_back( &baseline_shift ); _properties.push_back( &text_anchor ); _properties.push_back( &white_space ); @@ -415,6 +417,7 @@ SPStyle::SPStyle(SPDocument *document_in, SPObject *object_in) : // _propmap.insert( std::make_pair( direction.name, reinterpret_cast<SPIBasePtr>(&SPStyle::direction ) ) ); // _propmap.insert( std::make_pair( writing_mode.name, reinterpret_cast<SPIBasePtr>(&SPStyle::writing_mode ) ) ); // _propmap.insert( std::make_pair( text_orientation.name, reinterpret_cast<SPIBasePtr>(&SPStyle::text_orientation ) ) ); + // _propmap.insert( std::make_pair( dominant_baseline.name, reinterpret_cast<SPIBasePtr>(&SPStyle::dominant_baseline ) ) ); // _propmap.insert( std::make_pair( baseline_shift.name, reinterpret_cast<SPIBasePtr>(&SPStyle::baseline_shift ) ) ); // _propmap.insert( std::make_pair( text_anchor.name, reinterpret_cast<SPIBasePtr>(&SPStyle::text_anchor ) ) ); // _propmap.insert( std::make_pair( white_space.name, reinterpret_cast<SPIBasePtr>(&SPStyle::white_space ) ) ); @@ -796,6 +799,9 @@ SPStyle::readIfUnset( gint id, gchar const *val ) { case SP_PROP_SHAPE_PADDING: shape_padding.readIfUnset( val ); break; + case SP_PROP_DOMINANT_BASELINE: + dominant_baseline.readIfUnset( val ); + break; case SP_PROP_BASELINE_SHIFT: baseline_shift.readIfUnset( val ); break; @@ -805,9 +811,6 @@ SPStyle::readIfUnset( gint id, gchar const *val ) { case SP_PROP_ALIGNMENT_BASELINE: g_warning("Unimplemented style property SP_PROP_ALIGNMENT_BASELINE: value: %s", val); break; - case SP_PROP_DOMINANT_BASELINE: - g_warning("Unimplemented style property SP_PROP_DOMINANT_BASELINE: value: %s", val); - break; case SP_PROP_GLYPH_ORIENTATION_HORIZONTAL: g_warning("Unimplemented style property SP_PROP_ORIENTATION_HORIZONTAL: value: %s", val); break; diff --git a/src/style.h b/src/style.h index 3948b876c..0e8e34145 100644 --- a/src/style.h +++ b/src/style.h @@ -148,6 +148,8 @@ public: SPIEnum writing_mode; /** Text orientation (CSS Writing Modes 3) */ SPIEnum text_orientation; + /** Dominant baseline (svg1.1) */ + SPIEnum dominant_baseline; /** Baseline shift (svg1.1 10.9.2) */ SPIBaselineShift baseline_shift; |
