What version of Prawn are you using? The :wrap => :character option
was removed a long time ago (late 2009, if I recall correctly). See
examples/m17n/chinese_text_wrapping.rb for an example that includes
wrapping Chinese text.
Kind Regards,
Daniel
For example:
- 更可怕的是,同质化竞争对手可以按照URL中后面这个ID来遍历您的DB中的内容,写个小爬虫把你的页面上的关键信息顺次爬下来也
which I expect:
- 更可怕的是,同质化竞争对手可以按照URL
中后面这个ID来遍历您的DB中的内容,写个
小爬虫把你的页面上的关键信息顺次爬下来也
What actually happen:
-
更可怕的是,同质化竞争对手可以按照URL中
后面这个ID来遍历您的DB中的内容,写个小
爬虫把你的页面上的关键信息顺次爬下来也
Would be great if you have some idea on how to fix this.
If you don't want to break on spaces, use a non-breaking space (or,
for your convenience, Prawn::Text::NBSP).
Kind Regards,
Daniel
But this knowledge requires specific localized knowledge of the
language, if we continue to special case this way, things will get very
complex. If you want this functionality, please create a wrapping
module for Chinese and release it independently. We have made our text
wrapping easy to extend for this reason.
-greg
Yep I digg this- can give some example on how to extend the wrapping? I kinda confused when I read the code there- there seems to have a few classes involved, from the linewrap to some of the wrapping methods inside formatted and normal text box.
Check out Prawn::Text::Box#extensions. The API documentation shows how
to override wrapping. See the API documentation for
Prawn::Core::Text::Wrap#wrap for details of what the overriding #wrap
method needs to do.
- Daniel