More font work:
* simplified BFont::SetFamily*() server communication - there is now only AS_SET_FAMILY_AND_STYLE left, but at least that one works correctly. * BFont::fFace is now always updated correctly. * Moved the fFace masking to the server - BFont doesn't know enough to do this correctly, anyway. * Only one version of get_font_style() worked correctly. * Font family/style ID and index were used completely mixed up - this would have become an issue as soon as the font list changes during runtime. * Enabled AS_GET_FONT_DIRECTION again - missing functionality should only be taken into account on lowest level as long as it can be emulated. * Made FontServer a bit clearer to use (more to come). * fixed several allocation leaks in the font server communication. * New FontStyle::Direction() method, that currently only returns B_FONT_LEFT_TO_RIGHT, though. * more cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14618 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -3,8 +3,8 @@
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* DarkWyrm <[email protected]>
|
||||
* Jérôme Duval, [email protected]
|
||||
* DarkWyrm <[email protected]>
|
||||
* Jérôme Duval, [email protected]
|
||||
*/
|
||||
|
||||
#ifndef _APPSERVER_PROTOCOL_
|
||||
@@ -125,10 +125,7 @@ enum {
|
||||
AS_GET_FONT_HEIGHT,
|
||||
|
||||
AS_QUERY_FONT_FIXED,
|
||||
AS_SET_FAMILY_NAME,
|
||||
AS_SET_FAMILY_AND_STYLE,
|
||||
AS_SET_FAMILY_AND_STYLE_FROM_ID,
|
||||
AS_SET_FAMILY_AND_FACE,
|
||||
|
||||
AS_COUNT_FONT_FAMILIES,
|
||||
AS_COUNT_FONT_STYLES,
|
||||
|
||||
@@ -147,10 +147,13 @@ class FontStyle : public SharedObject, public BLocker {
|
||||
|
||||
inline uint16 Face() const
|
||||
{ return fFace; }
|
||||
uint16 PreservedFace(uint16) const;
|
||||
|
||||
const char* Path() const;
|
||||
font_height GetHeight(const float& size) const;
|
||||
|
||||
font_direction Direction() const
|
||||
{ return B_FONT_LEFT_TO_RIGHT; }
|
||||
|
||||
inline FT_Face GetFTFace() const
|
||||
{ return fFTFace; }
|
||||
|
||||
@@ -206,8 +209,8 @@ class FontFamily : public SharedObject {
|
||||
void RemoveStyle(FontStyle* style);
|
||||
|
||||
FontStyle* GetStyle(const char* style) const;
|
||||
FontStyle* GetStyleWithFace(uint16 face) const;
|
||||
FontStyle* GetStyleWithID(uint16 face) const;
|
||||
FontStyle* GetStyleMatchingFace(uint16 face) const;
|
||||
FontStyle* GetStyleByID(uint16 face) const;
|
||||
|
||||
uint16 ID() const
|
||||
{ return fID; }
|
||||
|
||||
@@ -4,15 +4,17 @@
|
||||
*
|
||||
* Authors:
|
||||
* DarkWyrm <[email protected]>
|
||||
* Axel Dörfler, [email protected]
|
||||
*/
|
||||
#ifndef FONTSERVER_H_
|
||||
#define FONTSERVER_H_
|
||||
#ifndef FONT_SERVER_H
|
||||
#define FONT_SERVER_H
|
||||
|
||||
|
||||
#include <OS.h>
|
||||
#include <List.h>
|
||||
#include <SupportDefs.h>
|
||||
#include <Font.h>
|
||||
#include <Locker.h>
|
||||
#include <OS.h>
|
||||
#include <ObjectList.h>
|
||||
#include <SupportDefs.h>
|
||||
|
||||
#include <ft2build.h>
|
||||
#include FT_FREETYPE_H
|
||||
@@ -22,60 +24,59 @@ class FontFamily;
|
||||
class FontStyle;
|
||||
class ServerFont;
|
||||
|
||||
|
||||
/*!
|
||||
\class FontServer FontServer.h
|
||||
\brief Manager for the largest part of the font subsystem
|
||||
*/
|
||||
class FontServer : public BLocker {
|
||||
public:
|
||||
FontServer();
|
||||
~FontServer();
|
||||
public:
|
||||
FontServer();
|
||||
~FontServer();
|
||||
|
||||
/*!
|
||||
\brief Determines whether the font server has started up properly
|
||||
\return true if so, false if not.
|
||||
*/
|
||||
bool IsInitialized() { return fInit; }
|
||||
int32 CountFamilies();
|
||||
int32 CountStyles(const char *family);
|
||||
void RemoveFamily(const char *family);
|
||||
void ScanSystemFolders();
|
||||
status_t ScanDirectory(const char *path);
|
||||
void SaveList();
|
||||
status_t InitCheck() { return fInitStatus; }
|
||||
|
||||
const char *GetFamilyName(uint16 id) const;
|
||||
const char *GetStyleName(const char *family, uint16 id) const;
|
||||
int32 CountFamilies();
|
||||
int32 CountStyles(const char *family);
|
||||
void RemoveFamily(const char *family);
|
||||
void ScanSystemFolders();
|
||||
status_t ScanDirectory(const char *path);
|
||||
void SaveList();
|
||||
|
||||
FontStyle *GetStyle(const char *family, const char *style, uint16 face = 0);
|
||||
FontStyle *GetStyle(const char *family, uint16 id) const;
|
||||
FontStyle *GetStyle(uint16 familyID, uint16 styleID);
|
||||
FontFamily *GetFamily(uint16 familyID) const;
|
||||
FontFamily *GetFamily(const char *name) const;
|
||||
FontFamily* GetFamilyByIndex(int32 index) const;
|
||||
FontFamily *GetFamily(uint16 familyID) const;
|
||||
FontFamily *GetFamily(const char *name) const;
|
||||
|
||||
ServerFont *GetSystemPlain();
|
||||
ServerFont *GetSystemBold();
|
||||
ServerFont *GetSystemFixed();
|
||||
FontStyle *GetStyleByIndex(const char *family, int32 index) const;
|
||||
FontStyle *GetStyle(const char *family, const char *style, uint16 familyID = 0xffff,
|
||||
uint16 styleID = 0xffff, uint16 face = 0);
|
||||
FontStyle *GetStyle(const char *family, uint16 styleID);
|
||||
FontStyle *GetStyle(uint16 familyID, uint16 styleID);
|
||||
|
||||
bool SetSystemPlain(const char *family, const char *style, float size);
|
||||
bool SetSystemBold(const char *family, const char *style, float size);
|
||||
bool SetSystemFixed(const char *family, const char *style, float size);
|
||||
ServerFont *GetSystemPlain();
|
||||
ServerFont *GetSystemBold();
|
||||
ServerFont *GetSystemFixed();
|
||||
|
||||
bool FontsNeedUpdated() { return fNeedUpdate; }
|
||||
/*!
|
||||
\brief Called when the fonts list has been updated
|
||||
*/
|
||||
void FontsUpdated() { fNeedUpdate = false; }
|
||||
bool SetSystemPlain(const char *family, const char *style, float size);
|
||||
bool SetSystemBold(const char *family, const char *style, float size);
|
||||
bool SetSystemFixed(const char *family, const char *style, float size);
|
||||
|
||||
protected:
|
||||
uint16 TranslateStyleToFace(const char *name) const;
|
||||
|
||||
FT_CharMap _GetSupportedCharmap(const FT_Face &face);
|
||||
bool FontsNeedUpdated() { return fNeedUpdate; }
|
||||
/*!
|
||||
\brief Called when the fonts list has been updated
|
||||
*/
|
||||
void FontsUpdated() { fNeedUpdate = false; }
|
||||
|
||||
private:
|
||||
bool fInit;
|
||||
BList fFamilies;
|
||||
ServerFont *fPlain, *fBold, *fFixed;
|
||||
bool fNeedUpdate;
|
||||
protected:
|
||||
uint16 TranslateStyleToFace(const char *name) const;
|
||||
|
||||
FT_CharMap _GetSupportedCharmap(const FT_Face &face);
|
||||
|
||||
private:
|
||||
status_t fInitStatus;
|
||||
BObjectList<FontFamily> fFamilies;
|
||||
ServerFont *fPlain, *fBold, *fFixed;
|
||||
bool fNeedUpdate;
|
||||
};
|
||||
|
||||
extern FTC_Manager ftmanager;
|
||||
|
||||
Reference in New Issue
Block a user