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

text-align: justify does not work with Unicode fonts #801

Open
eremem opened this issue Jul 23, 2024 · 0 comments
Open

text-align: justify does not work with Unicode fonts #801

eremem opened this issue Jul 23, 2024 · 0 comments

Comments

@eremem
Copy link

eremem commented Jul 23, 2024

There seems to be some fundamental problem in the current implementation of the text justification and Unicode fonts - it simply doesn't work unlike text-align: left and text-align: right.

The following code shows this issue by using one of the default fonts:

$html2pdf = new \Spipu\Html2Pdf\Html2Pdf('P', 'A4', 'en');
$html2pdf->setDefaultFont('dejavusans');
$html2pdf->writeHTML('<page>' .
	'<p style="text-align: justify;">Aenean placerat. In vulputate urna eu arcu. Aliquam erat volutpat. Suspendisse potenti. Morbi mattis felis at nunc. Duis viverra diam non justo. In nisl. Nullam sit amet magna in magna gravida vehicula. Mauris tincidunt sem sed arcu. Nunc posuere. Nullam lectus justo, vulputate eget, mollis sed, tempor sed, magna. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Etiam neque. Curabitur ligula sapien, pulvinar a, vestibulum quis, facilisis vel, sapien. Nullam eget nisl. Donec vitae arcu.</p>' .
	'</page>');
$html2pdf->output('/tmp/html2pdf-justify-issue.pdf', 'F');

As far as I can tell the word spacing is set to 0 as the if condition fails here.

I hope this will help you solve this problem quickly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant