summaryrefslogtreecommitdiffstats
path: root/src/sp-text.cpp
diff options
context:
space:
mode:
authorTavmjong Bah <tavmjong@free.fr>2016-06-01 12:21:37 +0000
committertavmjong-free <tavmjong@free.fr>2016-06-01 12:21:37 +0000
commit7a77adc9fc73f43544bc23f300d2abd382fda67c (patch)
treeb4bebb9a9c7ddfcd0b7cf6cc5a1ad323010bdaf8 /src/sp-text.cpp
parent[Bug #1508988] Calligraphy tutorial: things that might need an update. (diff)
downloadinkscape-7a77adc9fc73f43544bc23f300d2abd382fda67c.tar.gz
inkscape-7a77adc9fc73f43544bc23f300d2abd382fda67c.zip
Use CSS 'strut' as minimum value of CSS line box height.
(bzr r14935)
Diffstat (limited to 'src/sp-text.cpp')
-rw-r--r--src/sp-text.cpp23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/sp-text.cpp b/src/sp-text.cpp
index 6ae1c4fba..4afc38524 100644
--- a/src/sp-text.cpp
+++ b/src/sp-text.cpp
@@ -535,7 +535,28 @@ unsigned SPText::_buildLayoutInput(SPObject *root, Inkscape::Text::Layout::Optio
if (SP_IS_TEXT(root)) {
SP_TEXT(root)->attributes.mergeInto(&optional_attrs, parent_optional_attrs, parent_attrs_offset, true, true);
- if (SP_TEXT(root)->attributes.getTextLength()->_set) { // set textLength on the entire layout, see note in TNG-Layout.h
+
+ layout.strut.reset();
+ if (style) {
+ font_instance *font = font_factory::Default()->FaceFromStyle( style );
+ if (font) {
+ font->FontMetrics(layout.strut.ascent, layout.strut.descent, layout.strut.xheight);
+ font->Unref();
+ }
+ layout.strut *= style->font_size.computed;
+ if (style->line_height.normal ) {
+ layout.strut.computeEffective( Inkscape::Text::Layout::LINE_HEIGHT_NORMAL );
+ } else if (style->line_height.unit == SP_CSS_UNIT_NONE) {
+ layout.strut.computeEffective( style->line_height.computed );
+ } else {
+ if( style->font_size.computed > 0.0 ) {
+ layout.strut.computeEffective( style->line_height.computed/style->font_size.computed );
+ }
+ }
+ }
+
+ // set textLength on the entire layout, see note in TNG-Layout.h
+ if (SP_TEXT(root)->attributes.getTextLength()->_set) {
layout.textLength._set = true;
layout.textLength.value = SP_TEXT(root)->attributes.getTextLength()->value;
layout.textLength.computed = SP_TEXT(root)->attributes.getTextLength()->computed;