glyph for BDF fonts More...
#include "cgul_common.h"#include "cgul_exception.h"#include "cgul_libc.h"#include "cgul_string.h"#include "cgul_wchar.h"

Typedefs | |
| typedef typedefCGUL_BEGIN_C struct cgul_bdf_glyph * | cgul_bdf_glyph_t |
Each instance of this class is one glyph from a BDF font file. It is an integral part of the cgul_bdf class.
| typedef typedefCGUL_BEGIN_C struct cgul_bdf_glyph* cgul_bdf_glyph_t |
Opaque reference to a cgul_bdf_glyph instance.
| CGUL_EXPORT cgul_bdf_glyph_t cgul_bdf_glyph__new | ( | cgul_exception_t * | cex | ) |
This method creates a new cgul_bdf_glyph object. The caller is responsible for calling cgul_bdf_glyph__delete() on the pointer returned. If memory cannot be allocated, NULL is returned, and an exception is thrown.
| [in,out] | cex | c-style exception |
| CGUL_EXPORT void cgul_bdf_glyph__delete | ( | cgul_bdf_glyph_t | glyph | ) |
This method deletes the glyph object freeing all internally allocated resources. After calling this method, glyph should no longer be dereferenced.
| [in] | glyph | cgul_bdf_glyph instance |
| CGUL_EXPORT void cgul_bdf_glyph__copy | ( | cgul_exception_t * | cex, |
| cgul_bdf_glyph_t | dst, | ||
| cgul_bdf_glyph_t | src | ||
| ) |
This method does a deep copy of src to dst. If an error occurs, an exception is thrown, and dst will be in an undefined state.
| [in,out] | cex | c-style exception |
| [in] | dst | destination glyph |
| [in] | src | source glyph |
Referenced by cgul_bdf_glyph_cxx::copy().
| CGUL_EXPORT const char* cgul_bdf_glyph__get_descriptive_name | ( | cgul_exception_t * | cex, |
| cgul_bdf_glyph_t | glyph | ||
| ) |
This method returns the descriptive name for the character. This is the name that belongs on the STARTCHAR line. If no descriptive name is available, NULL is returned. Thus, it is important that you always check the return value. The pointer returned belongs to this class and should not be altered or freed.
| [in] | cex | c-style exception |
| [in] | glyph | cgul_bdf_glyph instance |
NULL Referenced by cgul_bdf_glyph_cxx::get_descriptive_name().
| CGUL_EXPORT cgul_wchar_t cgul_bdf_glyph__get_encoding | ( | cgul_exception_t * | cex, |
| cgul_bdf_glyph_t | glyph | ||
| ) |
Get the encoding.
| [in] | cex | c-style exception |
| [in] | glyph | cgul_bdf_glyph instance |
Referenced by cgul_bdf_glyph_cxx::get_encoding().
| CGUL_EXPORT unsigned int cgul_bdf_glyph__get_ascent | ( | cgul_exception_t * | cex, |
| cgul_bdf_glyph_t | glyph | ||
| ) |
Get the ascent for the glyph. This is a value derived from the glyph's bounding box.
| [in] | cex | c-style exception |
| [in] | glyph | cgul_bdf_glyph instance |
Referenced by cgul_bdf_glyph_cxx::get_ascent().
| CGUL_EXPORT unsigned int cgul_bdf_glyph__get_descent | ( | cgul_exception_t * | cex, |
| cgul_bdf_glyph_t | glyph | ||
| ) |
Get the descent for the glyph. This is a value derived from the glyph's bounding box.
| [in] | cex | c-style exception |
| [in] | glyph | cgul_bdf_glyph instance |
Referenced by cgul_bdf_glyph_cxx::get_descent().
| CGUL_EXPORT unsigned int cgul_bdf_glyph__get_swidth_x | ( | cgul_exception_t * | cex, |
| cgul_bdf_glyph_t | glyph | ||
| ) |
Get the scalable width in the x-direction.
| [in] | cex | c-style exception |
| [in] | glyph | cgul_bdf_glyph instance |
Referenced by cgul_bdf_glyph_cxx::get_swidth_x().
| CGUL_EXPORT unsigned int cgul_bdf_glyph__get_swidth_y | ( | cgul_exception_t * | cex, |
| cgul_bdf_glyph_t | glyph | ||
| ) |
Get the scalable width in the y-direction.
| [in] | cex | c-style exception |
| [in] | glyph | cgul_bdf_glyph instance |
Referenced by cgul_bdf_glyph_cxx::get_swidth_y().
| CGUL_EXPORT unsigned int cgul_bdf_glyph__get_dwidth_x | ( | cgul_exception_t * | cex, |
| cgul_bdf_glyph_t | glyph | ||
| ) |
Get the device width in the x-direction.
| [in] | cex | c-style exception |
| [in] | glyph | cgul_bdf_glyph instance |
Referenced by cgul_bdf_glyph_cxx::get_dwidth_x().
| CGUL_EXPORT unsigned int cgul_bdf_glyph__get_dwidth_y | ( | cgul_exception_t * | cex, |
| cgul_bdf_glyph_t | glyph | ||
| ) |
Get the device width in the y-direction.
| [in] | cex | c-style exception |
| [in] | glyph | cgul_bdf_glyph instance |
Referenced by cgul_bdf_glyph_cxx::get_dwidth_y().
| CGUL_EXPORT unsigned int cgul_bdf_glyph__get_bb_width | ( | cgul_exception_t * | cex, |
| cgul_bdf_glyph_t | glyph | ||
| ) |
Get the width of the glyph's bounding box.
| [in] | cex | c-style exception |
| [in] | glyph | cgul_bdf_glyph instance |
Referenced by cgul_bdf_glyph_cxx::get_bb_width().
| CGUL_EXPORT unsigned int cgul_bdf_glyph__get_bb_height | ( | cgul_exception_t * | cex, |
| cgul_bdf_glyph_t | glyph | ||
| ) |
Get the height of the glyph's bounding box.
| [in] | cex | c-style exception |
| [in] | glyph | cgul_bdf_glyph instance |
Referenced by cgul_bdf_glyph_cxx::get_bb_height().
| CGUL_EXPORT int cgul_bdf_glyph__get_bb_x_offset | ( | cgul_exception_t * | cex, |
| cgul_bdf_glyph_t | glyph | ||
| ) |
Get the x-offset of the lower-left corner of the glyph's bounding box.
| [in] | cex | c-style exception |
| [in] | glyph | cgul_bdf_glyph instance |
Referenced by cgul_bdf_glyph_cxx::get_bb_x_offset().
| CGUL_EXPORT int cgul_bdf_glyph__get_bb_y_offset | ( | cgul_exception_t * | cex, |
| cgul_bdf_glyph_t | glyph | ||
| ) |
Get the y-offset of the lower-left corner of the glyph's bounding box.
| [in] | cex | c-style exception |
| [in] | glyph | cgul_bdf_glyph instance |
Referenced by cgul_bdf_glyph_cxx::get_bb_y_offset().
| CGUL_EXPORT int cgul_bdf_glyph__get_dot | ( | cgul_exception_t * | cex, |
| cgul_bdf_glyph_t | glyph, | ||
| unsigned int | x, | ||
| unsigned int | y | ||
| ) |
This method returns true if the dot at (x,y) inside the bounding box should be drawn. The x- and y-coordinates are relative to the top-left corner of the glyph's bounding box, not the top-left corner of the glyph itself. Also note that x and y values start with zero, not one.
NOTE: There is a cgul_bdf_glyph__set_dot() method in the private header.
| [in] | cex | c-style exception |
| [in] | glyph | cgul_bdf_glyph instance |
| [in] | x | x-coordinate |
| [in] | y | y-coordinate |
Referenced by cgul_bdf_glyph_cxx::get_dot().
| CGUL_EXPORT size_t cgul_bdf_glyph__get_bytes_wide | ( | cgul_exception_t * | cex, |
| cgul_bdf_glyph_t | glyph | ||
| ) |
Get the width of the glyph in bytes. Remember that the data is a bitmap so it is packed with 8 pixels per byte.
| [in] | cex | c-style exception |
| [in] | glyph | cgul_bdf_glyph instance |
Referenced by cgul_bdf_glyph_cxx::get_bytes_wide().
| CGUL_EXPORT unsigned long cgul_bdf_glyph__get_file_offset | ( | cgul_exception_t * | cex, |
| cgul_bdf_glyph_t | glyph | ||
| ) |
Get the file offset of the STARTCHAR line that describes this glyph in the BDF. This information is used to generate the *.bdfi index file so that the glyph can be loaded on demand.
| [in] | cex | c-style exception |
| [in] | glyph | cgul_bdf_glyph instance |
| CGUL_EXPORT void cgul_bdf_glyph__append_bitmap_to_string | ( | cgul_exception_t * | cex, |
| cgul_bdf_glyph_t | glyph, | ||
| cgul_string_t | s | ||
| ) |
This method appends the bitmap of glyph as a character sequence of hex digits to the string s. The appended character sequence can be used as the data in the BITMAP section of a BDF file. If an error occurs, an exception is thrown.
| [in,out] | cex | c-style exception |
| [in] | glyph | cgul_bdf_glyph instance |
| [in] | s | string |
Referenced by cgul_bdf_glyph_cxx::append_bitmap_to_string().
| CGUL_EXPORT void cgul_bdf_glyph__write_file | ( | cgul_exception_t * | cex, |
| cgul_bdf_glyph_t | glyph, | ||
| FILE * | f | ||
| ) |
Write the string representation of glyph to f. This is different from cgul_bdf_glyph__fdraw() in that it produces a valid snippet of BDF that can be used as the entire STARTCHAR ... ENDCHAR section.
| [in,out] | cex | c-style exception |
| [in] | glyph | cgul_bdf_glyph instance |
| [in] | f | file |
Referenced by cgul_bdf_glyph_cxx::write_file().
| CGUL_EXPORT void cgul_bdf_glyph__fdraw | ( | cgul_exception_t * | cex, |
| cgul_bdf_glyph_t | glyph, | ||
| FILE * | f, | ||
| const char * | prefix, | ||
| const char * | suffix, | ||
| char | c_active, | ||
| char | c_inactive | ||
| ) |
This method appends an ASCII image of the glyph to the file f. The image only shows the part of the glyph that is in the bounding box. Each active pixel is represented by the character c_active. Each inactive pixel is represented by c_inactive. If prefix is not NULL, it will be prefixed to each scan line. If suffix is not NULL, it will be appended to each scan line. If an error occurs, an exception is thrown.
| [in,out] | cex | c-style exception |
| [in] | glyph | cgul_bdf_glyph instance |
| [in] | f | file |
| [in] | prefix | prefix for each scan line |
| [in] | suffix | suffix for each scan line |
| [in] | c_active | active character |
| [in] | c_inactive | inactive character |
Referenced by cgul_bdf_glyph_cxx::fdraw().
| CGUL_EXPORT void cgul_bdf_glyph__sdraw | ( | cgul_exception_t * | cex, |
| cgul_bdf_glyph_t | glyph, | ||
| cgul_string_t | s, | ||
| const char * | prefix, | ||
| const char * | suffix, | ||
| char | c_active, | ||
| char | c_inactive | ||
| ) |
This method appends an ASCII image of the glyph to the string s. The image only shows the part of the glyph that is in the bounding box. Each active pixel is represented by the character c_active. Each inactive pixel is represented by c_inactive. If prefix is not NULL, it will be prefixed to each scan line. If suffix is not NULL, it will be appended to each scan line. If an error occurs, an exception is thrown.
| [in,out] | cex | c-style exception |
| [in] | glyph | cgul_bdf_glyph instance |
| [in,out] | s | string |
| [in] | prefix | prefix for each scan line |
| [in] | suffix | suffix for each scan line |
| [in] | c_active | active character |
| [in] | c_inactive | inactive character |
Referenced by cgul_bdf_glyph_cxx::sdraw().