X11workbench Toolkit
1.0
|
Functions | |
XFontStruct * | WBLoadFontX (Display *pDisplay, const char *szFontName, int iFontSize, int iFlags) |
load a font based on a font name, size, and font flags More... | |
XFontStruct * | WBCopyFontX (XFontStruct *pFont) |
make a copy of an existing font (best when assigning to a window) More... | |
XFontStruct * | WBLoadModifyFontX (Display *pDisplay, const XFontStruct *pOriginal, int iFontSize, int iFlags) |
load and modify a font according to the specified size and flags More... | |
XFontSet | WBCopyModifyFontSet (Display *pDisplay, XFontSet fsOrig, int iFontSize, int iFlags) |
copy and modify a font set according to the specified size and flags More... | |
int | WBFontAvgCharWidthX (Display *pDisplay, const XFontStruct *pFont) |
Get the average character width for a font. More... | |
int | WBFontSetDescent (Display *pDisplay, XFontSet fontSet) |
Get the maximum character descent from a font set. More... | |
int | WBFontSetAscent (Display *pDisplay, XFontSet fontSet) |
Get the maximum character ascent from a font set. More... | |
int | WBFontSetHeight (Display *pDisplay, XFontSet fontSet) |
Get the maximum character height from a font set. More... | |
int | WBFontSetAvgCharWidth (Display *pDisplay, XFontSet fontSet) |
Get the average character width for a font set. More... | |
XCharStruct | WBFontSetMaxBounds (Display *pDisplay, XFontSet fontSet) |
Get a 'maximized' copy of the 'max_bounds' member for the font set. More... | |
XFontSet | WBFontSetFromFont (Display *pDisplay, const XFontStruct *pFont) |
Creates an 'XFontSet' from an XFontStruct for a given display. More... | |
XFontStruct * | WBFontFromFontSet (Display *pDisplay, XFontSet fontSet) |
Creates an 'XFontStruct' from the first font assigned to a Font Set. More... | |
XFontSet | WBFontSetFromFontSingle (Display *pDisplay, const XFontStruct *pFont) |
Creates an 'XFontSet' from an XFontStruct for a given display, with only a single font in the set. More... | |
int | WBTextWidthX (XFontSet fontSet, const char *szText, int cbText) |
Obtain the pixel width of specified text for a specified XFontSet. More... | |
void | WBTextExtentX (XFontSet fontSet, const char *szText, int cbText, WB_EXTENT *pExtent) |
Obtain the pixel extent of specified text for a specified XFontSet. More... | |
GC Utility functions for legacy (X11) font selection and modification
These are the LEGACY definitions for font helper functions and structures, designed to SPECIFICALY work with 'X11 Core' fonts and rendering. Fonts under X11 (core) are generally difficult to deal with. These utility functions allow you to more easily select a font based on an existing font or a general description of a font, with 'fuzzy' matching.
Additionally there is support for creating 'Font Sets' for use with Xmb, Xwc, and Xutf8 versions of 'Core' text rendering APIs.
XFontStruct* WBCopyFontX | ( | XFontStruct * | pFont | ) |
make a copy of an existing font (best when assigning to a window)
pFont | The original font to be copied |
use this function to make a copy of an existing XFontStruct.
On error this function returns NULL. The caller must free non-NULL return values via XFreeFont()
Header File: font_helper.h
Definition at line 106 of file font_legacy.c.
XFontSet WBCopyModifyFontSet | ( | Display * | pDisplay, |
XFontSet | fsOrig, | ||
int | iFontSize, | ||
int | iFlags | ||
) |
copy and modify a font set according to the specified size and flags
pDisplay | A pointer to the display |
fsOrig | The original font set on which to base the new font set |
iFontSize | The font size (see WBLoadFont() for more details) For a non-zero value, the font size is based on the WBFontFlag_SIZE_xxx flag specified in 'iFlags' An 'iFontSize' value of ZERO copies the font size from the original font specified in 'pOriginal'. |
iFlags | Various WBFontFlags that specify font characteristics. The existing font is modified according to these flags. If the font size is zero, flags that modify the font size will be ignored. |
use this function to select a similar font that differs only by whatever is specified in 'iFontSize' or 'iFlags'. If a matching font is NOT available, a copy of the original font will be returned. Typical use is to 'bold' or 'italicize' an existing font.
The returned value (if not None) will need to be free'd using XFreeFontSet()
Header File: font_helper.h
Definition at line 1359 of file font_legacy.c.
int WBFontAvgCharWidthX | ( | Display * | pDisplay, |
const XFontStruct * | pFont | ||
) |
Get the average character width for a font.
pDisplay | A pointer to the Display ( NULL uses WBGetDefaultDisplay() ) |
pFont | A pointer to an XFontStruct |
Use this function to query an XFontStruct about its average character width.
Definition at line 912 of file font_legacy.c.
XFontStruct* WBFontFromFontSet | ( | Display * | pDisplay, |
XFontSet | fontSet | ||
) |
Creates an 'XFontStruct' from the first font assigned to a Font Set.
pDisplay | A pointer to the Display ( NULL uses WBGetDefaultDisplay() ) |
fontSet | An XFontSet (may not be 'None') |
This function helps to The returned value (if not NULL) will need to be free'd using XFreeFont()
Header File: font_helper.h
Definition at line 1866 of file font_legacy.c.
int WBFontSetAscent | ( | Display * | pDisplay, |
XFontSet | fontSet | ||
) |
Get the maximum character ascent from a font set.
pDisplay | A pointer to the Display ( NULL uses WBGetDefaultDisplay() ) |
fontSet | The Font Set to query ( None implies the system default font set) |
Use this function to query an XFontSet about its maximum ascent. This will typically be derived from all of the individual fonts in the font set.
Definition at line 1055 of file font_legacy.c.
int WBFontSetAvgCharWidth | ( | Display * | pDisplay, |
XFontSet | fontSet | ||
) |
Get the average character width for a font set.
pDisplay | A pointer to the Display ( NULL uses WBGetDefaultDisplay() ) |
fontSet | The Font Set to query ( None implies the system default font set) |
Use this function to query an XFontSet about its average character width. This will typically be derived from all of the individual fonts in the font set.
Definition at line 1146 of file font_legacy.c.
int WBFontSetDescent | ( | Display * | pDisplay, |
XFontSet | fontSet | ||
) |
Get the maximum character descent from a font set.
pDisplay | A pointer to the Display ( NULL uses WBGetDefaultDisplay() ) |
fontSet | The Font Set to query ( None implies the system default font set) |
Use this function to query an XFontSet about its maximum descent. This will typically be derived from all of the individual fonts in the font set.
Definition at line 1013 of file font_legacy.c.
XFontSet WBFontSetFromFont | ( | Display * | pDisplay, |
const XFontStruct * | pFont | ||
) |
Creates an 'XFontSet' from an XFontStruct for a given display.
pDisplay | A pointer to the Display ( NULL uses WBGetDefaultDisplay() ) |
pFont | A pointer to an XFontStruct |
This function helps to support internationalization through use of the 'Xmb' 'Xwc' and 'Xutf8' versions of the X11 'core' text rendering API functions by creating an 'XFontSet' that matches all of the available character sets for a supplied font specification.
The returned value (if not None) will need to be free'd using XFreeFontSet()
Header File: font_helper.h
Definition at line 1579 of file font_legacy.c.
XFontSet WBFontSetFromFontSingle | ( | Display * | pDisplay, |
const XFontStruct * | pFont | ||
) |
Creates an 'XFontSet' from an XFontStruct for a given display, with only a single font in the set.
pDisplay | A pointer to the Display ( NULL uses WBGetDefaultDisplay() ) |
pFont | A pointer to an XFontStruct |
This function helps to support internationalization through use of the 'Xmb' 'Xwc' and 'Xutf8' versions of the X11 'core' text rendering API functions by creating an 'XFontSet' that matches all of the available character sets for a supplied font specification.
This function differs from WBFontSetFromFont() in that it only adds a SINGLE font to the font set, without any wildcard substitutions, and with a locale of "C".
The returned value (if not None) will need to be free'd using XFreeFontSet()
Header File: font_helper.h
Definition at line 1759 of file font_legacy.c.
int WBFontSetHeight | ( | Display * | pDisplay, |
XFontSet | fontSet | ||
) |
Get the maximum character height from a font set.
pDisplay | A pointer to the Display ( NULL uses WBGetDefaultDisplay() ) |
fontSet | The Font Set to query ( None implies the system default font set) |
Use this function to query an XFontSet about its maximum height.
Definition at line 1097 of file font_legacy.c.
XCharStruct WBFontSetMaxBounds | ( | Display * | pDisplay, |
XFontSet | fontSet | ||
) |
Get a 'maximized' copy of the 'max_bounds' member for the font set.
pDisplay | A pointer to the Display ( NULL uses WBGetDefaultDisplay() ) |
fontSet | The Font Set to query ( None implies the system default font set) |
Use this function to query an XFontSet about its maximum bounds. This will typically be derived from all of the individual fonts in the font set.
Definition at line 1206 of file font_legacy.c.
XFontStruct* WBLoadFontX | ( | Display * | pDisplay, |
const char * | szFontName, | ||
int | iFontSize, | ||
int | iFlags | ||
) |
load a font based on a font name, size, and font flags
pDisplay | A pointer to the display |
szFontName | A 0-byte terminated ASCII string specifying the desired font name |
iFontSize | The font size, > 0 for height, < 0 for width, 0 for 'do not care' the font size is based on the WBFontFlag_SIZE_xxx flag specified in 'iFlags' |
iFlags | Various WBFontFlags that specify font characteristics |
font mapping helper - uses size, italic, bold, 'flags' and font name to determine "the best font" based on a simple mapping algorithm.
negative 'iFontSize' is the average font width
Positive 'iFontSize' is the height (including ascend/descend)
A value of '0' is considered to be a 'wildcard' match. Use a positive 'iFontSize' for more precise font measurement.
On error this function returns NULL. The caller must free non-NULL return values via XFreeFont()
Header File: font_helper.h
Definition at line 772 of file font_legacy.c.
XFontStruct* WBLoadModifyFontX | ( | Display * | pDisplay, |
const XFontStruct * | pOriginal, | ||
int | iFontSize, | ||
int | iFlags | ||
) |
load and modify a font according to the specified size and flags
pDisplay | A pointer to the display |
pOriginal | The original font on which to base the new font |
iFontSize | The font size (see WBLoadFont() for more details) For a non-zero value, the font size is based on the WBFontFlag_SIZE_xxx flag specified in 'iFlags' An 'iFontSize' value of ZERO copies the font size from the original font specified in 'pOriginal'. |
iFlags | Various WBFontFlags that specify font characteristics. The existing font is modified according to these flags. If the font size is zero, flags that modify the font size will be ignored. |
use this function to select a similar font that differs only by whatever is specified in 'iFontSize' or 'iFlags'. If a matching font is NOT available, a copy of the original font will be returned. Typical use is to 'bold' or 'italicize' an existing font.
On error this function returns NULL. The caller must free non-NULL return values via XFreeFont()
Header File: font_helper.h
Definition at line 1269 of file font_legacy.c.
void WBTextExtentX | ( | XFontSet | fontSet, |
const char * | szText, | ||
int | cbText, | ||
WB_EXTENT * | pExtent | ||
) |
Obtain the pixel extent of specified text for a specified XFontSet.
fontSet | An XFontSet, as returned by WBFontSetFromFont (or similar) |
szText | A (const) pointer to a Multi-Byte (or UTF8 string) string |
cbText | The total length of the text pointed to by szText (negative value to use a zero-byte terminator) |
pExtent | A pointer to a WB_EXTENT structure that receives the text extent. This will be the logical text extent, for spacing purposes |
Use this function to determine the correct 'display' width and height of a UTF8 or Multi-Byte character string. It calculates the 'logical' extent using either XmbTextExtents() or Xutf8TextExtents() (as applicable) and returns the width/height of the bounding rectangle for the text.
Header File: font_helper.h
Definition at line 1941 of file font_legacy.c.
int WBTextWidthX | ( | XFontSet | fontSet, |
const char * | szText, | ||
int | cbText | ||
) |
Obtain the pixel width of specified text for a specified XFontSet.
fontSet | An XFontSet, as returned by WBFontSetFromFont (or similar) |
szText | A (const) pointer to a Multi-Byte (or UTF8 string) string |
cbText | The total length of the text pointed to by szText (negative value to use a zero-byte terminator) |
Use this function to determine the correct 'display' width of a UTF8 or Multi-Byte character string.
Header File: font_helper.h
Definition at line 1906 of file font_legacy.c.