libtextwrap


libtextwrap is...

a word-wrapping (line-folding) library with I18N (internationalization) support including:

  • multibyte encodings (UTF-8, EUC-JP, EUC-KR, GB2312, Big5, ...)
  • fullwidth characters (CJK Ideograph, Hiragana, Katakana, Hangul, ...)
  • combining characters
  • languages which do not use whitespaces between "words" (Chinese and Japanese)

 

Introduction

Word-wrapping (or line-folding) is one of frequently used text-processing. It is implemented very easily only when it is based on several assumptions such as:

  • One character consists from one byte.
  • One character occupies one column on the terminal.
  • A line can be folded between words which are separated by whitespaces.
All of these assumptions are local and valid only for some part of languages in the world. There are languages which don't meet the assumptions and speakers of such languages cannot use softwares which depend on these assumptions.

Since it is usually difficult to require developers to know various languages in the world and their properties, text-processing algorithms should be supplied as libraries. Otherwise, their softwares cannot support various languages in the world and people in the world suffer from a problem that many softwares are useless for them.

Feature

On calling a function with parameters of text and maximum columns, one can get line-folded text. The text is encoded in current LC_CTYPE locale. This means that libtextwrap uses UTF-8 for I/O in UTF-8 locales, ISO-8859-1 in ISO-8859-1 locales, EUC-JP in EUC-JP locales, KOI8-R in KOI8-R locales, and so on.

License

Though I am a GPL-fan, now I would like to regard equality between languages and countries more important than free software. (For this purpose, softwares based on languages/countries equality viewpoint must be distributed as far as possible.) Thus, I will release libtextwrap under Modified BSD-style license.

Resources

Developers Welcome

I have just started this project alone. Cooperators are very welcome!


This project is hosted by SourceForge.net Logo.