libgrapheme

Freestanding C library for unicode string handling
git clone https://git.sinitax.com/suckless/libgrapheme
Log | Files | Refs | README | LICENSE | sfeed.txt

README (2079B)


      1libgrapheme
      2===========
      3
      4libgrapheme is an extremely simple freestanding C99 library providing
      5utilities for properly handling strings according to the latest Unicode
      6standard 15.0.0. It offers fully Unicode compliant
      7
      8 - grapheme cluster (i.e. user-perceived character) segmentation
      9 - word segmentation
     10 - sentence segmentation
     11 - detection of permissible line break opportunities
     12 - case detection (lower-, upper- and title-case)
     13 - case conversion (to lower-, upper- and title-case)
     14
     15on UTF-8 strings and codepoint arrays, which both can also be
     16null-terminated.
     17
     18The necessary lookup-tables are automatically generated from the Unicode
     19standard data (contained in the tarball) and heavily compressed. Over
     2010,000 automatically generated conformance tests and over 150 unit tests
     21ensure conformance and correctness.
     22
     23There is no complicated build-system involved and it's all done using one
     24POSIX-compliant Makefile. All you need is a C99 compiler, given the
     25lookup-table-generators and compressors are also written in C99. The
     26resulting library is freestanding and thus not even dependent on a
     27standard library to be present at runtime, making it a suitable choice
     28for bare metal applications.
     29
     30It is also way smaller and much faster than the other established
     31Unicode string libraries (ICU, GNU's libunistring, libutf8proc).
     32
     33Requirements
     34------------
     35A C99-compiler and POSIX make.
     36
     37Installation
     38------------
     39Run ./configure, which automatically edits config.mk to match your local
     40setup. Edit config.mk by hand if necessary or desired for further
     41customization.
     42
     43Afterwards enter the following command to build and install libgrapheme
     44(if necessary as root):
     45
     46	make install
     47
     48Conformance
     49-----------
     50The libgrapheme library is compliant with the Unicode 15.0.0
     51specification (September 2022). The tests can be run with
     52
     53	make test
     54
     55to check standard conformance and correctness.
     56
     57Usage
     58-----
     59Include the header grapheme.h in your code and link against libgrapheme
     60with "-lgrapheme" either statically ("-static") or dynamically.
     61
     62Author
     63------
     64Laslo Hunhold <dev@frign.de>