@react-pdf/textkit
Advanced tools
Comparing version 0.3.1 to 0.3.2
@@ -36,11 +36,12 @@ "use strict"; | ||
var layoutLines = function layoutLines(rect, lines) { | ||
var layoutLines = function layoutLines(rect, lines, indent) { | ||
var currentY = rect.y; | ||
return R.map(R.compose(function (line) { | ||
return R.addIndex(R.map)(R.compose(purgeAttachments, function (line, i) { | ||
var lineIndent = i === 0 ? indent : 0; | ||
var style = R.pathOr({}, ['runs', 0, 'attributes'], line); | ||
var height = Math.max((0, _height["default"])(line), style.lineHeight); | ||
var box = { | ||
x: rect.x, | ||
x: rect.x + lineIndent, | ||
y: currentY, | ||
width: rect.width, | ||
width: rect.width - lineIndent, | ||
height: height | ||
@@ -50,3 +51,3 @@ }; | ||
return R.compose(R.assoc('box', box), R.omit(['syllables']))(line); | ||
}, purgeAttachments))(lines); | ||
}))(lines); | ||
}; | ||
@@ -66,4 +67,5 @@ /** | ||
return function (rect, paragraph) { | ||
var lines = engines.linebreaker(options)(paragraph, [rect.width]); | ||
var lineFragments = layoutLines(rect, lines); | ||
var indent = R.pathOr(0, ['runs', 0, 'attributes', 'indent'], paragraph); | ||
var lines = engines.linebreaker(options)(paragraph, [rect.width - indent, rect.width]); | ||
var lineFragments = layoutLines(rect, lines, indent); | ||
return lineFragments; | ||
@@ -70,0 +72,0 @@ }; |
{ | ||
"name": "@react-pdf/textkit", | ||
"version": "0.3.1", | ||
"version": "0.3.2", | ||
"description": "An advanced text layout framework", | ||
@@ -5,0 +5,0 @@ "main": "./index.js", |
174848
4760