mundschenk-at / php-typography

A PHP library for improving your web typography.
GNU General Public License v2.0
68 stars 6 forks source link

Space between every letter #137

Closed GuyVervillePerso closed 3 years ago

GuyVervillePerso commented 3 years ago

Hi, I do not understand why all the text is broken into one letter per word...

renderedtext2

renderedText

The code is a basic trial: ` $settings = new \PHP_Typography\Settings(); $settings->set_hyphenation( true ); if(user()->language->name == "fr"){ $settings->set_hyphenation_language( 'fr' ); $settings->set_french_punctuation_spacing( true ); }else{ $settings->set_hyphenation_language( 'en-US' ); } $typo = new \PHP_Typography\PHP_Typography(); $test = "Ange Michael is 27-28 years old and grows cocoa. His father died of malaria in 2009. The son had to take over the hectare of cocoa trees on his own to support the family. His mother works as a housekeeper, and, year in, year out, Ange Michael manages to provide them with the bare necessities. He does not live with them, however, and has his own house. He would like to get married, has a girlfriend who is still studying, but as long as he cannot live decently, he cannot get married."; $hyphenated_html = $typo->process( $test, $settings );

`

mundschenk-at commented 3 years ago

Are you, perchance, using Craft? If so, it is a recurrence of #109.

GuyVervillePerso commented 3 years ago

No, I am using ProcessWire. I will try outside this CMS.

Guy Verville SPIRIA


De : Der Mundschenk & Compagnie @.> Envoyé : Saturday, April 17, 2021 4:54:40 AM À : mundschenk-at/php-typography @.> Cc : Guy Verville @.>; Author @.> Objet : Re: [mundschenk-at/php-typography] Space between every letter (#137)

Are you, perchance using Craft? If so, it is a recurrence of #109https://github.com/mundschenk-at/php-typography/issues/109.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/mundschenk-at/php-typography/issues/137#issuecomment-821791872, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AQTXETHUSKBKHWXYIWOV6SLTJFEFBANCNFSM43CAT2SQ.

mundschenk-at commented 3 years ago

No, I am using ProcessWire. I will try outside this CMS.

Thank you. The cause is very likely similar to the one in the referenced issue (a setlocale call in an always-autoloaded boostrap file).

GuyVervillePerso commented 3 years ago

I will check that. BTW, there is a port for ProcessWire, but for the original PHP Typography which inspires yours, I think. The only problem with this module is that it is still not multi-lingual and in beta.

https://gitlab.com/rockettpw/tools/typographer https://processwire.com/talk/topic/15130-typographer/page/1/

mundschenk-at commented 3 years ago

@GuyVervilleSpiria Have you been able to investigate the issue or produce a minimal example for me to look at?

GuyVervillePerso commented 3 years ago

Hi, Sorry I didn't intervene earlier. The problem is probably similar to what I experienced with the module for ProcessWire. I just clarified a few things for the French.


    /** @var \PHP_Typography\Settings $settings */
    $settings = $event->return;
    $lang = $event->user->language->name;
    if ($lang === 'fr') {
        $settings->set_hyphenation_language('fr');
        $settings->set_french_punctuation_spacing(true);
    }
});```