More API fixes and tweaks, mostly to get BFont::GetHeight working

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10805 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
DarkWyrm 2005-01-17 20:05:36 +00:00
parent 3f8d6d562d
commit 9a2b128aea
3 changed files with 23 additions and 4 deletions

View File

@ -61,6 +61,21 @@ typedef struct CachedFaceRec_
int face_index;
} CachedFaceRec, *CachedFace;
/*!
\brief Private structure to store font height values
Units provided by FT2 are in font units, so they are stored in the style as
such. Each value must be multiplied by the point size to determine size in pixels
*/
typedef struct
{
FT_Short ascent;
FT_Short descent;
FT_Short leading;
FT_UShort units_per_em;
} FontStyleHeight;
/*!
\class FontStyle FontFamily.h
\brief Object used to represent a font style
@ -124,6 +139,7 @@ public:
uint16 GetFace(void) const { return fFace; }
const char *GetPath(void);
font_height GetHeight(const float &size);
// TODO: Re-enable when I understand how the FT2 Cache system changed from
// 2.1.4 to 2.1.8
@ -142,6 +158,7 @@ protected:
BRect fbounds;
uint16 fID;
uint16 fFace;
FontStyleHeight fHeight;
};
/*!

View File

@ -68,7 +68,8 @@ public:
FontStyle *GetStyle(const char *family, const char *face);
FontStyle *GetStyle(const char *family, uint16 id) const;
FontStyle *GetStyle(const uint16 &familyid, const uint16 &styleid);
FontFamily *GetFamily(const uint16 &familyid);
FontFamily *GetFamily(const uint16 &familyid) const;
FontFamily *GetFamily(const char *name) const;
ServerFont *GetSystemPlain(void);
ServerFont *GetSystemBold(void);
@ -84,7 +85,6 @@ public:
*/
void FontsUpdated(void) { need_update=false; }
protected:
FontFamily *_FindFamily(const char *name) const;
uint16 TranslateStyleToFace(const char *name) const;
FT_CharMap _GetSupportedCharmap(const FT_Face &face);

View File

@ -47,7 +47,7 @@ public:
float Shear(void) const { return fshear; }
float Rotation(void) const { return frotation; }
float Size(void) const { return fsize; }
uint32 Face(void) const { return fface; }
uint16 Face(void) const { return fface; }
uint32 CountGlyphs(void);
int32 CountTuned(void);
font_file_format FileFormat(void);
@ -73,6 +73,8 @@ public:
const char *GetStyle(void) const;
const char *GetFamily(void) const;
const char *GetPath(void) const { return fstyle->GetPath(); }
uint16 StyleID(void) const { return fstyle->GetID(); }
uint16 FamilyID(void) const { return fstyle->Family()->GetID(); }
BRect BoundingBox(void);
void Height(font_height *fh);
@ -88,7 +90,7 @@ protected:
BRect fbounds;
uint32 fflags;
uint32 fspacing;
uint32 fface;
uint16 fface;
font_direction fdirection;
uint8 ftruncate;
uint32 fencoding;