wxArt2D
Public Member Functions | Static Public Member Functions | Protected Attributes | Friends | List of all members
a2dFontDcData Class Reference
Inheritance diagram for a2dFontDcData:
Inheritance graph
[legend]
Collaboration diagram for a2dFontDcData:
Collaboration graph
[legend]

Public Member Functions

virtual a2dFontType GetType (void) const
 
 a2dFontDcData (const wxFont &font=wxNullFont, double size=0.0)
 Constructor. More...
 
 a2dFontDcData (double size, int family, int style=wxNORMAL, int weight=wxNORMAL, const bool underline=false, const wxString &faceName=wxT(""), wxFontEncoding encoding=wxFONTENCODING_DEFAULT)
 Constructor. More...
 
 a2dFontDcData (const a2dFontDcData &other)
 Copy constructor.
 
virtual ~a2dFontDcData ()
 Destructor.
 
void SetFont (const wxFont &font)
 Set font format. More...
 
wxFont & GetFont (void)
 Get the font format. More...
 
wxString FindFileName () const
 Find the filename of the current font. More...
 
double GetWidth (wxChar c) const
 Get width of a single character.
 
double GetKerning (wxChar c1, wxChar c2) const
 Get kerning space between two characters. More...
 
void SetDeviceHeight (double sizeInPixels)
 to set for load glyph from face, to do proper hinting
 
double GetDeviceHeight ()
 
void GetTextExtent (const wxString &string, double &w, double &h, double &descent, double &externalLeading) const
 
bool GetVpath (wxChar c, a2dVpath &glyph, const a2dAffineMatrix &affine=a2dIDENTITY_MATRIX)
 
void SetSize (double size)
 
a2dFont GetFreetypeFont ()
 Get the freetype equivalent of the font.
 
- Public Member Functions inherited from a2dFontRefData
 a2dFontRefData (double size)
 
 a2dFontRefData ()
 constructor
 
 a2dFontRefData (const a2dFontRefData &other)
 
bool Ok ()
 
double GetSize () const
 
double GetDescent () const
 
double GetLineHeight () const
 

Static Public Member Functions

static void GetInfoList (a2dFontInfoList &list)
 
static a2dFontDcDataCreateFont (const a2dFontInfo &info, bool force=false)
 

Protected Attributes

double m_sizeInPixels
 current text drawn its size in pixels to do proper hinting.
 
wxFont m_font
 Font.
 
double * m_widthcache
 Width cache normalized to a font height of 1. This stores the 'normal' part of the alphabet.
 
DcWidthHash m_extwidthcache
 Width cache normalized to a font height of 1. This stores the extended characters.
 
DcKerningHash m_kerningcache
 Kerning cache normalized to a font height of 1.
 
a2dFont m_freetypefont
 freetype equivalent of the font, used in AggDrawer.
 
- Protected Attributes inherited from a2dFontRefData
a2dFontInfo m_fontinfo
 Font info.
 
double m_height
 Font height cache normalized to a font height of 1.
 
double m_desc
 Font descender cache normalized to a font height of 1.
 
double m_lead
 Font external leading normalized to a font height of 1.
 
bool m_ok
 True if a valid font is set.
 

Friends

class a2dFont
 

Detailed Description

Definition at line 304 of file stylebase.cpp.

Constructor & Destructor Documentation

a2dFontDcData::a2dFontDcData ( const wxFont &  font = wxNullFont,
double  size = 0.0 
)

Constructor.

Parameters
fontFont format. The size of the font is not used and should be set using the next parameter.
sizeSize in world coordinates.

Definition at line 439 of file stylebase.cpp.

a2dFontDcData::a2dFontDcData ( double  size,
int  family,
int  style = wxNORMAL,
int  weight = wxNORMAL,
const bool  underline = false,
const wxString &  faceName = wxT( "" ),
wxFontEncoding  encoding = wxFONTENCODING_DEFAULT 
)

Constructor.

Creates a font object (see font encoding overview, in the wxWidgets documentation, for the meaning of the last parameter).

Parameters
sizeSize in world coordinates.
familyFont family, a generic way of referring to fonts without specifying actual facename. One of:
  • wxDEFAULT Chooses a default font.
  • wxDECORATIVE A decorative font.
  • wxROMAN A formal, serif font.
  • wxSCRIPT A handwriting font.
  • wxSWISS A sans-serif font.
  • wxMODERN A fixed pitch font.
styleOne of wxNORMAL, wxSLANT and wxITALIC.
weightOne of wxNORMAL, wxLIGHT and wxBOLD.
underlineThe value can be true or false. At present this has an effect on Windows and Motif 2.x only.
faceNameAn optional string specifying the actual typeface to be used. If the empty string, a default typeface will chosen based on the family.
encodingAn encoding which may be one of
  • wxFONTENCODING_SYSTEM Default system encoding.
  • wxFONTENCODING_DEFAULT Default application encoding.
  • wxFONTENCODING_ISO8859_1...15 ISO8859 encodings.
  • wxFONTENCODING_KOI8 The standard Russian encoding for Internet.
  • wxFONTENCODING_CP1250...1252 Windows encodings similar to ISO8859 (but not identical).

If the specified encoding isn't available, no font is created.

wxFONTENCODING_DEFAULT is the encoding set by calls to SetDefaultEncoding and which may be set to, say, KOI8 to create all fonts by default with KOI8 encoding. Initially, the default application encoding is the same as default system encoding.

Remarks
  • If the desired font does not exist, the closest match will be chosen.
  • Under Windows, only scalable TrueType fonts are used.

Definition at line 451 of file stylebase.cpp.

Member Function Documentation

wxString a2dFontDcData::FindFileName ( ) const

Find the filename of the current font.

Currently only implemented for Windows.

Returns
The absolute filename. In case of error an empty string is returned

Definition at line 662 of file stylebase.cpp.

wxFont& a2dFontDcData::GetFont ( void  )
inline

Get the font format.

Returns
The font information. The size of the font should be disregarded, since it is internally for storage.

Definition at line 367 of file stylebase.cpp.

double a2dFontDcData::GetKerning ( wxChar  c1,
wxChar  c2 
) const
virtual

Get kerning space between two characters.

Kerning is a method, which moves characters closer together/further apart, to improve the look of the font. Eg. the letter combination LT will be moved closer together. The return value is negative or positive, to respectively move characters closer together, or further apart.

Reimplemented from a2dFontRefData.

Definition at line 722 of file stylebase.cpp.

void a2dFontDcData::SetFont ( const wxFont &  font)

Set font format.

Parameters
fontThe font information. The size of the font is not used.

Definition at line 504 of file stylebase.cpp.


The documentation for this class was generated from the following file:
a2dFontDcData Class Reference -- Sun Oct 12 2014 17:04:39 -- Sun Oct 12 2014 -- 1.8.5 -- wxArt2D -- . -- Main Page Reference Documentation