Main Page   Modules   Alphabetical List   Data Structures   File List   Data Fields   Related Pages  

Nano-X font API.
[Nano-X public API]

Functions for handling fonts and drawing text. More...

Functions

void GrGetFontInfo (GR_FONT_ID font, GR_FONT_INFO *fip)
 Gets information about a font.

void GrGetGCTextSize (GR_GC_ID gc, void *str, int count, GR_TEXTFLAGS flags, GR_SIZE *retwidth, GR_SIZE *retheight, GR_SIZE *retbase)
 Calculates the dimensions of a specified text string.

GR_FONT_ID GrCreateFont (GR_CHAR *name, GR_COORD height, GR_LOGFONT *plogfont)
 Attempts to locate a font with the desired attributes and returns a font ID number which can be used to refer to it.

void GrGetFontList (GR_FONTLIST ***fonts, int *numfonts)
 Returns an array of strings containing the names of available fonts and an integer that specifies the number of strings returned.

void GrFreeFontList (GR_FONTLIST ***fonts, int numfonts)
 Frees the specified font list array.

void GrSetFontSize (GR_FONT_ID fontid, GR_COORD size)
 Changes the size of the specified font to the specified size.

void GrSetFontRotation (GR_FONT_ID fontid, int tenthsdegrees)
 Changes the rotation of the specified font to the specified angle.

void GrSetFontAttr (GR_FONT_ID fontid, int setflags, int clrflags)
 Changes the attributes (GR_TFKERNING, GR_TFANTIALIAS, GR_TFUNDERLINE, etc.) of the specified font according to the set and clear mask arguments.

void GrDestroyFont (GR_FONT_ID fontid)
 Frees all resources associated with the specified font ID, and if the font is a non built in type and this is the last ID referring to it, unloads the font from memory.

void GrSetGCFont (GR_GC_ID gc, GR_FONT_ID font)
 Sets the font to be used for text drawing in the specified graphics context to the specified font ID.

void GrText (GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, void *str, GR_COUNT count, GR_TEXTFLAGS flags)
 Draws the specified text string at the specified position on the specified drawable using the specified graphics context and flags.


Detailed Description

Functions for handling fonts and drawing text.


Function Documentation

GR_FONT_ID GrCreateFont GR_CHAR *  name,
GR_COORD  height,
GR_LOGFONT *  plogfont
 

Attempts to locate a font with the desired attributes and returns a font ID number which can be used to refer to it.

If the plogfont argument is not NULL, the values in that structure will be used to choose a font. Otherwise, if the height is non zero, the built in font with the closest height to that specified will be used. If the height is zero, the built in font with the specified name will be used. If the desired font is not found, the first built in font will be returned as a last resort.

Parameters:
name string containing the name of a built in font to look for
height the desired height of the font
plogfont pointer to a LOGFONT structure
Returns:
a font ID number which can be used to refer to the font

void GrDestroyFont GR_FONT_ID  fontid  ) 
 

Frees all resources associated with the specified font ID, and if the font is a non built in type and this is the last ID referring to it, unloads the font from memory.

Parameters:
fontid the ID of the font to destroy

void GrFreeFontList GR_FONTLIST ***  fonts,
int  numfonts
 

Frees the specified font list array.

Parameters:
fonts Pointer to array returned by GrGetFontList().
numfonts The number of font names in the array.

void GrGetFontInfo GR_FONT_ID  font,
GR_FONT_INFO *  fip
 

Gets information about a font.

Parameters:
font The font ID to query.
fip Pointer to the GR_FONT_INFO structure to store the result.

void GrGetFontList GR_FONTLIST ***  fonts,
int *  numfonts
 

Returns an array of strings containing the names of available fonts and an integer that specifies the number of strings returned.

Parameters:
fonts pointer used to return an array of font names.
numfonts pointer used to return the number of names found.

void GrGetGCTextSize GR_GC_ID  gc,
void *  str,
int  count,
GR_TEXTFLAGS  flags,
GR_SIZE *  retwidth,
GR_SIZE *  retheight,
GR_SIZE *  retbase
 

Calculates the dimensions of a specified text string.

Uses the current font and flags in the specified graphics context. The count argument can be -1 if the string is null terminated.

Parameters:
gc The graphics context.
str Pointer to a text string.
count The length of the string.
flags Text rendering flags. (GR_TF*).
retwidth Pointer to the variable the width will be returned in.
retheight Pointer to the variable the height will be returned in.
retbase Pointer to the variable the baseline height will be returned in.

void GrSetFontAttr GR_FONT_ID  fontid,
int  setflags,
int  clrflags
 

Changes the attributes (GR_TFKERNING, GR_TFANTIALIAS, GR_TFUNDERLINE, etc.) of the specified font according to the set and clear mask arguments.

Parameters:
fontid the ID of the font to set the attributes of
setflags mask specifying attribute flags to set
clrflags mask specifying attribute flags to clear

void GrSetFontRotation GR_FONT_ID  fontid,
int  tenthdegrees
 

Changes the rotation of the specified font to the specified angle.

Parameters:
fontid the ID number of the font to rotate
tenthdegrees the angle to set the rotation to in tenths of a degree

void GrSetFontSize GR_FONT_ID  fontid,
GR_COORD  size
 

Changes the size of the specified font to the specified size.

Parameters:
fontid the ID number of the font to change the size of
size the size to change the font to

void GrSetGCFont GR_GC_ID  gc,
GR_FONT_ID  font
 

Sets the font to be used for text drawing in the specified graphics context to the specified font ID.

Parameters:
gc the ID of the graphics context to set the font of
font the ID of the font

void GrText GR_DRAW_ID  id,
GR_GC_ID  gc,
GR_COORD  x,
GR_COORD  y,
void *  str,
GR_COUNT  count,
GR_TEXTFLAGS  flags
 

Draws the specified text string at the specified position on the specified drawable using the specified graphics context and flags.

The default flags specify ASCII encoding and baseline alignment.

Parameters:
id the ID of the drawable to draw the text string onto
gc the ID of the graphics context to use when drawing the text string
x the X coordinate to draw the string at relative to the drawable
y the Y coordinate to draw the string at relative to the drawable
str the text string to draw
count the number of characters (not bytes) in the string
flags flags specifying text encoding, alignment, etc.


Generated on Sun May 18 21:03:07 2003 for Microwindows Nano-X API by doxygen1.3