Files
haiku-beta6/headers/private/servers/app/FontServer.h
T
Axel Dörfler b4f34cfb95 * style and family IDs are no longer just the index in their parent's lists (as
they can disappear and IDs should stay persistent at least as long as the
  system runs).
* destroying a FontStyle discards its FT_Face again.
* the font style and family names are now truncated to the appropriate length,
  so that they can always be used via the Be API.
* (char *) == (char *) hardly compares the string (but was probably introduced
  by me when I stopped FontFamily from accessing FontStyle privates
* removed FontServer::SaveList() - made no particular sense to me.
* removed superfluous "inline" keyword in the FontStyle definition.
* more cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14619 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-01 17:49:01 +00:00

89 lines
2.1 KiB
C++

/*
* Copyright 2001-2005, Haiku.
* Distributed under the terms of the MIT License.
*
* Authors:
* DarkWyrm <[email protected]>
* Axel Dörfler, [email protected]
*/
#ifndef FONT_SERVER_H
#define FONT_SERVER_H
#include <Font.h>
#include <Locker.h>
#include <OS.h>
#include <ObjectList.h>
#include <SupportDefs.h>
#include <ft2build.h>
#include FT_FREETYPE_H
#include FT_CACHE_H
class BPath;
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();
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; }
private:
void _AddFont(BPath &path);
FT_CharMap _GetSupportedCharmap(const FT_Face &face);
private:
status_t fInitStatus;
BObjectList<FontFamily> fFamilies;
ServerFont *fPlain, *fBold, *fFixed;
bool fNeedUpdate;
int32 fNextID;
};
extern FTC_Manager ftmanager;
extern FT_Library ftlib;
extern FontServer *gFontServer;
#endif /* FONTSERVER_H_ */