Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Insert Line Feed for each paragraph #107

Merged
merged 2 commits into from
Apr 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Classes/ViewHelpers/AbstractTextViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ abstract class AbstractTextViewHelper extends AbstractContentElementViewHelper
'text',
'alignment',
'paragraphSpacing',
'paragraphLineFeed',
'autoHyphenation',
'lineHeight',
'characterSpacing',
Expand Down Expand Up @@ -82,6 +83,7 @@ public function initializeArguments()
$this->registerArgument('alignment', 'string', '', false, null);
$this->registerArgument('paragraphSpacing', 'float', '', false, null);
$this->registerArgument('autoHyphenation', 'boolean', '', false, null);
$this->registerArgument('paragraphLineFeed', 'boolean', '', false, null);
$this->registerArgument('type', 'string', '', false, null);
}

Expand Down Expand Up @@ -163,6 +165,10 @@ public function render()
$paragraph = trim($paragraph);
}

if ($this->arguments['paragraphLineFeed']) {
$paragraph .= "\n";
}

$this->getPDF()->MultiCell($this->arguments['width'], $this->arguments['height'] / count($paragraphs), $paragraph, 0, $this->conversionService->convertSpeakingAlignmentToTcpdfAlignment($this->arguments['alignment']), false, 1, $this->arguments['posX'], $posY, true, 0, false, true, 0, 'T', false);

if ($this->validationService->validateParagraphSpacing($this->arguments['paragraphSpacing']) && $this->arguments['paragraphSpacing'] > 0) {
Expand Down
4 changes: 4 additions & 0 deletions Configuration/TypoScript/setup.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ plugin.tx_pdfviewhelpers.settings {
characterSpacing = 0
alignment = left
paragraphSpacing = 2
paragraphLineFeed = 0
autoHyphenation = 0
padding {
top = 0
Expand All @@ -95,6 +96,7 @@ plugin.tx_pdfviewhelpers.settings {
characterSpacing =
alignment =
paragraphSpacing =
paragraphLineFeed =
autoHyphenation =
padding {

Expand All @@ -114,6 +116,7 @@ plugin.tx_pdfviewhelpers.settings {
characterSpacing =
alignment =
paragraphSpacing = 0
paragraphLineFeed =
autoHyphenation =
padding {
top = 6
Expand All @@ -132,6 +135,7 @@ plugin.tx_pdfviewhelpers.settings {
fontStyle =
lineHeight =
characterSpacing =
paragraphLineFeed =
alignment = left
autoHyphenation =
padding {
Expand Down
12 changes: 12 additions & 0 deletions Documentation/ConfigurationReference/TypoScriptReference/Index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ Properties in plugin.tx_pdfviewhelpers.settings
generalText.padding_ Array {top: 0, right: 0, bottom: 0, left: 0}
generalText.alignment_ :ref:`t3tsref:data-type-string` left
generalText.paragraphSpacing_ :ref:`t3tsref:data-type-integer` 2
generalText.paragraphLineFeed_ :ref:`t3tsref:data-type-boolean` 0
generalText.autoHyphenation_ :ref:`t3tsref:data-type-boolean` 0
text.trim :ref:`t3tsref:data-type-boolean` *See generalText*
text.removeDoubleWhitespace :ref:`t3tsref:data-type-boolean` *See generalText*
Expand All @@ -91,6 +92,7 @@ Properties in plugin.tx_pdfviewhelpers.settings
text.padding Array *See generalText*
text.alignment :ref:`t3tsref:data-type-string` *See generalText*
text.paragraphSpacing :ref:`t3tsref:data-type-integer` *See generalText*
text.paragraphLineFeed :ref:`t3tsref:data-type-boolean` *See generalText*
text.autoHyphenation :ref:`t3tsref:data-type-boolean` *See generalText*
headline.trim :ref:`t3tsref:data-type-boolean` *See generalText*
headline.removeDoubleWhitespace :ref:`t3tsref:data-type-boolean` *See generalText*
Expand All @@ -103,6 +105,7 @@ Properties in plugin.tx_pdfviewhelpers.settings
headline.padding Array {top: 6, bottom: 3}
headline.alignment :ref:`t3tsref:data-type-string` *See generalText*
headline.paragraphSpacing :ref:`t3tsref:data-type-integer` *See generalText*
headline.paragraphLineFeed :ref:`t3tsref:data-type-boolean` *See generalText*
headline.autoHyphenation :ref:`t3tsref:data-type-boolean` *See generalText*
list.trim :ref:`t3tsref:data-type-boolean` *See generalText*
list.removeDoubleWhitespace :ref:`t3tsref:data-type-boolean` *See generalText*
Expand Down Expand Up @@ -535,6 +538,15 @@ generalText.paragraphSpacing

Defines the spacing of paragraphs separated by new lines.

.. _generalText.paragraphLineFeed:

generalText.paragraphLineFeed
""""""""""""""""""""""""""""

:typoscript:`plugin.tx_pdfviewhelpers.settings.generalText.paragraphLineFeed =` :ref:`t3tsref:data-type-boolean`

Add new lines char after each paragraph (in justified text keeps left align the last line of each paragraph).

.. _generalText.autoHyphenation:

generalText.autoHyphenation
Expand Down
1 change: 1 addition & 0 deletions Documentation/ViewHelpers/HeadlineViewHelper/Index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ It is possible to easily define different default styles and apply them using th
characterSpacing="0.2"
alignment="right"
paragraphSpacing="0"
paragraphLineFeed="1"
autoHyphenation="1"
padding="{top: 1, right: 0, bottom: 0, left: 0}"
width="100"
Expand Down
1 change: 1 addition & 0 deletions Documentation/ViewHelpers/ListViewHelper/Index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ It is possible to easily define different default styles and apply them using th
fontStyle="bold"
lineHeight="1.5"
characterSpacing="0.2"
paragraphLineFeed="1"
alignment="center"
autoHyphenation="1"
padding="{top:1, right:0, bottom:0, left:0}"
Expand Down
1 change: 1 addition & 0 deletions Documentation/ViewHelpers/TextViewHelper/Index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ It is possible to easily define different default styles and apply them using th
characterSpacing="0.2"
alignment="right"
paragraphSpacing="0"
paragraphLineFeed="1"
autoHyphenation="1"
padding="{top: 1, right: 0, bottom: 0, left: 0}"
width="80%"
Expand Down