mundschenk-at / php-typography

A PHP library for improving your web typography.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can’t use widows when hyphens disabled

RicLeP opened this issue · comments

I have the following settings but widows seems dependant on hyphenation being enabled. Is this a bug or expected behaviour? It would be very useful to dewidow without hyphenation.

$typographySettings = new Settings();
$typographySettings->set_dewidow(true);
$typographySettings->set_max_dewidow_length(20);
$typographySettings->set_hyphenation(true); // when false widows are not applied

$typography->process($page->body, $typographySettings);

Hi @RicLeP!

I think the reasoning behind this was to prevent long word switching lines when hyphenation is disabled (making things even uglier). That said, I see no reason to enforce this if someone wants to dewidow without hyphenation.

Actually, there is no such limitation. You just need to set the maximum pull as well (using set_max_dewidow_pull). I guess I always should look at the code before answering ;-)