FontStyle class : public SharedObject


FontStyle objects represent a font's look, such as bold, italics, etc.




Type Definitions


typedef struct CachedFaceRec_

{

BString file_path;

uint32 face_index;

} CachedFaceRec, *CachedFace;


A record used in FreeType caching.



Member Functions


FontStyle(const char *filepath, FT_Face face)

~FontStyle(void)

ServerFont *Instantiate(float size, float rotation=0.0, float shear=90.0)

bool IsFixedWidth(void)

bool IsScalable(void)

bool HasKerning(void)

bool HasTuned(void)

uint16 GlyphCount(void)

uint16 CharMapCount(void)

const char *Style(void)

FontFamily *Family(void)

FT_Face GetFace(void)

const char *GetPath(void)

int16 ConvertToUni code(uint16 c)





FontStyle(const char *filepath, FT_Face face)


1) set name from face

2) create a CachedFaceRec object and generate the handle as being the memory address converted to an integer. Assign the path from the parameter.

3) set the path from the parameter

4) set family to NULL

5) create the instance list

6) check to see if face object has ready-made strikes and set IsTuned flags as appropriate

7) set fixed-width, kerning, and scalable flags as appropriate, based on face data

8) get and assign glyph and charmap count

9) set bounds to an invalid rectangle



~FontStyle(void)


1) delete all pointer objects

2) empty instance list, delete all attached instances, and delete the list



ServerFont *Instantiate(float size, float rotation=0.0, float shear=90.0)


Retrieves a specific instance of the font style, based on the size, rotation, and shear values


1) create a new ServerFont object

2) add the new object to the instance list and return it



bool IsFixedWidth(void)

bool IsScalable(void)

bool HasKerning(void)

bool HasTuned(void)

uint16 GlyphCount(void)

uint16 CharMapCount(void)

const char *GetPath(void)

FT_Face GetFace(void)


These merely return the appropriate flags/values which are assigned values in the constructor.



const char *Style(void)


Returns the string value for the particular style.



FontFamily *Family(void)


Returns the pointer to the FontStyle object's family. Do NOT delete this pointer.



int16 ConvertToUnicode(uint16 c)


Converts a character code to a UTF-8 string


1) Look up the face from the cache manager

2) Call FT_Get_Char_Index for the particular character code and return the value