2005-06-24 07:31:41 +04:00
|
|
|
/*
|
|
|
|
* Copyright 2001-2005, Haiku.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*
|
|
|
|
* Authors:
|
|
|
|
* DarkWyrm <bpmagic@columbus.rr.com>
|
2005-11-01 19:28:01 +03:00
|
|
|
* Axel Dörfler, axeld@pinc-software.de
|
2005-06-24 07:31:41 +04:00
|
|
|
*/
|
2005-11-01 19:28:01 +03:00
|
|
|
#ifndef FONT_SERVER_H
|
|
|
|
#define FONT_SERVER_H
|
|
|
|
|
2003-09-09 14:27:08 +04:00
|
|
|
|
|
|
|
#include <Font.h>
|
2005-06-24 07:31:41 +04:00
|
|
|
#include <Locker.h>
|
2005-11-01 19:28:01 +03:00
|
|
|
#include <OS.h>
|
|
|
|
#include <ObjectList.h>
|
|
|
|
#include <SupportDefs.h>
|
2005-06-24 07:31:41 +04:00
|
|
|
|
2003-09-09 14:27:08 +04:00
|
|
|
#include <ft2build.h>
|
|
|
|
#include FT_FREETYPE_H
|
|
|
|
#include FT_CACHE_H
|
|
|
|
|
2005-11-01 20:49:01 +03:00
|
|
|
class BPath;
|
|
|
|
|
2003-09-09 14:27:08 +04:00
|
|
|
class FontFamily;
|
|
|
|
class FontStyle;
|
|
|
|
class ServerFont;
|
|
|
|
|
2005-11-01 19:28:01 +03:00
|
|
|
|
2003-09-09 14:27:08 +04:00
|
|
|
/*!
|
|
|
|
\class FontServer FontServer.h
|
|
|
|
\brief Manager for the largest part of the font subsystem
|
|
|
|
*/
|
2005-06-24 07:31:41 +04:00
|
|
|
class FontServer : public BLocker {
|
2005-11-01 19:28:01 +03:00
|
|
|
public:
|
|
|
|
FontServer();
|
|
|
|
~FontServer();
|
|
|
|
|
|
|
|
status_t InitCheck() { return fInitStatus; }
|
|
|
|
|
|
|
|
int32 CountFamilies();
|
|
|
|
int32 CountStyles(const char *family);
|
|
|
|
void RemoveFamily(const char *family);
|
|
|
|
void ScanSystemFolders();
|
|
|
|
status_t ScanDirectory(const char *path);
|
|
|
|
|
|
|
|
FontFamily* GetFamilyByIndex(int32 index) const;
|
|
|
|
FontFamily *GetFamily(uint16 familyID) const;
|
|
|
|
FontFamily *GetFamily(const char *name) const;
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
ServerFont *GetSystemPlain();
|
|
|
|
ServerFont *GetSystemBold();
|
|
|
|
ServerFont *GetSystemFixed();
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
bool FontsNeedUpdated() { return fNeedUpdate; }
|
|
|
|
/*!
|
|
|
|
\brief Called when the fonts list has been updated
|
|
|
|
*/
|
|
|
|
void FontsUpdated() { fNeedUpdate = false; }
|
|
|
|
|
2005-11-01 20:49:01 +03:00
|
|
|
private:
|
|
|
|
void _AddFont(BPath &path);
|
2005-11-01 19:28:01 +03:00
|
|
|
|
|
|
|
FT_CharMap _GetSupportedCharmap(const FT_Face &face);
|
|
|
|
|
|
|
|
private:
|
|
|
|
status_t fInitStatus;
|
|
|
|
BObjectList<FontFamily> fFamilies;
|
|
|
|
ServerFont *fPlain, *fBold, *fFixed;
|
|
|
|
bool fNeedUpdate;
|
2005-11-01 20:49:01 +03:00
|
|
|
int32 fNextID;
|
2003-09-09 14:27:08 +04:00
|
|
|
};
|
|
|
|
|
2005-11-02 11:55:51 +03:00
|
|
|
extern FT_Library gFreeTypeLibrary;
|
2005-06-24 07:31:41 +04:00
|
|
|
extern FontServer *gFontServer;
|
2003-09-09 14:27:08 +04:00
|
|
|
|
2005-06-24 07:31:41 +04:00
|
|
|
#endif /* FONTSERVER_H_ */
|