Files
haiku-beta6/headers/private/servers/app/FontManager.h
T

111 lines
3.0 KiB
C++
Raw Normal View History

/*
* Copyright 2001-2005, Haiku.
* Distributed under the terms of the MIT License.
*
* Authors:
* DarkWyrm <[email protected]>
2005-11-01 16:28:01 +00:00
* Axel Dörfler, [email protected]
*/
#ifndef FONT_MANAGER_H
#define FONT_MANAGER_H
2005-11-01 16:28:01 +00:00
#include "HashTable.h"
#include <Looper.h>
2005-11-01 16:28:01 +00:00
#include <ObjectList.h>
#include <ft2build.h>
#include FT_FREETYPE_H
class BPath;
class FontFamily;
class FontStyle;
class ServerFont;
2005-11-01 16:28:01 +00:00
/*!
\class FontManager FontManager.h
\brief Manager for the largest part of the font subsystem
*/
class FontManager : public BLooper {
2005-11-01 16:28:01 +00:00
public:
FontManager();
virtual ~FontManager();
2005-11-01 16:28:01 +00:00
status_t InitCheck() { return fInitStatus; }
void SaveRecentFontMappings();
2005-11-01 16:28:01 +00:00
virtual void MessageReceived(BMessage* message);
int32 CheckRevision(uid_t user);
int32 CountFamilies();
int32 CountStyles(const char *family);
FontFamily* FamilyAt(int32 index) const;
2005-11-01 16:28:01 +00:00
FontFamily *GetFamily(uint16 familyID) const;
FontFamily *GetFamily(const char *name);
2005-11-01 16:28:01 +00:00
FontStyle *GetStyleByIndex(const char *family, int32 index);
2005-11-01 16:28:01 +00:00
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) const;
FontStyle* FindStyleMatchingFace(uint16 face) const;
2005-11-01 16:28:01 +00:00
2005-11-10 17:32:35 +00:00
void RemoveStyle(FontStyle* style);
// this call must not be used by anything else than class FontStyle
const ServerFont* DefaultPlainFont() const;
const ServerFont* DefaultBoldFont() const;
const ServerFont* DefaultFixedFont() const;
2005-11-01 16:28:01 +00:00
void AttachUser(uid_t userID);
void DetachUser(uid_t userID);
private:
struct font_directory;
struct font_mapping;
bool _LoadRecentFontMappings();
FontStyle* _GetDefaultStyle(const char *familyName, const char *styleName,
const char *fallbackFamily, const char *fallbackStyle,
uint16 fallbackFace);
status_t _SetDefaultFonts();
void _AddSystemPaths();
2005-11-10 14:52:26 +00:00
font_directory* _FindDirectory(node_ref& nodeRef);
void _RemoveDirectory(font_directory* directory);
status_t _AddPath(const char* path);
status_t _AddPath(BEntry& entry, font_directory** _newDirectory = NULL);
2005-11-10 17:32:35 +00:00
void _RemoveStyle(font_directory& directory, FontStyle* style);
void _RemoveStyle(dev_t device, uint64 directory, uint64 node);
FontFamily* _FindFamily(const char* family) const;
void _ScanFontsIfNecessary();
void _ScanFonts();
status_t _ScanFontDirectory(font_directory& directory);
2005-11-10 14:52:26 +00:00
status_t _AddFont(font_directory& directory, BEntry& entry);
2005-11-01 16:28:01 +00:00
FT_CharMap _GetSupportedCharmap(const FT_Face &face);
private:
status_t fInitStatus;
BObjectList<font_directory> fDirectories;
BObjectList<font_mapping> fMappings;
2005-11-01 16:28:01 +00:00
BObjectList<FontFamily> fFamilies;
HashTable fStyleHashTable;
ServerFont* fDefaultPlainFont;
ServerFont* fDefaultBoldFont;
ServerFont* fDefaultFixedFont;
bool fScanned;
int32 fNextID;
};
extern FT_Library gFreeTypeLibrary;
extern FontManager *gFontManager;
#endif /* FONT_MANAGER_H */