xles / hyphenator

Automatically exported from code.google.com/p/hyphenator
GNU General Public License v3.0
0 stars 0 forks source link

Responsive Issue #195

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I'm trying to hypenate paragraphs that are contained in a div. My page is 
responsive so i wrote a script for dealing with the minwordlength. I set it to 
5 when its less than 700px and 7 when it is greater.
The problem is that hypernator doesn't refresh the configurations even if i 
re-run hypernator.

I'm using the latests version of hypernator.

Thank you!

Original issue reported on code.google.com by facundop...@gmail.com on 25 Dec 2013 at 5:45

GoogleCodeExporter commented 9 years ago
Thanks for the report.
There's no easy way to solve this issue.

On execution minwordlength is stored in a language specific RegExp inside the 
object that contains the hyphenation patterns for the language. By caching this 
RegExp we gain some speed.

Resetting the minwordlenght dynamically would involve lots of expensive 
computations:
- remove all existing hyphenation (or previously setted hyphenation points will 
remain)
- rebuild the RegExp
- rehyphenate the whole document
So there will be a huge workload on each resize-event resulting in slaggy 
layout.

Therefore I highly recommend to set minwordlength to 5 (or use the default 6) 
for all sizes. You won't get that much more speed by setting it to 7, anyway.

Regards,
Mathias

Original comment by mathiasn...@gmail.com on 13 Jan 2014 at 4:12