Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

FX::FXFont Class Reference

Font class. More...

#include <FXFont.h>

Inheritance diagram for FX::FXFont:

FX::FXId FX::FXObject List of all members.

Public Types

enum  {
  Fixed = 1,
  Variable = 2
enum  {
  Decorative = 4,
  Modern = 8,
  Roman = 16,
  Script = 32,
  Swiss = 64,
  System = 128,
  X11 = 256,
  Scalable = 512,
  Polymorphic = 1024,
  Rotatable = 2048
enum  {
  ReverseOblique = 1,
  ReverseItalic = 2,
  Straight = 5,
  Italic = 8,
  Oblique = 9
enum  {
  Thin = 10,
  ExtraLight = 20,
  Light = 30,
  Normal = 40,
  Medium = 50,
  DemiBold = 60,
  Bold = 70,
  ExtraBold = 80,
  Black = 90
enum  {
  UltraCondensed = 50,
  ExtraCondensed = 63,
  Condensed = 75,
  SemiCondensed = 87,
  NonExpanded = 100,
  SemiExpanded = 113,
  Expanded = 125,
  ExtraExpanded = 150,
  UltraExpanded = 200

Public Member Functions

 FXFont (FXApp *a, const FXString &string)
 FXFont (FXApp *a, const FXString &face, FXuint size, FXuint weight=FXFont::Normal, FXuint slant=FXFont::Straight, FXuint encoding=FONTENCODING_DEFAULT, FXuint setwidth=FXFont::NonExpanded, FXuint h=0)
 FXFont (FXApp *a, const FXFontDesc &fontdesc)
virtual void create ()
virtual void detach ()
virtual void destroy ()
FXString getFamily () const
FXString getFoundry () const
const FXStringgetName () const
const FXStringgetActualName () const
FXuint getSize () const
FXuint getActualSize () const
FXuint getWeight () const
FXuint getActualWeight () const
FXuint getSlant () const
FXuint getActualSlant () const
FXuint getEncoding () const
FXuint getActualEncoding () const
FXuint getSetWidth () const
FXuint getActualSetWidth () const
FXuint getHints () const
FXuint getFlags () const
void getFontDesc (FXFontDesc &fontdesc) const
virtual void setFontDesc (const FXFontDesc &fontdesc)
FXint getAngle () const
virtual void setAngle (FXint ang)
FXString getFont () const
virtual void setFont (const FXString &string)
virtual FXbool isFontMono () const
virtual FXbool hasChar (FXwchar ch) const
virtual FXwchar getMinChar () const
virtual FXwchar getMaxChar () const
virtual FXint leftBearing (FXwchar ch) const
virtual FXint rightBearing (FXwchar ch) const
virtual FXint getFontWidth () const
virtual FXint getFontHeight () const
virtual FXint getFontAscent () const
virtual FXint getFontDescent () const
virtual FXint getFontLeading () const
virtual FXint getFontSpacing () const
virtual FXint getCharWidth (const FXwchar ch) const
virtual FXint getTextWidth (const FXString &string) const
virtual FXint getTextWidth (const FXchar *string, FXuint length) const
virtual FXint getTextHeight (const FXString &string) const
virtual FXint getTextHeight (const FXchar *string, FXuint length) const
virtual void save (FXStream &store) const
virtual void load (FXStream &store)
virtual ~FXFont ()

Static Public Member Functions

static FXbool listFonts (FXFontDesc *&fonts, FXuint &numfonts, const FXString &face, FXuint wt=0, FXuint sl=0, FXuint sw=0, FXuint en=0, FXuint h=0)


class FXDCWindow

Detailed Description

Font class.

See also:

Member Enumeration Documentation

anonymous enum

Font pitch hints.

Enumeration values:
Fixed  Fixed pitch, mono-spaced.
Variable  Variable pitch, proportional spacing.

anonymous enum

Font style hints.

Enumeration values:
Decorative  Fancy fonts.
Modern  Monospace typewriter font.
Roman  Variable width times-like font, serif.
Script  Script or cursive.
Swiss  Helvetica/swiss type font, sans-serif.
System  System font.
X11  Raw X11 font string.
Scalable  Scalable fonts.
Polymorphic  Polymorphic fonts, e.g. parametric weight, slant, etc.
Rotatable  Rotatable fonts.

anonymous enum

Font slant options.

Enumeration values:
ReverseOblique  Reversed oblique.
ReverseItalic  Reversed italic.
Straight  Straight, not slanted.
Italic  Italics.
Oblique  Oblique slant.

anonymous enum

Font weight options.

Enumeration values:
Thin  Thin.
ExtraLight  Extra light.
Light  Light.
Normal  Normal or regular weight.
Medium  Medium bold face.
DemiBold  Demi bold face.
Bold  Bold face.
ExtraBold  Extra.
Black  Black.

anonymous enum

Condensed or expanded options.

Enumeration values:
UltraCondensed  Ultra condensed printing.
ExtraCondensed  Extra condensed.
Condensed  Condensed.
SemiCondensed  Semi-condensed.
NonExpanded  Regular printing.
SemiExpanded  Semi expanded.
Expanded  Expanded.
ExtraExpanded  Extra expanded.
UltraExpanded  Ultra expanded.

Constructor & Destructor Documentation

FX::FXFont::FXFont FXApp a,
const FXString string

Construct a font with given font description of the form:.

fontname [ "[" foundry "]" ] ["," size ["," weight ["," slant ["," setwidth ["," encoding ["," hints]]]]]]

For example:

"helvetica [bitstream],120,bold,italic,normal,iso8859-1,0"

Typically, at least the font name, and size must be given for normal font matching. As a special case, raw X11 fonts can also be passed, for example:


Note: use of the raw X11 fonts is stronly discouraged.

FX::FXFont::FXFont FXApp a,
const FXString face,
FXuint  size,
FXuint  weight = FXFont::Normal,
FXuint  slant = FXFont::Straight,
FXuint  setwidth = FXFont::NonExpanded,
FXuint  h = 0

Construct a font with given name, size in points, weight, slant, character set encoding, setwidth, and hints.

The font name may be comprised of a family name and optional foundry name enclosed in square brackets, for example, "helvetica [bitstream]".

FX::FXFont::FXFont FXApp a,
const FXFontDesc fontdesc

Construct font from font description.

virtual FX::FXFont::~FXFont  )  [virtual]

Destroy font.

Member Function Documentation

virtual void FX::FXFont::create  )  [virtual]

Create the font.

Reimplemented from FX::FXId.

virtual void FX::FXFont::detach  )  [virtual]

Detach the font.

Reimplemented from FX::FXId.

virtual void FX::FXFont::destroy  )  [virtual]

Destroy the font.

Reimplemented from FX::FXId.

FXString FX::FXFont::getFamily  )  const

Return family part of name.

FXString FX::FXFont::getFoundry  )  const

Return foundry part of name.

const FXString& FX::FXFont::getName  )  const [inline]

Get font family name.

const FXString& FX::FXFont::getActualName  )  const [inline]

Get actual family name.

FXuint FX::FXFont::getSize  )  const [inline]

Get size in deci-points.

FXuint FX::FXFont::getActualSize  )  const [inline]

Get actual size in deci-points.

FXuint FX::FXFont::getWeight  )  const [inline]

Get font weight.

FXuint FX::FXFont::getActualWeight  )  const [inline]

Get actual font weight.

FXuint FX::FXFont::getSlant  )  const [inline]

Get slant.

FXuint FX::FXFont::getActualSlant  )  const [inline]

Get actual slant.

FXuint FX::FXFont::getEncoding  )  const [inline]

Get character set encoding.

FXuint FX::FXFont::getActualEncoding  )  const [inline]

Get actual encoding.

FXuint FX::FXFont::getSetWidth  )  const [inline]

Get setwidth.

FXuint FX::FXFont::getActualSetWidth  )  const [inline]

Get actual setwidth.

FXuint FX::FXFont::getHints  )  const [inline]

Get hints.

FXuint FX::FXFont::getFlags  )  const [inline]

Get flags.

void FX::FXFont::getFontDesc FXFontDesc fontdesc  )  const

Get font description.

virtual void FX::FXFont::setFontDesc const FXFontDesc fontdesc  )  [virtual]

Change font description.

FXint FX::FXFont::getAngle  )  const [inline]

Return angle.

virtual void FX::FXFont::setAngle FXint  ang  )  [virtual]

Set to new angle, in degrees*64 relative to positive x axis.

FXString FX::FXFont::getFont  )  const

Return the font description as a string suitable for parsing with setFont(), see above.

virtual void FX::FXFont::setFont const FXString string  )  [virtual]

Change the font to the specified font description string.

virtual FXbool FX::FXFont::isFontMono  )  const [virtual]

Find out if the font is monotype or proportional.

virtual FXbool FX::FXFont::hasChar FXwchar  ch  )  const [virtual]

See if font has glyph for ch.

virtual FXwchar FX::FXFont::getMinChar  )  const [virtual]

Get first character glyph in font.

virtual FXwchar FX::FXFont::getMaxChar  )  const [virtual]

Get last character glyph in font.

virtual FXint FX::FXFont::leftBearing FXwchar  ch  )  const [virtual]

Left bearing.

virtual FXint FX::FXFont::rightBearing FXwchar  ch  )  const [virtual]

Right bearing.

virtual FXint FX::FXFont::getFontWidth  )  const [virtual]

Width of widest character in font.

virtual FXint FX::FXFont::getFontHeight  )  const [virtual]

Height of highest character in font.

virtual FXint FX::FXFont::getFontAscent  )  const [virtual]

Ascent from baseline.

virtual FXint FX::FXFont::getFontDescent  )  const [virtual]

Descent from baseline.

virtual FXint FX::FXFont::getFontLeading  )  const [virtual]

Get font leading [that is lead-ing as in Pb!].

virtual FXint FX::FXFont::getFontSpacing  )  const [virtual]

Get font line spacing.

virtual FXint FX::FXFont::getCharWidth const FXwchar  ch  )  const [virtual]

Calculate width of single wide character in this font.

virtual FXint FX::FXFont::getTextWidth const FXString string  )  const [virtual]

Calculate width of given text in this font.

virtual FXint FX::FXFont::getTextWidth const FXchar string,
FXuint  length
const [virtual]

Calculate width of given text in this font.

virtual FXint FX::FXFont::getTextHeight const FXString string  )  const [virtual]

Calculate height of given text in this font.

virtual FXint FX::FXFont::getTextHeight const FXchar string,
FXuint  length
const [virtual]

Calculate height of given text in this font.

static FXbool FX::FXFont::listFonts FXFontDesc *&  fonts,
FXuint numfonts,
const FXString face,
FXuint  wt = 0,
FXuint  sl = 0,
FXuint  sw = 0,
FXuint  en = 0,
FXuint  h = 0

List all fonts matching hints.

If listFonts() returns TRUE then fonts points to a newly-allocated array of length numfonts. It is the caller's responsibility to free this array using FXFREE().

virtual void FX::FXFont::save FXStream store  )  const [virtual]

Save font data into stream.

Reimplemented from FX::FXId.

virtual void FX::FXFont::load FXStream store  )  [virtual]

Load font data from stream.

Reimplemented from FX::FXId.

Friends And Related Function Documentation

friend class FXDCWindow [friend]

Copyright © 1997-2005 Jeroen van der Zijp