question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to disable hyphenation?

See original GitHub issue

React-pdf version: alpha.15

Description: I would like to disable hyphenation, I tried to do it according to docs by passing identity callback, but I get the following error: react-pdf.browser.es.js:1067 Uncaught (in promise) TypeError: word.forEach is not a function at eval (react-pdf.browser.es.js:1067) at Array.forEach (<anonymous>) at eval (react-pdf.browser.es.js:1065) at KPLineBreaker.suggestLineBreak (react-pdf.browser.es.js:1112) at Typesetter.layoutLineFragments (Typesetter.js:82) at LayoutEngine$$1.layoutParagraph (LayoutEngine.js:134) at LayoutEngine$$1.layoutColumn (LayoutEngine.js:92) at LayoutEngine$$1.layout (LayoutEngine.js:80) at TextEngine.layout (react-pdf.browser.es.js:3755) at Text.measureText (react-pdf.browser.es.js:3965)

How to replicate issue including code snippet (if applies): Font.registerHyphenationCallback(words => words);

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

16reactions
davidecarpinicommented, Oct 31, 2019

I resolved with this changes in callback:

Font.registerHyphenationCallback(word => (
  [word]
));
2reactions
diegomuracommented, Sep 26, 2018

Should be like this:

Font.registerHyphenationCallback(words => (
  words.map(word => [word])
));

Why?

The hyphenation callback takes as argument the array of words you want to render in the doc (in the format of GlyphString), and should return an array of each word splited into pieces where hyphenation can occur. In other words, it should return an array of arrays. If you don’t want to break any word, you basically return each word as it was originally and that’s it.

Hope this helped.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fix text hyphenation - Microsoft Support
To fix this problem manually, turn off hyphenation and delete the hyphens. Click the Text Box Tools Format tab, and then click Hyphenation....
Read more >
Turning Off Paragraph Hyphenation - Word Ribbon Tips
Click the small icon at the bottom-right of the Paragraph group. Word displays the Paragraph dialog box. Make sure the Line and Page...
Read more >
Word: Turn off automatic hyphenation - CyberText Newsletter
Go to the Page Layout tab > Page Setup group. Click Hyphenation. Select None. Auto hyphenation setting in Word 2007. That's it!
Read more >
How to Get Rid of Auto Hyphen in Word
Click “None” so that a check mark appears on the line. Word immediately removes the hyphenation. Note that this will wrap longer words...
Read more >
How to turn off hyphenation in InDesign (or edit it) - Redokun
How to Remove Hyphenation from the Entire Text · Select the text. · In the control bar, in the Paragraph menu, disable the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found