Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   Related Pages  

freetype::CFace Class Reference

the font face class. More...

#include <Face.hh>

List of all members.

Public Methods

Private Attributes


Detailed Description

the font face class.

a font face is a font with a specified font size. this class is used to wrap up freetype operations to get metrics of a font face, and create glyph objects.


Constructor & Destructor Documentation

freetype::CFace::CFace CLibrary   lib,
const std::string &    filename,
int    index
 

construct a font face.

Parameters:
lib  a pointer to the freetype library object. when the library object is destroyed, the font face object is destroyed by freetype too.
filename  the filename of the font file
index  the index of the font in the font file. one single font file can contain many font faces.

00081     : m_pimpl( new CBody )
00082 {
00083     // assert parameters
00084     assert( lib != 0 ) ;
00085     assert( lib->Pimpl( ) != 0 ) ;
00086     assert( lib->Pimpl( )->Body( ) != 0 ) ;
00087     assert( !filename.empty( ) ) ;
00088     assert( index >= 0 ) ;
00089     
00090     FT_Error error = ::FT_New_Face( lib->Pimpl( )->Body( ),
00091                                     filename.c_str( ),
00092                                     index, &m_pimpl->m_face ) ;
00093 
00094     // should throw something better later
00095     if ( error )
00096         throw CError( ) ;
00097     
00098     assert( IsValid( ) ) ;
00099 }


Member Function Documentation

void freetype::CFace::SetSize double    width,
double    height,
int    hres,
int    vres
 

set font face size. see FT_Set_Char_Size() for details.

Parameters:
width  char width in points. zero means same as height.
height  char height in points. zero means same as width.
hres  horizonal resolution in DPI.
vres  vertical resolution in DPI.

00209 {
00210     assert( IsValid( ) ) ;
00211     
00212     FT_Error result = FT_Set_Char_Size( m_pimpl->m_face,
00213                                         static_cast<FT_F26Dot6>( width * 64.0 ),
00214                                         static_cast<FT_F26Dot6>( height * 64.0),
00215                                         hres, vres ) ;
00216     if ( result != 0 )
00217         throw CError( ) ;
00218 }


Member Data Documentation

boost::scoped_ptr<CBody> freetype::CFace::m_pimpl [private]
 

pointer to implementation. the actual freetype data structure is hided behind this pointer.


The documentation for this class was generated from the following files:
Generated on Sun Feb 2 09:17:07 2003 for libpdf++ by doxygen1.2.16