Main Page   Modules   Alphabetical List   Compound List   File List   Compound Members   File Members  

PSFontList

PS Font List. More...

Compounds

struct  psFont
struct  psFontType
struct  psXFont

Typedefs

typedef struct psFont  PSFont
 Typedef for struct psFont.

typedef struct psFontType  PSFontType
 Typedef for struct psFontType.

typedef struct psXFont  PSXFont
 Typedef for struct psXFont.


Functions

PSFontpsFontAlloc (void)
 Allocates and initializes a new psFont structure. More...

PSFontpsFontCalloc (int count)
 Allocates and initializes count new psFont structures. More...

void psFontFree (PSFont* font)
 Frees up a psFont structure. More...

void psFontListSetPath (char *path)
 Sets the font path (psFontPath) to path. More...

char* psFontListGetPath (void)
 Gets a pointer to the current font path. More...

void psFontListAppendPath (char *dir)
 Appends a directory to the current font path. More...

void psFontListFreePath (void)
 Frees up memory used by the font path. More...

int psFontListLoad (int flags, void(*statusFunc)(char* msg))
 Builds psFontList by scanning the directories in psFontPath for valid fonts. More...

void psFontListFree ()
 Frees up the font list. More...

PSFontpsFontListLookupByFontName (char *fontName)
 Looks up an entry in the font list matching fontName. More...

PSFontpsFontListLookupByFontFamily (char *fontFamily)
 Looks up an entry in the font list matching fontFamily. More...

PSFontpsFontListLookupByXLFD (char *xlfd)
 Looks up an entry in the font list matching xlfd. More...

PSFontpsFontListLookupByFontFileName (char *fontFileName)
 Lookup an entry in the font list matching fontFileName. More...

double psFontGetTextWidth (PSFont* font, char *text)
 Calculates width of text for font. More...

char* psXFontGetWeightName (int weight)
 Gets readable/printable name for X font weight. More...

char* psXFontGetSlantName (int slant)
 Gets readable/printable name for X font slant. More...

char* psXFontGetWidthName (int width)
 Gets readable/printable name for X font width. More...

char* psXFontGetSpacingName (int spacing)
 Gets readable/printable name for X font spacing. More...

PSXFontpsXFontAlloc (void)
 Allocate and initialize a psXFont structure. More...

void psXFontFree (PSXFont* xfont)
 Frees up a psXFont structure. More...

void psXFontSet (PSXFont *xfont, char *xlfd)
 Sets values in xfont by parsing xlfd. More...

char* psXFontGetXLFD (PSXFont* xfont)
 Generates an XLFD from a psXFont structure. More...

int psXFontMatch (PSXFont* f1, PSXFont* f2)
 Compares to PSXfont's. More...


Variables

char* psWeightNames []
 Table of printable names for font weights. More...

char* psWidthNames []
 Table of printable names for font widths. More...

PSFontType psFontTypes []
 Table to map font file extentions to font types. More...

PSListpsFontList = NULL
 Global list of available fonts. More...


Detailed Description

PS Font List.


Function Documentation

PSFont * psFontAlloc ( void )
 

Allocates and initializes a new psFont structure.

Returns:
a pointer to the newly allocated structure on sucesss or NULL on failure.

PSFont * psFontCalloc ( int count )
 

Allocates and initializes count new psFont structures.

Parameters:
count   number of psFont structures to allocate.

Returns:
a pointer the newly allocated structures on success or NULL on failure.

void psFontFree ( PSFont * font )
 

Frees up a psFont structure.

Parameters:
font   pointer to psFont structure to free.

Returns:
nothing.

double psFontGetTextWidth ( PSFont * font,
char * text )
 

Calculates width of text for font.

Parameters:
font   pointer to the desired psFont structure.
text   pointer to string to get width of.

Returns:
the width of text in 1000/ths of a point.

void psFontListAppendPath ( char * dir )
 

Appends a directory to the current font path.

Returns:
nothing.

void psFontListFree ( )
 

Frees up the font list.

Returns:
nothing.

void psFontListFreePath ( void )
 

Frees up memory used by the font path.

char * psFontListGetPath ( void )
 

Gets a pointer to the current font path.

Returns:
a pointer to the current font path.

int psFontListLoad ( int flags,
void(* statusFunc)(char *msg) )
 

Builds psFontList by scanning the directories in psFontPath for valid fonts.

This must be called any time the font path is changed.

Parameters:
statusFunc   pointer to function to be called as each font is scanned. Set to NULL if not desired.

Returns:
non-zero on success or 0 on failure and sets pserrno.

PSFont * psFontListLookupByFontFamily ( char * fontFamily )
 

Looks up an entry in the font list matching fontFamily.

Parameters:
fontFamily   pointer to string containing the family of the font to lookup.

Returns:
a pointer to the entry if found or NULL if not.

PSFont * psFontListLookupByFontFileName ( char * fontFileName )
 

Lookup an entry in the font list matching fontFileName.

Parameters:
fontFileName   a pointer to a string containing the exact file name of the font.

Returns:
a pointer to the entry if found or NULL if not.

PSFont * psFontListLookupByFontName ( char * fontName )
 

Looks up an entry in the font list matching fontName.

Parameters:
fontName   pointer to string containing the name of the font to lookup.

Returns:
a pointer to the entry if found or NULL if not.

PSFont * psFontListLookupByXLFD ( char * xlfd )
 

Looks up an entry in the font list matching xlfd.

Parameters:
xlfd   pointer to string containing the X font spec of the font to lookup.

Returns:
a pointer to the entry if found or NULL if not.

void psFontListSetPath ( char * path )
 

Sets the font path (psFontPath) to path.

Makes a copy of path.

Parameters:
path   pointer to new font path.

Returns:
nothing.

PSXFont * psXFontAlloc ( void )
 

Allocate and initialize a psXFont structure.

Returns:
a pointer to the newly allocated structure on success or NULL on failure.

void psXFontFree ( PSXFont * xfont )
 

Frees up a psXFont structure.

Returns:
nothing.

char * psXFontGetSlantName ( int slant )
 

Gets readable/printable name for X font slant.

Returns:
a pointer to a static string.

char * psXFontGetSpacingName ( int spacing )
 

Gets readable/printable name for X font spacing.

Returns:
a pointer to a static string.

char * psXFontGetWeightName ( int weight )
 

Gets readable/printable name for X font weight.

Returns:
a pointer to a static string.

char * psXFontGetWidthName ( int width )
 

Gets readable/printable name for X font width.

Returns:
a pointer to a static string.

char * psXFontGetXLFD ( PSXFont * xfont )
 

Generates an XLFD from a psXFont structure.

Parameters:
xfont   pointer to psXFont structure.

Returns:
a pointer to the generated XLFD on success (which should be freed using free()) or NULL on failure.

int psXFontMatch ( PSXFont * f1,
PSXFont * f2 )
 

Compares to PSXfont's.

Two PSXFonts match if the foundry, family, weight, slant, width, spacing and encoding match, ignoring all other fields.

Parameters:
f1   pointer to font 1.
f2   pointer to font 2.

Returns:
non-zero if the fonts match or 0 if not.

void psXFontSet ( PSXFont * xfont,
char * xlfd )
 

Sets values in xfont by parsing xlfd.

Parameters:
xfont   pointer to psXFont structure.
xlfd   pointer to string containing an XLFD.

Returns:
nothing.


Variable Documentation

PSList * psFontList = NULL
 

Global list of available fonts.

Built by scanning the directories in psFontPath with psFontListLoad().

PSFontType psFontTypes[]
 

Initializer:

{
    { ".ttf", PS_FONTTYPE_TRUETYPE },
    { ".pfa", PS_FONTTYPE_PSTYPE1ALPHA },
    { ".pfb", PS_FONTTYPE_PSTYPE1BIN },
    { NULL, PS_FONTTYPE_UNKNOWN }
  }
Table to map font file extentions to font types.

char * psWeightNames[]
 

Initializer:

{
    "unknown",
    "thin",
    "extra-light",
    "light",
    "normal",
    "medium",
    "semi-bold",
    "bold",
    "extra-bold",
    "black"
  }
Table of printable names for font weights.

Index using the PS_FONT_WEIGHT_XXX defines.

char * psWidthNames[]
 

Initializer:

{
    "unknown",
    "ultra-condensed",
    "extra-condensed",
    "condensed",
    "semi-condensed",
    "normal",
    "semi-expanded",
    "expanded",
    "extra-expanded",
    "ultra-expanded"
  }
Table of printable names for font widths.

Index using the PS_FONT_WIDTH_XXX defines.


Generated at Mon Dec 11 22:46:31 2000 for Postscript Utility Library by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000