diff --git a/headers/private/servers/app/FontFamily.h b/headers/private/servers/app/FontFamily.h index 9fb09359a5..23482ebafa 100644 --- a/headers/private/servers/app/FontFamily.h +++ b/headers/private/servers/app/FontFamily.h @@ -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; }; /*! diff --git a/headers/private/servers/app/FontServer.h b/headers/private/servers/app/FontServer.h index 2de01eb371..d6b2fdadb3 100644 --- a/headers/private/servers/app/FontServer.h +++ b/headers/private/servers/app/FontServer.h @@ -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); diff --git a/headers/private/servers/app/ServerFont.h b/headers/private/servers/app/ServerFont.h index a733b825c5..52b3300b4c 100644 --- a/headers/private/servers/app/ServerFont.h +++ b/headers/private/servers/app/ServerFont.h @@ -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;