linebreak.h

Go to the documentation of this file.
00001 /* vim: set tabstop=4 shiftwidth=4: */
00002 
00003 /*
00004  * Line breaking in a Unicode sequence.  Designed to be used in a
00005  * generic text renderer.
00006  *
00007  * Copyright (C) 2008-2011 Wu Yongwei <wuyongwei at gmail dot com>
00008  *
00009  * This software is provided 'as-is', without any express or implied
00010  * warranty.  In no event will the author be held liable for any damages
00011  * arising from the use of this software.
00012  *
00013  * Permission is granted to anyone to use this software for any purpose,
00014  * including commercial applications, and to alter it and redistribute
00015  * it freely, subject to the following restrictions:
00016  *
00017  * 1. The origin of this software must not be misrepresented; you must
00018  *    not claim that you wrote the original software.  If you use this
00019  *    software in a product, an acknowledgement in the product
00020  *    documentation would be appreciated but is not required.
00021  * 2. Altered source versions must be plainly marked as such, and must
00022  *    not be misrepresented as being the original software.
00023  * 3. This notice may not be removed or altered from any source
00024  *    distribution.
00025  *
00026  * The main reference is Unicode Standard Annex 14 (UAX #14):
00027  *      <URL:http://www.unicode.org/reports/tr14/>
00028  *
00029  * When this library was designed, this annex was at Revision 19, for
00030  * Unicode 5.0.0:
00031  *      <URL:http://www.unicode.org/reports/tr14/tr14-19.html>
00032  *
00033  * This library has been updated according to Revision 26, for
00034  * Unicode 6.0.0:
00035  *      <URL:http://www.unicode.org/reports/tr14/tr14-26.html>
00036  *
00037  * The Unicode Terms of Use are available at
00038  *      <URL:http://www.unicode.org/copyright.html>
00039  */
00040 
00050 #ifndef LINEBREAK_H
00051 #define LINEBREAK_H
00052 
00053 #include <stddef.h>
00054 
00055 #ifdef __cplusplus
00056 extern "C" {
00057 #endif
00058 
00059 #define LINEBREAK_VERSION   0x0201  
00060 extern const int linebreak_version;
00061 
00062 #ifndef LINEBREAK_UTF_TYPES_DEFINED
00063 #define LINEBREAK_UTF_TYPES_DEFINED
00064 typedef unsigned char   utf8_t;     
00065 typedef unsigned short  utf16_t;    
00066 typedef unsigned int    utf32_t;    
00067 #endif
00068 
00069 #define LINEBREAK_MUSTBREAK     0   
00070 #define LINEBREAK_ALLOWBREAK    1   
00071 #define LINEBREAK_NOBREAK       2   
00072 #define LINEBREAK_INSIDEACHAR   3   
00074 void init_linebreak(void);
00075 void set_linebreaks_utf8(
00076         const utf8_t *s, size_t len, const char* lang, char *brks);
00077 void set_linebreaks_utf16(
00078         const utf16_t *s, size_t len, const char* lang, char *brks);
00079 void set_linebreaks_utf32(
00080         const utf32_t *s, size_t len, const char* lang, char *brks);
00081 int is_line_breakable(utf32_t char1, utf32_t char2, const char* lang);
00082 
00083 #ifdef __cplusplus
00084 }
00085 #endif
00086 
00087 #endif /* LINEBREAK_H */

Generated on Sat May 14 15:01:38 2011 for liblinebreak by  doxygen 1.5.2