class HT_Font
An object of this class stores a set of properties that
describe a particular font provided by a font engine.
Note: An application or driver never creates or
sets the values of an object of the type HT_Font. An application
typically loads a font engine which creates an HT_Font for each
font that it intends to support for the application. This class serves
as a mechanism to query the attributes of each of the installed fonts that
a font engine provides.
For more information on class HT_Font see "The
HT_Font" section of chapter 5, "The Font Engine."
See Also
Access Methods
create_empty_data
Helps to check for the null case.
creator, set_creator
Sets or indicates the font engine
that created the font.
font_descriptor
Returns the font description for
the font.
full_name, set_full_name
Sets and points to the full font
name string.
validate
Checks for the existence of font data.
Font Descriptor Methods
bold, set_bold
Sets or indicates that the given
font is bold.
charset, set_charset
Sets or indicates the character set.
flags, Set_flags
Indicates or sets the flags.
font_descriptor
Returns an HT_Font_Descriptor
object that describes the font stored in the current HT_Font object.
font_type, set_font_type
Sets or indicates the font type.
italic, set_italic
Sets or indicates that the given
font is italicized.
name, set_name
Sets or indicates the name of the
font.
panose1, set_panose1
Gets or sets the PANOSE structure
for this font.
pitch_and_family, set_pitch_and_family
Sets or indicates the pitch and family.
size, set_size
Sets or indicates the size of the
font, specified in pixels.
Details
These font descriptor methods can be accessed directly
through the HT_Font object. The methods describe the actual font
as it was designed. For example, Times New Roman comes in four different
flavors; Times New Roman, Times New Roman Bold, Times New Roman Italic
and Times New Roman Bold Italic. Each of these is a separate individual
font and is designed to be unique.
The set methods are used by the font engine to describe
the font attributes as designed. An application can use these methods to
create a font descriptor that can be passed to the find_font()
method in order to find a font that matches, as closely as possible, to
the one described by the font descriptor. The get methods are typically
used by an application to query the font.
Font Capability Methods
boldable, set_boldable
Sets or indicates that the given
font can be made bold.
proportional, set_proportional
Sets or indicates that the given
font is proportionally spaced.
rotate_mode, set_rotate_mode
Sets or indicates the degree of rotation that can be applied to this font.
scaleable, set_scaleable
Sets or indicates that the font can
be scaled, that is, the size can be increased or decreased.
slantable, set_slantable
Sets or indicates that the font can
be slanted or sheared.
underlined, set_underlined
Sets or indicates that the font can
be underlined.
Details
Most fonts usually do not come in all of these flavors.
For such fonts, depending on the type of font, TrueType, Raster, and so
forth, the font engine can synthesize the size, bold or italic effect.
These font capability methods allow the application to query the font in
order to find out if it has these attributes by design or if the font engine
can synthesize it.
Operators
operator
Returns an integer value ¾
four types: equal constant, equal any, not equal constant and not equal
any type.
HT_Font::(attribute)
Purpose
Sets or gets one of the attribute values for this font.
Synopsis
HT_Boolean bold () const
void set_bold (HT_Boolean in)
void set_boldable (HT_Boolean in)
HT_Boolean boldable () const
int charset () const
void set_charset (int in)
HT_Font_Descriptor font_descriptor () const
HT_Font_Flags flags () const
void set_flags (HT_Font_Flags in)
void set_italic (HT_Boolean in)
HT_Boolean italic () const
void set_name(char * in);
char * name() const
void set_panose1(HT_Panose p)
HT_Panose panose1() const
int pitch_and_family () const
void set_pitch_and_family (int in)
void set_proportional (HT_Boolean in)
HT_Boolean proportional () const
void set_rotate_mode(int in)
int rotate_mode() const
void set_scaleable (HT_Boolean in)
HT_Boolean scaleable () const
void set_size (float in)
float size () const
void set_slantable (HT_Boolean in)
HT_Boolean slantable () const
Details
These methods can be used to query the attributes of
a given font. For example, to see if the font is italicized, use the italic
attribute method.
For descriptions of the parameters, see the methods of
this class.
HT_Font::bold,
set_bold
Purpose
This method sets or queries the font as bold and is useful
for font selection.
Synopsis
HT_Boolean bold () const
void set_bold (HT_Boolean in)
Details
The set method is typically used by the font engine to
set the design attributes of the font. It is also used by an application
to create a font descriptor in order to allow the font engine to find a
font. The get method is typically used by an application to query the font.
HT_Font::boldable,
set_boldable
Purpose
Sets or returns true if the font can be made bold.
Synopsis
HT_Boolean boldable () const
void set_boldable (HT_Boolean in)
HT_Font::charset,
set_charset
Purpose
Sets or queries the character set supported by the font
¾
useful
for font selection.
Synopsis
int charset () const
void set_charset (int in)
Details
A charset refers to a set of characters. A character
set contains punctuation marks, numerals, uppercase and lowercase letters
and all other printable characters of a given language. The charset values
used are typically those supported by the Windows OS.
HT_Font::create_empty_data
Purpose
Helps to check for the null case.
Synopsis
void HT_Font::create_empty_data (void)
Details
When you set an option, this function assures that operable
data is returned.
HT_Font::creator,
set_creator
Purpose
Indicates or sets to the font engine that created the
font.
Synopsis
void * creator(void) const
void set_creator (void * creator)
Details
This method returns a pointer to the font engine that
created the font. When HT_Font is created,
the font engine sets the creator flag to
itself as part of the description to identify the font that you have created.
HT_Font::flags,
set_flags
Purpose
Sets or returns the flag.
Synopsis
HT_Font_Flags flags() const
void set_flags (HT_Font_Flags in)
Details
This is used to tell the font mapper what attributes
to make use of while selecting a font from the given description.
HT_Font::font_descriptor
Purpose
Returns an HT_Font_Descriptor
object that describes the font stored in the current HT_Font object.
Synopsis
HT_Font_Descriptor font_descriptor(void) const
Details
A font descriptor is typically used to describe a font.
It is created and passed to the find_font()
method of the font engine in order to find a font that best suits the description.
Also, each HT_Font object has a font descriptor associated with
it that describes the font that it currently holds. This is useful for
the application to determine if it got the font requested or got a substituted
font.
HT_Font::font_type,
set_font_type
Purpose
Sets or queries the technology of the font.
Synopsis
int font_type () const
void set_font_type (int in)
Details
Font type can be used to specify the selection of a TrueType
font only with the given font description. It is useful for font selection
and can be any one of the following:
Device: Fonts that are device specific such as
printer fonts or down loadable soft fonts.
Raster: Fonts that are stored as bitmaps which
do not lend themselves to be transformed.
TrueType: TrueType fonts are outline fonts which
lend themselves well to be transformed.
Type1: Adobe Type1 or postscript fonts are also
outline fonts.
Vector: Vector or Stroke Fonts are defined as a
set of lines drawn between points which lend themselves well to be transformed.
Undefined: the font technology is not known.
HT_Font::full_name,
set_full_name
Purpose
Sets and queries the full font name of the font.
Synopsis
char * full_name() const
Details
Full font name includes the typeface name and the typeface
style in the font name, for example, Times New Roman Bold.
HT_Font::italic,
set_italic
Purpose
Queries or sets the font to Italic ¾
useful for font selection.
Synopsis
HT_Boolean italic () const
void set_italic (HT_Boolean in)
Details
The set method is typically used by the font engine to
set the design attributes of the font. It is also used by an application
to create a font descriptor to allow the font engine to find a font. The
get method is typically used by an application to query the font.
HT_Font::name,
set_name
Purpose
Sets or returns the typeface name of the font.
Synopsis
char * name() const
void set_name(char const * in)
HT_Font::{operator!=,
operator==}
Purpose
Returns an integer value. Four types – not equal constant,
not equal any, equal constant and equal any type.
Synopsis
int operator != (void * ptr) const
int operator!= (HT_Font const & test) const
int operator == (void * ptr) const
int operator== (HT_Font const & test) const
Details
This method is a check to determine if two fonts are
the same. In the first example the method checks for a constant pointer
that is not equal, the second checks for any type of pointer that is not
equal. In the third example the method checks for a constant pointer that
is equal and the fourth checks for any type of pointer that is equal.
HT_Font::panose1,
set_panose1
Purpose
Gets or sets the PANOSE structure
for this font.
Synopsis
HT_Panose panose1() const
void set_panose1(HT_Panose p)
Details
The panose1 method allows access to a WIN32
PANOSE object to help in font matching. The PANOSE
structure classifies fonts in a manner that allows a measure of how closely
a font matches a set of desired attributes.
HT_Font::pitch_and_family,
set_pitch_and_family
Purpose
Sets or queries the pitch and family of the font. Useful
for font selection.
Synopsis
int pitch_and_family () const
void set_pitch_and_family (int in)
Details
Pitch and Family refers to the general look and feel
of the font. It is also very useful in describing the font. The pitch_and_family
values, typically, are as described in the LOGFONT structure of the Windows
OS.
HT_Font::proportional,
set_proportional
Purpose
Sets or returns true if the font is a proportionally
scaled font¾
the
width of each character is not fixed.
Synopsis
HT_Boolean proportional () const
void set_proportional (HT_Boolean in)
HT_Font::rotate_mode,
set_rotate_mode
Purpose
Sets or returns the rotation capability of the font.
Synopsis
int rotate_mode() const
void set_rotate_mode(int in)
Details
HT_Font::scaleable,
set_scaleable
Purpose
Sets or returns true if the font can be scaled
Synopsis
HT_Boolean scaleable () const
void set_scaleable (HT_Boolean in)
HT_Font::size,
set_size
Purpose
Sets or returns the size of the font.
Synopsis
float size () const
void set_size (float in)
HT_Font::slantable,
set_slantable
Purpose
Returns true if the font can be slanted, italicized or
obliqued.
Synopsis
HT_Boolean slantable () const
void set_slantable (HT_Boolean in)
HT_Font::underlined,
set_underlined
Purpose
Sets or returns true if the
font is underlined.
Synopsis
HT_Boolean underlined () const
void set_underlined (HT_Boolean in)
HT_Font::validate
Purpose
Checks for the existence of font data.
Synopsis
void validate (void)