Hyphenation in c#

走远了吗. 提交于 2020-01-01 05:38:09

问题


I'm looking for a sample project that will perform hyphenation of text in C#. Ideally, this would be derived from the TeX hyphenation algorithm, or similar. I'm interested in English currently, although other languages may be required in the future. Anyone seen something like that? background I'm planning on including this in a MonoTouch project using CoreText.


回答1:


Obviously, Donald Knuth's algorithms are excellent. Although there is not a C# implementation available, have you considered converting another implementation to C#? (For example, you could convert the Java implementation which is fairly close to C#.)

Another option is to use a simpler implementation which can be found over at this answer here on StackOverflow.




回答2:


I found a C# implementation of Knuth-Liang hyphenation algorithm at https://github.com/alkozko/NHyphenator and it seems to work fine.

But there are currently two drawbacks:

  1. It can't load TeX hyphenation pattern files out-of-the-box (however, adding support for them seems trivial).
  2. It's unclear which kind of license applies to the source code.


来源:https://stackoverflow.com/questions/5877777/hyphenation-in-c-sharp

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!