X11 Work Bench Toolkit  1.0
font_helper.h File Reference

Definition file for font helper functions and structures. More...

Go to the source code of this file.

Macros

#define WB_TEXT_EXTENTS   Xutf8TextExtents
 
#define WB_TEXT_ESCAPEMENT   Xutf8TextEscapement
 
#define WB_DRAW_STRING   Xutf8DrawString
 
#define WB_DRAW_TEXT   Xutf8DrawText
 
#define WB_LOOKUP_STRING   Xutf8LookupString
 

Enumerations

enum  WBFontFlags {
  WBFontFlag_PITCH_FIXED = 1, WBFontFlag_PITCH_VARIABLE = 2, WBFontFlag_PITCH_CONDENSED = 4, WBFontFlag_PITCH_ANY = 0,
  WBFontFlag_PITCH_MASK = 7, WBFontFlag_STYLE_SANS = 8, WBFontFlag_STYLE_SERIF = 0x10, WBFontFlag_Reserved20 = 0x20,
  WBFontFlag_Reserved40 = 0x40, WBFontFlag_STYLE_ANY = 0, WBFontFlag_STYLE_MASK = 0x78, WBFontFlag_RASTER = 0x80,
  WBFontFlag_FREETYPE = 0x100, WBFontFlag_Reserved200 = 0x200, WBFontFlag_FNDRY_ANY = 0, WBFontFlag_FNDRY_MASK = 0x380,
  WBFontFlag_SIZE_PIXELS = 0, WBFontFlag_SIZE_POINTS = 0x400, WBFontFlag_SIZE_TWIPS = 0x800, WBFontFlag_SIZE_Reserved = 0xc00,
  WBFontFlag_SIZE_MASK = 0xc00, WBFontFlag_WT_ANY = 0, WBFontFlag_WT_REGULAR = 0x1000, WBFontFlag_WT_MEDIUM = 0x2000,
  WBFontFlag_WT_DEMIBOLD = 0x3000, WBFontFlag_WT_BOLD = 0x4000, WBFontFlag_WT_Reserved5 = 0x5000, WBFontFlag_WT_Reserved6 = 0x6000,
  WBFontFlag_WT_MASK = 0x7000, WBFontFlag_SLANT_REGULAR = 0x10000, WBFontFlag_SLANT_OBLIQUE = 0x20000, WBFontFlag_SLANT_ITALIC = 0x30000,
  WBFontFlag_SLANT_ANY = 0, WBFontFlag_SLANT_MASK = 0x30000, WBFontFlag_WIDTH_NORMAL = 0x40000, WBFontFlag_WIDTH_SEMICOND = 0x80000,
  WBFontFlag_WIDTH_Reserved = 0xc0000, WBFontFlag_WIDTH_ANY = 0, WBFontFlag_WIDTH_MASK = 0xc0000, WBFontFlag_REG_ISO8859 = 0x100000,
  WBFontFlag_REG_ISO646_1991 = 0x200000, WBFontFlag_REG_ASCII = 0x300000, WBFontFlag_REG_FNTSPECIFIC = 0x400000, WBFontFlag_REG_MISC = 0x500000,
  WBFontFlag_REG_GB2312_1980 = 0x600000, WBFontFlag_REG_ADOBE = 0x700000, WBFontFlag_REG_Reserved8 = 0x800000, WBFontFlag_REG_Reserved9 = 0x900000,
  WBFontFlag_REG_ReservedA = 0xa00000, WBFontFlag_REG_ReservedB = 0xb00000, WBFontFlag_REG_ReservedC = 0xc00000, WBFontFlag_REG_ReservedD = 0xd00000,
  WBFontFlag_REG_ReservedE = 0xe00000, WBFontFlag_REG_ReservedF = 0xf00000, WBFontFlag_REG_MASK = 0xf00000, WBFontFlag_WHATEVER = 0
}
 Font 'flag' enumeration. More...
 

Functions

XFontStruct * WBCopyFont (XFontStruct *pFont)
 make a copy of an existing font (best when assigning to a window) More...
 
XFontStruct * WBLoadFont (Display *pDisplay, const char *szFontName, int iFontSize, int iFlags)
 load a font based on a font name, size, and font flags More...
 
XFontStruct * WBLoadModifyFont (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 WBFontAvgCharWidth (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 WBTextWidth (XFontSet fontSet, const char *szText, int cbText)
 Obtain the pixel width of specified text for a specified XFontSet. More...
 
void WBDumpFontInfo (const char *pSpec)
 Dump debug information about fonts according to pSpec. More...
 

Detailed Description

Definition file for font helper functions and structures.

This is the definition file for font helper functions and structures, designed to SPECIFICALY work with 'X11 Core' fonts and rendering. Compatibility and support for 'Xft' fonts and rendering is currently 'reserved for future implementation'. 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.

The font_helper uses the 'classic' X11 fonts. If you need true-type fonts, you will need to use the Xft interface from the 'FreeType' library to load and render them. Xft uses a completely different font set than the ones provided by the 'classic' font interface.

Definition in file font_helper.h.