summaryrefslogtreecommitdiffstats
path: root/src/libnrtype
diff options
context:
space:
mode:
authorTavmjong Bah <tavmjong@free.fr>2018-12-18 12:14:58 +0000
committerTavmjong Bah <tavmjong@free.fr>2018-12-18 12:14:58 +0000
commit9666f3139382451bc2a84eb9959d690f75b8250b (patch)
tree5b1a40d4a553bf7dde87c96d290ab80a80890fb1 /src/libnrtype
parentremove "Perspective path" LPE (diff)
downloadinkscape-9666f3139382451bc2a84eb9959d690f75b8250b.tar.gz
inkscape-9666f3139382451bc2a84eb9959d690f75b8250b.zip
Add ability to create SVG 2 text:
'shape-inside' (disabled for the moment) 'inline-size' (via on-screen knot)
Diffstat (limited to 'src/libnrtype')
-rw-r--r--src/libnrtype/Layout-TNG-Compute.cpp27
1 files changed, 26 insertions, 1 deletions
diff --git a/src/libnrtype/Layout-TNG-Compute.cpp b/src/libnrtype/Layout-TNG-Compute.cpp
index 54780b5fc..212aa5f97 100644
--- a/src/libnrtype/Layout-TNG-Compute.cpp
+++ b/src/libnrtype/Layout-TNG-Compute.cpp
@@ -947,10 +947,10 @@ void Layout::Calculator::_outputLine(ParagraphInfo const &para,
void Layout::Calculator::_createFirstScanlineMaker()
{
_current_shape_index = 0;
+ InputStreamTextSource const *text_source = static_cast<InputStreamTextSource const *>(_flow._input_stream.front());
if (_flow._input_wrap_shapes.empty()) {
// create the special no-wrapping infinite scanline maker
double initial_x = 0, initial_y = 0;
- InputStreamTextSource const *text_source = static_cast<InputStreamTextSource const *>(_flow._input_stream.front());
if (!text_source->x.empty())
initial_x = text_source->x.front().computed;
if (!text_source->y.empty())
@@ -961,6 +961,31 @@ void Layout::Calculator::_createFirstScanlineMaker()
else {
_scanline_maker = new ShapeScanlineMaker(_flow._input_wrap_shapes[_current_shape_index].shape, _block_progression);
TRACE((" begin wrap shape 0\n"));
+
+ // 'inside-shape' uses an infinitely high (wide) shape. We must set initial y. (We only need to do it here as there is only one shape.)
+ if (text_source->style->inline_size.set) {
+ _block_progression = _flow._blockProgression();
+ if( _block_progression == RIGHT_TO_LEFT ||
+ _block_progression == LEFT_TO_RIGHT ) {
+ // Vertical text, CJK
+ if (!text_source->x.empty()) {
+ double initial_x = text_source->x.front().computed;
+ _scanline_maker->setNewYCoordinate(initial_x);
+ } else {
+ std::cerr << "Layout::Calculator::_createFirstScanlineMaker: no x value with 'inline-size'!" << std::endl;
+ _scanline_maker->setNewYCoordinate(0);
+ }
+ } else {
+ // Horizontal text
+ if (!text_source->y.empty()) {
+ double initial_y = text_source->y.front().computed;
+ _scanline_maker->setNewYCoordinate(initial_y);
+ } else {
+ std::cerr << "Layout::Calculator::_createFirstScanlineMaker: no y value with 'inline-size'!" << std::endl;
+ _scanline_maker->setNewYCoordinate(0);
+ }
+ }
+ }
}
}