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

Public Types

enum  {
  Mono = 1, Variable = 2, Dual = 4, Cell = 8,
  Fixed = Mono|Cell
}
 Font pitch hints. More...
 
enum  {
  Decorative = 16, Modern = 32, Roman = 64, Script = 128,
  Swiss = 256, System = 512, X11 = 1024, Scalable = 2048,
  Polymorphic = 4096, Rotatable = 8192
}
 Font style hints. More...
 
enum  {
  ReverseOblique = 1, ReverseItalic = 2, Straight = 5, Italic = 8,
  Oblique = 9
}
 Font slant options. More...
 
enum  {
  Thin = 10, ExtraLight = 20, Light = 30, Normal = 40,
  Medium = 50, DemiBold = 60, Bold = 70, ExtraBold = 80,
  Black = 90
}
 Font weight options. More...
 
enum  {
  UltraCondensed = 50, ExtraCondensed = 63, Condensed = 75, SemiCondensed = 87,
  NonExpanded = 100, SemiExpanded = 113, Expanded = 125, ExtraExpanded = 150,
  UltraExpanded = 200
}
 Condensed or expanded options. More...
 

Public Member Functions

 FXFont (FXApp *a, const FXString &string)
 Construct a font with given font description of the form: More...
 
 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)
 Construct a font with given name, size in points, weight, slant, character set encoding, setwidth, and hints. More...
 
 FXFont (FXApp *a, const FXFontDesc &fontdesc)
 Construct font from font description.
 
virtual void create ()
 Create the font.
 
virtual void detach ()
 Detach the font.
 
virtual void destroy ()
 Destroy the font.
 
FXString getFamily () const
 Return family part of name.
 
FXString getFoundry () const
 Return foundry part of name.
 
const FXStringgetName () const
 Get font family name.
 
const FXStringgetActualName () const
 Get actual family name.
 
FXuint getSize () const
 Get size in deci-points.
 
FXuint getActualSize () const
 Get actual size in deci-points.
 
FXuint getWeight () const
 Get font weight.
 
FXuint getActualWeight () const
 Get actual font weight.
 
FXuint getSlant () const
 Get slant.
 
FXuint getActualSlant () const
 Get actual slant.
 
FXuint getEncoding () const
 Get character set encoding.
 
FXuint getActualEncoding () const
 Get actual encoding.
 
FXuint getSetWidth () const
 Get setwidth.
 
FXuint getActualSetWidth () const
 Get actual setwidth.
 
FXuint getHints () const
 Get hints.
 
FXuint getFlags () const
 Get flags.
 
virtual void setFontDesc (const FXFontDesc &fontdesc)
 Change font description.
 
FXFontDesc getFontDesc () const
 Get font description.
 
FXFontDesc getActualFontDesc () const
 Get actual font description.
 
FXint getAngle () const
 Return angle.
 
virtual void setAngle (FXint ang)
 Set to new angle, in degrees*64 relative to positive x axis.
 
FXString getFont () const
 Return the font description as a string suitable for parsing with setFont(), see above.
 
virtual void setFont (const FXString &string)
 Change the font to the specified font description string.
 
virtual FXbool isFontMono () const
 Find out if the font is monotype or proportional.
 
virtual FXbool hasChar (FXwchar ch) const
 See if font has glyph for ch.
 
virtual FXwchar getMinChar () const
 Get first character glyph in font.
 
virtual FXwchar getMaxChar () const
 Get last character glyph in font.
 
virtual FXint leftBearing (FXwchar ch) const
 Left bearing.
 
virtual FXint rightBearing (FXwchar ch) const
 Right bearing.
 
virtual FXint getFontWidth () const
 Width of widest character in font.
 
virtual FXint getFontHeight () const
 Height of highest character in font.
 
virtual FXint getFontAscent () const
 Ascent from baseline.
 
virtual FXint getFontDescent () const
 Descent from baseline.
 
virtual FXint getFontLeading () const
 Get font leading [that is lead-ing as in Pb!].
 
virtual FXint getFontSpacing () const
 Get font line spacing.
 
virtual FXint getCharWidth (const FXwchar ch) const
 Calculate width of single wide character in this font.
 
virtual FXint getTextWidth (const FXString &string) const
 Calculate width of given text in this font.
 
virtual FXint getTextWidth (const FXchar *string, FXuint length) const
 Calculate width of given text in this font.
 
virtual FXint getTextHeight (const FXString &string) const
 Calculate height of given text in this font.
 
virtual FXint getTextHeight (const FXchar *string, FXuint length) const
 Calculate height of given text in this font.
 
virtual void save (FXStream &store) const
 Save font data into stream.
 
virtual void load (FXStream &store)
 Load font data from stream.
 
virtual ~FXFont ()
 Destroy font.
 
- Public Member Functions inherited from FX::FXId
FXAppgetApp () const
 Get application.
 
FXID id () const
 Get XID handle.
 
void setUserData (FXptr ptr)
 Set user data pointer.
 
FXptr getUserData () const
 Get user data pointer.
 
virtual ~FXId ()
 Destructor.
 
- Public Member Functions inherited from FX::FXObject
const FXchar * getClassName () const
 Get class name of some object.
 
FXbool isMemberOf (const FXMetaClass *metaclass) const
 Check if object is member of metaclass.
 
virtual long tryHandle (FXObject *sender, FXSelector sel, void *ptr)
 Try handle message safely, catching certain exceptions.
 
virtual long onDefault (FXObject *, FXSelector, void *)
 Called for unhandled messages.
 
virtual ~FXObject ()
 Virtual destructor.
 

Static Public Member Functions

static FXuint styleFromString (const FXString &str)
 Convert style hints to string and vice versa.
 
static FXString stringFromStyle (FXuint style)
 
static FXuint slantFromString (const FXString &str)
 Convert slant to string and vice versa.
 
static FXString stringFromSlant (FXuint slant)
 
static FXuint weightFromString (const FXString &str)
 Convert weight to string and vice versa.
 
static FXString stringFromWeight (FXuint weight)
 
static FXuint setWidthFromString (const FXString &str)
 Convert setwidth to string and vice versa.
 
static FXString stringFromSetWidth (FXuint setwidth)
 
static FXuint encodingFromString (const FXString &str)
 Convert encoding to string and vice versa.
 
static FXString stringFromEncoding (FXuint encoding)
 
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)
 List all fonts matching hints. More...
 

Protected Member Functions

void * match (const FXString &wantfamily, const FXString &wantforge, FXuint wantsize, FXuint wantweight, FXuint wantslant, FXuint wantsetwidth, FXuint wantencoding, FXuint wanthints, FXint res)
 
- Protected Member Functions inherited from FX::FXId
 FXId (FXApp *a)
 

Protected Attributes

FXString wantedName
 
FXString actualName
 
FXushort wantedSize
 
FXushort actualSize
 
FXushort wantedWeight
 
FXushort actualWeight
 
FXushort wantedSlant
 
FXushort actualSlant
 
FXushort wantedSetwidth
 
FXushort actualSetwidth
 
FXushort wantedEncoding
 
FXushort actualEncoding
 
FXushort hints
 
FXushort flags
 
FXshort angle
 
void * font
 
- Protected Attributes inherited from FX::FXId
FXID xid
 

Friends

class FXDCWindow
 

Detailed Description

Font class.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

Font pitch hints.

Enumerator
Variable 

Mono spaced font.

Dual 

Variable pitch, proportional spacing.

Cell 

Dual pitch font.

Fixed 

Character cell font.

◆ anonymous enum

anonymous enum

Font style hints.

Enumerator
Modern 

Fancy fonts.

Roman 

Monospace typewriter font.

Script 

Variable width times-like font, serif.

Swiss 

Script or cursive.

System 

Helvetica/swiss type font, sans-serif.

X11 

System font.

Scalable 

Raw X11 font string.

Polymorphic 

Scalable fonts.

Rotatable 

Polymorphic fonts, e.g. parametric weight, slant, etc.

◆ anonymous enum

anonymous enum

Font slant options.

Enumerator
ReverseItalic 

Reversed oblique.

Straight 

Reversed italic.

Italic 

Straight, not slanted.

Oblique 

Italics.

◆ anonymous enum

anonymous enum

Font weight options.

Enumerator
ExtraLight 

Thin.

Light 

Extra light.

Normal 

Light.

Medium 

Normal or regular weight.

DemiBold 

Medium bold face.

Bold 

Demi bold face.

ExtraBold 

Bold face.

Black 

Extra.

◆ anonymous enum

anonymous enum

Condensed or expanded options.

Enumerator
ExtraCondensed 

Ultra condensed printing.

Condensed 

Extra condensed.

SemiCondensed 

Condensed.

NonExpanded 

Semi-condensed.

SemiExpanded 

Regular printing.

Expanded 

Semi expanded.

ExtraExpanded 

Expanded.

UltraExpanded 

Extra expanded.

Constructor & Destructor Documentation

◆ FXFont() [1/2]

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:

"9x15bold"

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

◆ FXFont() [2/2]

FX::FXFont::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 
)

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]".

Member Function Documentation

◆ listFonts()

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 
)
static

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 freeElms().


The documentation for this class was generated from the following file:

Copyright © 1997-2022 Jeroen van der Zijp