|
|
|
@ -79,7 +79,7 @@ module.exports = function layoutFormattedText(text, options) {
|
|
|
|
|
|
|
|
|
|
if (options.trimVerticalWhitespace) {
|
|
|
|
|
startHeightCorrection = -(adjustedLineHeights[0] / 2) - (lines[0].minAscender / 2);
|
|
|
|
|
endHeightCorrection = -(last(adjustedLineHeights) / 2) - (last(lines).minAscender / 2) + (last(lines).maxDescender);
|
|
|
|
|
endHeightCorrection = -(last(adjustedLineHeights) / 2) - (last(lines).minAscender / 2);
|
|
|
|
|
} else {
|
|
|
|
|
startHeightCorrection = 0;
|
|
|
|
|
endHeightCorrection = 0;
|
|
|
|
@ -117,7 +117,7 @@ module.exports = function layoutFormattedText(text, options) {
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
width: Math.ceil(max(lines.map(line => line.width))),
|
|
|
|
|
height: Math.ceil(sum(adjustedLineHeights) + startHeightCorrection + endHeightCorrection),
|
|
|
|
|
height: Math.ceil(sum(adjustedLineHeights) + startHeightCorrection + endHeightCorrection + (last(lines).maxDescender)),
|
|
|
|
|
items: positionedItems,
|
|
|
|
|
drawDebugLines: function drawDebugLines(context) {
|
|
|
|
|
debugLines.forEach((debugLine) => {
|
|
|
|
@ -154,7 +154,7 @@ module.exports = function layoutFormattedText(text, options) {
|
|
|
|
|
|
|
|
|
|
if (options.trimVerticalWhitespace) {
|
|
|
|
|
startHeightCorrection = -(adjustedLineHeights[0] / 2) - (lines[0].measurements.ascender / 2);
|
|
|
|
|
endHeightCorrection = -(last(adjustedLineHeights) / 2) - (last(lines).measurements.ascender / 2) + (last(lines).measurements.descender);
|
|
|
|
|
endHeightCorrection = -(last(adjustedLineHeights) / 2) - (last(lines).measurements.ascender / 2);
|
|
|
|
|
} else {
|
|
|
|
|
startHeightCorrection = 0;
|
|
|
|
|
endHeightCorrection = 0;
|
|
|
|
@ -186,7 +186,7 @@ module.exports = function layoutFormattedText(text, options) {
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
width: Math.ceil(max(lines.map(line => line.measurements.width))),
|
|
|
|
|
height: Math.ceil(sum(adjustedLineHeights) + startHeightCorrection + endHeightCorrection),
|
|
|
|
|
height: Math.ceil(sum(adjustedLineHeights) + startHeightCorrection + endHeightCorrection + (last(lines).measurements.descender)),
|
|
|
|
|
items: positionedItems,
|
|
|
|
|
drawDebugLines: function drawDebugLines(context) {
|
|
|
|
|
debugLines.forEach((debugLine) => {
|
|
|
|
|