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>
|
|
|
|
*/
|
2003-09-09 14:27:08 +04:00
|
|
|
#ifndef FONTSERVER_H_
|
|
|
|
#define FONTSERVER_H_
|
|
|
|
|
|
|
|
#include <OS.h>
|
|
|
|
#include <List.h>
|
|
|
|
#include <SupportDefs.h>
|
|
|
|
#include <Font.h>
|
2005-06-24 07:31:41 +04:00
|
|
|
#include <Locker.h>
|
|
|
|
|
2003-09-09 14:27:08 +04:00
|
|
|
#include <ft2build.h>
|
|
|
|
#include FT_FREETYPE_H
|
|
|
|
#include FT_CACHE_H
|
|
|
|
|
|
|
|
class FontFamily;
|
|
|
|
class FontStyle;
|
|
|
|
class ServerFont;
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\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 {
|
2003-09-09 14:27:08 +04:00
|
|
|
public:
|
|
|
|
FontServer(void);
|
|
|
|
~FontServer(void);
|
2005-06-24 07:31:41 +04:00
|
|
|
|
2003-09-09 14:27:08 +04:00
|
|
|
/*!
|
|
|
|
\brief Determines whether the font server has started up properly
|
|
|
|
\return true if so, false if not.
|
|
|
|
*/
|
2005-06-24 07:31:41 +04:00
|
|
|
bool IsInitialized(void) { return fInit; }
|
2003-09-09 14:27:08 +04:00
|
|
|
int32 CountFamilies(void);
|
|
|
|
int32 CountStyles(const char *family);
|
|
|
|
void RemoveFamily(const char *family);
|
|
|
|
status_t ScanDirectory(const char *path);
|
|
|
|
void SaveList(void);
|
2005-06-24 07:31:41 +04:00
|
|
|
|
2005-01-17 05:04:21 +03:00
|
|
|
const char *GetFamilyName(uint16 id) const;
|
|
|
|
const char *GetStyleName(const char *family, uint16 id) const;
|
2005-06-24 07:31:41 +04:00
|
|
|
|
2005-01-17 05:04:21 +03:00
|
|
|
FontStyle *GetStyle(const char *family, const char *face);
|
|
|
|
FontStyle *GetStyle(const char *family, uint16 id) const;
|
|
|
|
FontStyle *GetStyle(const uint16 &familyid, const uint16 &styleid);
|
2005-01-17 23:05:36 +03:00
|
|
|
FontFamily *GetFamily(const uint16 &familyid) const;
|
|
|
|
FontFamily *GetFamily(const char *name) const;
|
2005-06-24 07:31:41 +04:00
|
|
|
|
2003-09-09 14:27:08 +04:00
|
|
|
ServerFont *GetSystemPlain(void);
|
|
|
|
ServerFont *GetSystemBold(void);
|
|
|
|
ServerFont *GetSystemFixed(void);
|
2005-06-24 07:31:41 +04:00
|
|
|
|
2003-09-09 14:27:08 +04:00
|
|
|
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);
|
2005-06-24 07:31:41 +04:00
|
|
|
|
|
|
|
bool FontsNeedUpdated(void) { return fNeedUpdate; }
|
2003-09-09 14:27:08 +04:00
|
|
|
/*!
|
|
|
|
\brief Called when the fonts list has been updated
|
|
|
|
*/
|
2005-06-24 07:31:41 +04:00
|
|
|
void FontsUpdated(void) { fNeedUpdate = false; }
|
|
|
|
|
2003-09-09 14:27:08 +04:00
|
|
|
protected:
|
2005-01-17 05:04:21 +03:00
|
|
|
uint16 TranslateStyleToFace(const char *name) const;
|
|
|
|
|
2003-09-09 14:27:08 +04:00
|
|
|
FT_CharMap _GetSupportedCharmap(const FT_Face &face);
|
2005-06-24 07:31:41 +04:00
|
|
|
|
|
|
|
private:
|
|
|
|
bool fInit;
|
|
|
|
BList fFamilies;
|
|
|
|
ServerFont *fPlain, *fBold, *fFixed;
|
|
|
|
bool fNeedUpdate;
|
2003-09-09 14:27:08 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
extern FTC_Manager ftmanager;
|
|
|
|
extern FT_Library ftlib;
|
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_ */
|