Font commandsCommands to create, manage and destroy fonts.
More...Functions
- void glcAppendFont (GLint inFont)
- void glcDeleteFont (GLint inFont)
- void glcFont (GLint inFont)
- GLboolean glcFontFace (GLint inFont, const GLCchar *inFace)
- void glcFontMap (GLint inFont, GLint inCode, const GLCchar *inCharName)
- GLint glcGenFontID (void)
- const GLCchar * glcGetFontFace (GLint inFont)
- const GLCchar * glcGetFontListc (GLint inFont, GLCenum inAttrib, GLint inIndex)
- const GLCchar * glcGetFontMap (GLint inFont, GLint inCode)
- const GLCchar * glcGetFontc (GLint inFont, GLCenum inAttrib)
- GLint glcGetFonti (GLint inFont, GLCenum inAttrib)
- GLboolean glcIsFont (GLint inFont)
- GLint glcNewFontFromMaster (GLint inFont, GLint inMaster)
- GLint glcNewFontFromFamily (GLint inFont, const GLCchar *inFamily)
Detailed Description
Commands to create, manage and destroy fonts.
A font is a stylistically consistent set of glyphs that can be used to render some set of characters. Each font has a family name (for example Palatino) and a state variable that selects one of the faces (for example Regular, Bold, Italic, BoldItalic) that the font contains. A typeface is the combination of a family and a face (for example Palatino Bold).
A font is an instantiation of a master for a given face.
Every font has an associated character map. A character map is a table of entries that maps integer values to the name string that identifies the characters. The character maps are used by GLC, for instance, to determine that the character code 65 corresponds to A. The character map of a font can be modified by either adding new entries or changing the mapping of the characters (see glcFontMap()).
GLC maintains two lists of fonts : GLC_FONT_LIST and GLC_CURRENT_FONT_LIST. The former contains every font that have been created with the commands glcNewFontFromFamily() and glcNewFontFromMaster() and the later contains the fonts that GLC can use when it renders a character (notice however that if GLC_AUTO_FONT is enabled, GLC may automatically add new fonts from GLC_FONT_LIST to the GLC_CURRENT_FONT_LIST ). Finally, it must be stressed that the order in which the fonts are stored in the GLC_CURRENT_FONT_LIST matters : the first font of the list should be considered as the main font with which strings are rendered, while other fonts of this list should be seen as fallback fonts (i.e. fonts that are used when the first font of GLC_CURRENT_FONT_LIST does not map the character to render).
Most of the commands in this category have a parameter inFont. Unless otherwise specified, these commands raise GLC_PARAMETER_ERROR if inFont is less than zero or is greater than or equal to the value of the variable GLC_FONT_COUNT.
Function Documentation
void glcAppendFont |
( |
GLint |
inFont |
) |
|
This command appends inFont to the list GLC_CURRENT_FONT_LIST.
The command raises GLC_PARAMETER_ERROR if inFont is not an element of the list GLC_FONT_LIST or if inFont is an element in the list GLC_CURRENT_FONT_LIST at the beginning of command execution. - Parameters:
-
| inFont | The ID of the font to append to the list GLC_CURRENT_FONT_LIST |
- See also:
- glcGetListc() with argument GLC_CURRENT_FONT_LIST
glcGeti() with argument GLC_CURRENT_FONT_COUNT
glcFont()
glcNewFontFromFamily()
glcNewFontFromMaster()
void glcDeleteFont |
( |
GLint |
inFont |
) |
|
This command deletes the font identified by inFont.
If inFont is an element in the list GLC_CURRENT_FONT_LIST, the command removes that element from the list.
The command raises GLC_PARAMETER_ERROR if inFont is not an element of the list GLC_FONT_LIST. - Parameters:
-
| inFont | The ID of the font to delete |
- See also:
- glcGetListi() with argument GLC_FONT_LIST
glcGeti() with argument GLC_FONT_COUNT
glcIsFont()
glcGenFontID()
glcNewFontFromFamily()
glcNewFontFromMaster()
void glcFont |
( |
GLint |
inFont |
) |
|
This command begins by removing all elements from the list GLC_CURRENT_FONT_LIST.
If inFont is nonzero, the command then appends inFont to the list. Otherwise, the command does not raise an error and the list remains empty.
The command raises GLC_PARAMETER_ERROR if inFont is nonzero and is not an element of the list GLC_FONT_LIST. - Parameters:
-
- See also:
- glcGetListc() with argument GLC_CURRENT_FONT_LIST
glcGeti() with argument GLC_CURRENT_FONT_COUNT
glcAppendFont()
GLboolean glcFontFace |
( |
GLint |
inFont, |
|
|
const GLCchar * |
inFace | |
|
) |
| | |
This command attempts to set the current face of the font identified by inFont to the face identified by the string inFace.
Examples for font faces are strings like "Normal" , "Bold" or "Bold Italic" . In contrast to some systems that have a different font for each face, GLC allows you to have the face be an attribute of the font.
If inFace is not an element of the font's string list attribute GLC_FACE_LIST, the command leaves the font's current face unchanged and returns GL_FALSE. If the command succeeds, it returns GL_TRUE.
If inFont is zero, the command iterates over the GLC_CURRENT_FONT_LIST. For each of the fonts named therein, the command attempts to set the font's current face to the face in that font that is identified by inFace. In this case, the command returns GL_TRUE if GLC_CURRENT_FONT_LIST contains one or more elements and the command successfully sets the current face of each of the fonts named in the list.
The command raises GLC_PARAMETER_ERROR if inFont is not an element in the list GLC_FONT_LIST. - Parameters:
-
| inFont | The ID of the font to be changed |
| inFace | The face for inFont |
- Returns:
- GL_TRUE if the command succeeded to set the face inFace to the font inFont. GL_FALSE is returned otherwise.
- See also:
- glcGetFontFace()
void glcFontMap |
( |
GLint |
inFont, |
|
|
GLint |
inCode, |
|
|
const GLCchar * |
inCharName | |
|
) |
| | |
This command modifies the character map of the font identified by inFont such that the font maps inCode to the character whose name is the string inCharName.
If inCharName is GLC_NONE, inCode is removed from the character map.
The command raises GLC_PARAMETER_ERROR if inCharName is not GLC_NONE or an element of the font string's list attribute GLC_CHAR_LIST. - Parameters:
-
| inFont | The ID of the font |
| inCode | The integer ID of a character |
| inCharName | The string name of a character |
- See also:
- glcGetFontMap()
GLint glcGenFontID |
( |
void |
|
) |
|
const GLCchar* glcGetFontFace |
( |
GLint |
inFont |
) |
|
This command returns the string name of the current face of the font identified by inFont.
- Parameters:
-
- Returns:
- The string name of the font inFont
- See also:
- glcFontFace()
const GLCchar* glcGetFontListc |
( |
GLint |
inFont, |
|
|
GLCenum |
inAttrib, |
|
|
GLint |
inIndex | |
|
) |
| | |
This command returns an attribute of the font identified by inFont that is a string from a string list identified by inAttrib.
The command returns the string at offset inIndex from the first element in inAttrib. For example, if inFont has a face list (Regular , Bold , Italic ) and inIndex is 2 , then the command returns Italic if you query GLC_FACE_LIST.
Every GLC state variable that is a list has an associated integer element count whose value is the number of elements in the list.
Below are the string list attributes associated with each GLC master and font and their element count attributes :
Master/font string list attributes
Name | Enumerant | Element count attribute |
GLC_CHAR_LIST | 0x0050 | GLC_CHAR_COUNT |
GLC_FACE_LIST | 0x0051 | GLC_FACE_COUNT |
The command raises GLC_PARAMETER_ERROR if inIndex is less than zero or is greater than or equal to the value of the list element count attribute. - Parameters:
-
| inFont | The font ID |
| inAttrib | The string list from which a string is requested |
| inIndex | The offset from the first element of the list associated with inAttrib |
- Returns:
- A string attribute of inFont identified by inAttrib
- See also:
- glcGetMasterListc()
glcGetFontc()
glcGetFonti()
const GLCchar* glcGetFontMap |
( |
GLint |
inFont, |
|
|
GLint |
inCode | |
|
) |
| | |
This command returns the string name of the character that the font identified by inFont maps inCode to.
To change the map, that is, associate a different name string with the integer ID of a font, use glcFontMap().
If inCode cannot be mapped in the font, the command returns GLC_NONE.
The command raises GLC_PARAMETER_ERROR if inFont is not an element of the list GLC_FONT_LIST - Note:
- Changing the map of a font is possible but changing the map of a master is not.
- Parameters:
-
| inFont | The integer ID of the font from which to select the character |
| inCode | The integer ID of the character in the font map |
- Returns:
- The string name of the character that the font inFont maps inCode to.
- See also:
- glcGetMasterMap()
glcFontMap()
const GLCchar* glcGetFontc |
( |
GLint |
inFont, |
|
|
GLCenum |
inAttrib | |
|
) |
| | |
This command returns a string attribute of the font identified by inFont.
The table below lists the string attributes that are associated with each GLC master and font.
Master/font string attributes
Name | Enumerant |
GLC_FAMILY | 0x0060 |
GLC_MASTER_FORMAT | 0x0061 |
GLC_VENDOR | 0x0062 |
GLC_VERSION | 0x0063 |
GLC_FULL_NAME_SGI | 0x8002 |
- Parameters:
-
| inFont | The font for which the attribute is requested |
| inAttrib | The requested string attribute |
- Returns:
- The string attribute inAttrib of the font inFont
- See also:
- glcGetMasterc()
glcGetFonti()
glcGetFontListc()
GLint glcGetFonti |
( |
GLint |
inFont, |
|
|
GLCenum |
inAttrib | |
|
) |
| | |
This command returns an integer attribute of the font identified by inFont.
The attribute is identified by inAttrib. The table below lists the integer attributes that are associated with each GLC master and font.
Master/font integer attributes
Name | Enumerant |
GLC_CHAR_COUNT | 0x0070 |
GLC_FACE_COUNT | 0x0071 |
GLC_IS_FIXED_PITCH | 0x0072 |
GLC_MAX_MAPPED_CODE | 0x0073 |
GLC_MIN_MAPPED_CODE | 0x0074 |
- Parameters:
-
| inFont | The font for which the attribute is requested. |
| inAttrib | The requested integer attribute |
- Returns:
- The value of the specified integer attribute
- See also:
- glcGetMasteri()
glcGetFontc()
glcGetFontListc()
GLboolean glcIsFont |
( |
GLint |
inFont |
) |
|
This command returns GL_TRUE if inFont is the ID of a font.
If inFont is not the ID of a font, the command does not raise an error. - Parameters:
-
| inFont | The element to be tested |
- Returns:
- GL_TRUE if inFont is the ID of a font, GL_FALSE otherwise.
- See also:
- glcGenFontID()
glcNewFontFromFamily()
glcNewFontFromMaster()
GLint glcNewFontFromMaster |
( |
GLint |
inFont, |
|
|
GLint |
inMaster | |
|
) |
| | |
This command creates a new font from the master identified by inMaster.
The ID of the new font is inFont. If the command succeeds, it returns inFont. If inFont is the ID of a font at the beginning of command execution, the command executes the command glcDeleteFont(inFont) before creating the new font. - Parameters:
-
| inFont | The ID of the new font |
| inMaster | The master from which to create the new font |
- Returns:
- The ID of the new font if the command succceeds,
0 otherwise.
- See also:
- glcGetListi() with argument GLC_FONT_LIST
glcGeti() with argument GLC_FONT_COUNT
glcIsFont()
glcGenFontID()
glcNewFontFromFamily()
glcDeleteFont()
GLint glcNewFontFromFamily |
( |
GLint |
inFont, |
|
|
const GLCchar * |
inFamily | |
|
) |
| | |
This command performs a sequential search beginning with the first element of the GLC master list, looking for the first master whose string attribute GLC_FAMILY equals inFamily.
If there is no such master the command returns zero. Otherwise, the command creates a new font from the master. The ID of the new font is inFont.
If the command succeeds, it returns inFont. If inFont is the ID of a font at the beginning of command execution, the command executes the command glcDeleteFont(inFont) before creating the new font. - Parameters:
-
| inFont | The ID of the new font. |
| inFamily | The font family, that is, the string that GLC_FAMILY attribute has to match. |
- Returns:
- The ID of the new font if the command succeeds,
0 otherwise.
- See also:
- glcGetListi() with argument GLC_FONT_LIST
glcGeti() with argument GLC_FONT_COUNT
glcIsFont()
glcGenFontID()
glcNewFontFromMaster()
glcDeleteFont()
|