React-pdf: Hyphenation does not disable for Japanese with React-pdf 1.0.0 using correct API code

Created on 13 Dec 2018  路  4Comments  路  Source: diegomura/react-pdf

All 4 comments

Hi!

I see that there are lines that get hyphenated, but that's just because there are some lines that does not fit in the page width. You want those lines to overflow the page?

What I did noticed is that Font.registerHyphenationCallback is called with some fragments of lines. That's because the layout algorithm identified that some chars belong to a different unicode script` in the script itemization process

My apologizes that I don't know anything but latin languages 馃槄

Hi @diegomura,
Yeah, as you said, I noticed about how the algorithm identifies the different chars and either considers each character a word depending on which unicode script it is of, too when I was debugging one of the previous problems. Probably the best solution as you suggested would be for all Han scripts ( Chinese/Japanese/Korean, etc..) to just overflow at the end of each line to the next, as hyphenation is not used in those languages.

I try this code is ok

Font.registerHyphenationCallback(word => word.length === 1 ? [word] : Array.from(word).map(char => char));
Was this page helpful?
0 / 5 - 0 ratings

Related issues

foureyedraven picture foureyedraven  路  3Comments

jbrat picture jbrat  路  3Comments

pavle-lekic-htec picture pavle-lekic-htec  路  4Comments

yellowBanano picture yellowBanano  路  3Comments

mdodge-ecgrow picture mdodge-ecgrow  路  3Comments