66 #ifndef _FONT_HELPER_H_INCLUDED_ 67 #define _FONT_HELPER_H_INCLUDED_ 74 #ifdef X11WORKBENCH_TOOLKIT_HAVE_XFT 75 #include <X11/Xft/Xft.h> 76 #endif // X11WORKBENCH_TOOLKIT_HAVE_XFT 78 #ifndef _WINDOW_HELPER_H_INCLUDED_ 80 #endif // _WINDOW_HELPER_H_INCLUDED_ 97 #if defined(X_HAVE_UTF8_STRING) || defined(__DOXYGEN__) 99 #define WB_TEXT_EXTENTS Xutf8TextExtents 100 #define WB_TEXT_ESCAPEMENT Xutf8TextEscapement 101 #define WB_DRAW_STRING Xutf8DrawString 102 #define WB_DRAW_TEXT Xutf8DrawText 103 #define WB_LOOKUP_STRING Xutf8LookupString 105 #else // X_HAVE_UTF8_STRING 107 #warning UTF8 not supported, using 'MB' equivalents 109 #define WB_TEXT_EXTENTS XmbTextExtents 110 #define WB_TEXT_ESCAPEMENT XmbTextEscapement 111 #define WB_DRAW_STRING XmbDrawString 112 #define WB_DRAW_TEXT XmbDrawText 113 #define WB_LOOKUP_STRING XmbLookupString 115 #endif // X_HAVE_UTF8_STRING 163 #ifdef X11WORKBENCH_TOOLKIT_HAVE_XFT 165 XftFontInfo *pxftFontInfo;
166 #endif // X11WORKBENCH_TOOLKIT_HAVE_XFT 216 char *szFoundry, *szFamily;
217 int iWeight, iSlant, iWidth;
219 int iPixelSize, iPointSize, iResX, iResY, iSpacing, iAvgWidth;
220 char *szRegistry, *szEncoding;
241 static void WBDumpFontSet(Display *pDisplay, XFontSet fontSet);
336 int iFontSize,
int iFlags);
361 int iFontSize,
int iFlags);
548 WBFontFlag_WHATEVER = 0
587 XFontStruct *
WBLoadFontX(Display *pDisplay,
const char *szFontName,
588 int iFontSize,
int iFlags);
628 int iFontSize,
int iFlags);
652 XFontSet
WBCopyModifyFontSet(Display *pDisplay, XFontSet fsOrig,
int iFontSize,
int iFlags);
808 int WBTextWidthX(XFontSet fontSet,
const char *szText,
int cbText);
830 #define WBDumpFontInfo(X) 852 #endif // __cplusplus 855 #endif // _FONT_HELPER_H_INCLUDED_ font size is in 'twips' (when font size > 0)
int iMaxCharWidth
RESERVED - cached max character width (-1 if not valid). do not access this directly.
use a font specific registry (mutually exclusive)
font size is in 'points' (when font size > 0)
void WBFontSetEnableAntiAlias(int bEnable)
returns non-zero value if certain fonts should be anti-aliased when rendered
void WBFreeFont(Display *pDisplay, WB_FONT pFont)
free a WB_FONT that was created using one of the WBFont APIs
void __internal_font_helper_exit(void)
un-initialization for font helper - call once at end of program (WBExit() does this for you)
int WBFontHeight(WB_FONTC pFont)
Get the maximum character height from a WB_FONT.
int WBFontAscent(WB_FONTC pFont)
Get the maximum character ascent from a WB_FONT.
XFontStruct * WBLoadModifyFontX(Display *pDisplay, const XFontStruct *pOriginal, int iFontSize, int iFlags)
load and modify a font according to the specified size and flags
bold font weight (mutually exclusive0
struct WBFont * pShareNext
RESERVED - next in a chain of WB_FONTs that share the same "stuff", NULL if this is a stand-alone cop...
condensed (alternate to 'fixed')
int WBFontAvgCharWidth(WB_FONTC pFont)
Get the average character width for a font.
reserved reg flag (reserved for future use)
reserved reg flag (reserved for future use)
WB_FONT WBCopyFont(Display *pDisplay, WB_FONTC pFont)
make a copy of an existing font (best when assigning to a window)
reserved flags for font size > 0
'oblique' slant (mutually exclusive)
XFontSet WBFontSetFromFont(Display *pDisplay, const XFontStruct *pFont)
Creates an 'XFontSet' from an XFontStruct for a given display.
semicondensed width (mutually exclusive)
WB_FONT WBCopyModifyFont(Display *pDisplay, WB_FONTC pOriginal, int iFontSize, int iFlags)
load and modify a font according to the specified size and flags
reserved reg flag (reserved for future use)
'Any' pitch (default, zero)
int iDescent
RESERVED - cached font descent (-1 if not valid). do not access this directly.
use ADOBE registry (mutually exclusive)
int WBFontSetAvgCharWidth(Display *pDisplay, XFontSet fontSet)
Get the average character width for a font set.
reserved reg flag (reserved for future use)
reserved reg flag (reserved for future use)
struct WBFont * WB_FONT
An allocated structure containing XFontStruct, XFontInfo, and XftFont [as applicable] for a specified...
WB_FONT WBLoadFont(Display *pDisplay, const char *szFontName, int iFontSize, int iFlags)
load a WB_FONT font object based on a font name, size, and font flags
use ADOBE registry - a lot of fonts use this (mutually exclusive)
medium font weight (mutually exclusive0
void WBTextExtentX(XFontSet fontSet, const char *szText, int cbText, WB_EXTENT *pExtent)
Obtain the pixel extent of specified text for a specified XFontSet.
int WBFontAvgCharWidthX(Display *pDisplay, const XFontStruct *pFont)
Get the average character width for a font.
Display * pDisplay
The Display pointer associated with this font (to be used internally)
int WBFontEnableAntiAlias(void)
returns non-zero value if certain fonts should be anti-aliased when rendered
XFontStruct * WBCopyFontX(XFontStruct *pFont)
make a copy of an existing font (best when assigning to a window)
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.
'regular' slant (mutually exclusive)
regular font weight (mutually exclusive0
font size is in 'pixels' (when font size > 0)
reserved reg flag (reserved for future use)
reserved font weight (6) (not currently in use)
static void WBDumpFontSet(Display *pDisplay, XFontSet fontSet)
debug function to dump font set members
XCharStruct max_bounds
RESERVED - cached max bounds (all 0's if not valid). do not access this directly.
use 'MISC' registry (mutually exclusive)
int WBFontSetHeight(Display *pDisplay, XFontSet fontSet)
Get the maximum character height from a font set.
normal width (mutually exclusive)
demi-bold font weight (mutually exclusive0
static void WBDumpMatchingFontNames(Display *pDisplay, const char *szFontName)
debug function to dump matching font names
XCharStruct WBFontMaxBounds(WB_FONTC pFont)
Get a 'maximized' copy of 'max_bounds' (applicable to all font faces in the WB_FONT)
int WBFontSetDescent(Display *pDisplay, XFontSet fontSet)
Get the maximum character descent from a font set.
Any font weight specification (mutually exclusive)
'size mask' for font size > 0
'italic' slant (mutually exclusive)
WBFontFlags
Font 'flag' enumeration.
force serif (i.e. 'not sans')
XFontSet fsFont
legacy 'XFontSet' for X11 raster fonts (UTF-8)
int iAvgCharWidth
RESERVED - cached average character width (-1 if not valid). do not access this directly.
'Any' foundry (default, zero)
int WBTextWidthX(XFontSet fontSet, const char *szText, int cbText)
Obtain the pixel width of specified text for a specified XFontSet.
struct WBFontInfo WB_FONT_INFO
Internal structure, caching font information (mostly for legacy font support)
use ISO646-1991 registry (mutually exclusive)
struct WBFont * pSharePrev
RESERVED - previous in a chain of WB_FONTs that share the same "stuff", NULL if this is a stand-alone...
internal wrapper struct for 'extent' definition
XFontStruct * pFontStruct
legacy 'XFontStruct' for X11 raster fonts
int WBFontDescent(WB_FONTC pFont)
Get the maximum character descent from a WB_FONT.
XFontStruct * WBFontFromFontSet(Display *pDisplay, XFontSet fontSet)
Creates an 'XFontStruct' from the first font assigned to a Font Set.
int WBTextWidth(WB_FONTC pFont, const char *szText, int cbText)
Obtain the pixel width of specified text for a specified WB_FONT.
XFontSet WBCopyModifyFontSet(Display *pDisplay, XFontSet fsOrig, int iFontSize, int iFlags)
copy and modify a font set according to the specified size and flags
int WBFontMaxCharWidth(WB_FONTC pFont)
Get the maximum character width for a font.
int iAscent
RESERVED - cached font ascent (-1 if not valid). do not access this directly.
Internal structure, caching font information (mostly for legacy font support)
void __internal_font_helper_init(void)
initialization for font helper - call once at start of program (WBInit() does this for you)
static void WBDumpFontStruct(const XFontStruct *pFont)
debug function to dump font struct members
'default' slant (zero; mutually exclusive; may return an italic or oblique font)
void WBDumpFontInfo(const char *pSpec)
Dump debug information about fonts according to pSpec.
An allocated structure containing XFontStruct, XFontInfo, and XftFont [as applicable] for a specified...
use ASCII registry (mutually exclusive)
'Any' width (zero; mutually exclusive)
reserved reg flag (reserved for future use)
const struct WBFont * WB_FONTC
a 'const' version of WB_FONT - note that this CAN actually be written to, so it's not truly 'const'.
'Any' style (default, zero)
void WBTextExtent(WB_FONTC pFont, const char *szText, int cbText, WB_EXTENT *pExtent)
Obtain the pixel extent of specified text for a specified XFontSet.
XCharStruct WBFontSetMaxBounds(Display *pDisplay, XFontSet fontSet)
Get a 'maximized' copy of the 'max_bounds' member for the font set.
int WBFontSetAscent(Display *pDisplay, XFontSet fontSet)
Get the maximum character ascent from a font set.
reserved reg flag (reserved for future use)
reserved font weight (5) (not currently in use)
XFontStruct * WBLoadFontX(Display *pDisplay, const char *szFontName, int iFontSize, int iFlags)
load a font based on a font name, size, and font flags
use ISO8859 registry (mutually exclusive)
int iHeight
RESERVED - cached font height (-1 if not valid). do not access this directly.