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-02 16:25:39 +03:00
|
|
|
#ifndef FONT_MANAGER_H
|
|
|
|
#define FONT_MANAGER_H
|
2005-11-01 19:28:01 +03:00
|
|
|
|
2003-09-09 14:27:08 +04:00
|
|
|
|
2005-11-03 20:03:36 +03:00
|
|
|
#include <Looper.h>
|
2005-11-01 19:28:01 +03:00
|
|
|
#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
|
|
|
/*!
|
2005-11-02 16:25:39 +03:00
|
|
|
\class FontManager FontManager.h
|
2003-09-09 14:27:08 +04:00
|
|
|
\brief Manager for the largest part of the font subsystem
|
|
|
|
*/
|
2005-11-03 20:03:36 +03:00
|
|
|
class FontManager : public BLooper {
|
2005-11-01 19:28:01 +03:00
|
|
|
public:
|
2005-11-02 16:25:39 +03:00
|
|
|
FontManager();
|
2005-11-03 20:03:36 +03:00
|
|
|
virtual ~FontManager();
|
2005-11-01 19:28:01 +03:00
|
|
|
|
|
|
|
status_t InitCheck() { return fInitStatus; }
|
2005-11-06 21:58:09 +03:00
|
|
|
void SaveRecentFontMappings();
|
2005-11-01 19:28:01 +03:00
|
|
|
|
2005-11-03 20:03:36 +03:00
|
|
|
virtual void MessageReceived(BMessage* message);
|
|
|
|
|
2005-11-07 20:33:24 +03:00
|
|
|
int32 CheckRevision(uid_t user);
|
2005-11-06 21:58:09 +03:00
|
|
|
int32 CountFamilies();
|
|
|
|
|
|
|
|
int32 CountStyles(const char *family);
|
2005-11-03 20:03:36 +03:00
|
|
|
FontFamily* FamilyAt(int32 index) const;
|
2005-11-01 19:28:01 +03:00
|
|
|
|
|
|
|
FontFamily *GetFamily(uint16 familyID) const;
|
2005-11-06 21:58:09 +03:00
|
|
|
FontFamily *GetFamily(const char *name);
|
2005-11-01 19:28:01 +03:00
|
|
|
|
2005-11-06 21:58:09 +03:00
|
|
|
FontStyle *GetStyleByIndex(const char *family, int32 index);
|
2005-11-01 19:28:01 +03: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);
|
2005-11-06 21:58:09 +03:00
|
|
|
FontStyle *GetStyle(uint16 familyID, uint16 styleID) const;
|
2005-11-03 20:03:36 +03:00
|
|
|
FontStyle* FindStyleMatchingFace(uint16 face) const;
|
2005-11-01 19:28:01 +03:00
|
|
|
|
2005-11-03 20:03:36 +03:00
|
|
|
const ServerFont* DefaultFont() const;
|
2005-11-01 19:28:01 +03:00
|
|
|
|
2005-11-03 20:03:36 +03:00
|
|
|
void AttachUser(uid_t userID);
|
|
|
|
void DetachUser(uid_t userID);
|
|
|
|
|
2005-11-01 20:49:01 +03:00
|
|
|
private:
|
2005-11-06 21:58:09 +03:00
|
|
|
struct font_directory;
|
|
|
|
struct font_mapping;
|
|
|
|
|
|
|
|
bool _LoadRecentFontMappings();
|
|
|
|
status_t _SetDefaultFont();
|
|
|
|
void _AddSystemPaths();
|
2005-11-03 20:03:36 +03:00
|
|
|
status_t _AddPath(const char* path);
|
2005-11-06 21:58:09 +03:00
|
|
|
status_t _AddPath(BEntry& entry, font_directory** _newDirectory = NULL);
|
2005-11-03 20:03:36 +03:00
|
|
|
|
2005-11-06 21:58:09 +03:00
|
|
|
FontFamily* _FindFamily(const char* family) const;
|
|
|
|
void _RemoveFamily(const char* family);
|
2005-11-03 20:03:36 +03:00
|
|
|
|
2005-11-06 21:58:09 +03:00
|
|
|
void _ScanFontsIfNecessary();
|
|
|
|
void _ScanFonts();
|
|
|
|
status_t _ScanFontDirectory(font_directory& directory);
|
|
|
|
status_t _AddFont(BPath& path);
|
2005-11-01 19:28:01 +03:00
|
|
|
|
|
|
|
FT_CharMap _GetSupportedCharmap(const FT_Face &face);
|
|
|
|
|
|
|
|
private:
|
|
|
|
status_t fInitStatus;
|
2005-11-06 21:58:09 +03:00
|
|
|
BObjectList<font_directory> fDirectories;
|
|
|
|
BObjectList<font_mapping> fMappings;
|
2005-11-01 19:28:01 +03:00
|
|
|
BObjectList<FontFamily> fFamilies;
|
2005-11-03 20:03:36 +03:00
|
|
|
ServerFont *fDefaultFont;
|
2005-11-06 21:58:09 +03:00
|
|
|
bool fScanned;
|
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-11-02 16:25:39 +03:00
|
|
|
extern FontManager *gFontManager;
|
2003-09-09 14:27:08 +04:00
|
|
|
|
2005-11-02 16:25:39 +03:00
|
|
|
#endif /* FONT_MANAGER_H */
|