C++ bindings for cgul_line_wrapper
More...
#include <cgul_line_wrapper_cxx.h>

Static Public Member Functions | |
| static void | wrap_utf8_at_column (cgul_string_cxx &lines, unsigned int column) |
| static void | wrap_utf32_at_column (cgul_wstring_cxx &wlines, unsigned int column) |
| static void | wrap_utf8_at_width (cgul_string_cxx &lines, cgul_bdf_cxx &bdf, int substitute, unsigned int max_line_width) |
| static void | wrap_utf32_at_width (cgul_wstring_cxx &wlines, cgul_bdf_cxx &bdf, int substitute, unsigned int max_line_width) |
This class provides the C++ bindings for C cgul_line_wrapper objects. The main purpose of this class is to convert the C-style function calls and exception handling in cgul_line_wrapper into C++-style function calls and exception handling.
|
inlinestatic |
This function wraps the UTF-8 string lines at column and returns the result in lines. This is used for formatting text destined for the console. It assumes all characters have the same, unspecified width. So the wrapping is based on the maximum number of characters per line.
It is permissible for lines to have embedded new-line characters before calling this method. When an embedded new-line character is encountered, this method will honor it and force the start of a new line.
If an error occurs, an exception is thrown.
| [in,out] | lines | lines to wrap |
| [in] | column | column at which to wrap |
References cgul_line_wrapper__wrap_utf8_at_column(), and cgul_string_cxx::get_obj().
|
inlinestatic |
This function wraps the UTF-32 string wlines at column and returns the result in wlines. This is used for formatting text destined for the console. It assumes all characters have the same, unspecified width. So the wrapping is based on the maximum number of wide characters per line.
It is permissible for wlines to have embedded new-line wide characters before calling this method. When an embedded new-line wide character is encountered, this method will honor it and force the start of a new line.
If an error occurs, an exception is thrown.
| [in,out] | wlines | lines to wrap |
| [in] | column | column at which to wrap |
References cgul_line_wrapper__wrap_utf32_at_column(), and cgul_wstring_cxx::get_obj().
|
inlinestatic |
This function wraps the UTF-8 string lines at width and returns the result in lines. This is used for formatting text destined to be drawn on a graphical surface. The amount of space each line consumes is calculated using the BDF font bdf by calling cgul_bdf__get_utf8_extents(). Thus, in order for this function to be accurate, your code must draw text as explained in the comments to cgul_bdf__get_utf8_extents() and the value you pass in here for substitute must match.
It is permissible for lines to have embedded new-line characters before calling this method. When an embedded new-line character is encountered, this method will honor it and force the start of a new line.
If substitute is set, this method assumes the code that draws the text will substitute missing glyphs with the default glyph for the font, e.g., an empty box. If substitute is not set, this method will throw an exception if it cannot find the glyph for one of the characters in lines.
If you just need to calculate the width of a string in pixels, you can use cgul_bdf__get_utf8_extents() instead.
If an error occurs, an exception is thrown.
| [in,out] | lines | lines to wrap |
| [in] | bdf | BDF font |
| [in] | substitute | whether to substitute missing glyphs with the default |
| [in] | max_line_width | maximum line width before wrapping occurs |
References cgul_line_wrapper__wrap_utf8_at_width(), cgul_bdf_cxx::get_obj(), and cgul_string_cxx::get_obj().
|
inlinestatic |
This function wraps the UTF-32 string wlines at width and returns the result in wlines. This is used for formatting text destined to be drawn on a graphical surface. The amount of space each line consumes is calculated using the BDF font bdf by calling cgul_bdf__get_utf32_extents(). Thus, in order for this function to be accurate, your code must draw text as explained in the comments to cgul_bdf__get_utf32_extents() and the value you pass in here for substitute must match.
It is permissible for wlines to have embedded new-line characters before calling this method. When an embedded new-line character is encountered, this method will honor it and force the start of a new line.
If substitute is set, this method assumes the code that draws the text will substitute missing glyphs with the default glyph for the font, e.g., an empty box. If substitute is not set, this method will throw an exception if it cannot find the glyph for one of the characters in lines.
If you just need to calculate the width of a string in pixels, you can use cgul_bdf__get_utf32_extents() instead.
If an error occurs, an exception is thrown.
| [in,out] | wlines | lines to wrap |
| [in] | bdf | BDF font |
| [in] | substitute | whether to substitute missing glyphs with the default |
| [in] | max_line_width | maximum line width before wrapping occurs |
References cgul_line_wrapper__wrap_utf32_at_width(), cgul_bdf_cxx::get_obj(), and cgul_wstring_cxx::get_obj().