xref: /haiku/src/servers/app/font/AppFontManager.h (revision 52c4471a3024d2eb81fe88e2c3982b9f8daa5e56)
1 /*
2  * Copyright 2001-2009, Haiku.
3  * Distributed under the terms of the MIT License.
4  *
5  * Authors:
6  *		DarkWyrm <bpmagic@columbus.rr.com>
7  *		Axel Dörfler, axeld@pinc-software.de
8  */
9 #ifndef APP_FONT_MANAGER_H
10 #define APP_FONT_MANAGER_H
11 
12 
13 #include "FontManager.h"
14 
15 
16 #include <AutoDeleter.h>
17 #include <HashMap.h>
18 #include <Looper.h>
19 #include <ObjectList.h>
20 #include <Referenceable.h>
21 
22 
23 #include <ft2build.h>
24 #include FT_FREETYPE_H
25 
26 class BEntry;
27 class BPath;
28 struct node_ref;
29 
30 class FontFamily;
31 class FontStyle;
32 class ServerFont;
33 
34 
35 // font areas should be less than 20MB
36 #define MAX_FONT_DATA_SIZE_BYTES	20 * 1024 * 1024
37 #define MAX_USER_FONTS				128
38 
39 /*!
40 	\class AppFontManager AppFontManager.h
41 	\brief Manager for application-added fonts in the font subsystem
42 */
43 class AppFontManager : public FontManagerBase {
44 public:
45 								AppFontManager();
46 	virtual						~AppFontManager();
47 
48 	virtual	void				MessageReceived(BMessage* message);
49 
50 			status_t			AddUserFontFromFile(const char* path,
51 									uint16& familyID, uint16& styleID);
52 			status_t			AddUserFontFromMemory(const FT_Byte* fontAddress,
53 									uint32 size, uint16& familyID, uint16& styleID);
54 			status_t			RemoveUserFont(uint16 familyID, uint16 styleID);
55 
56 private:
57 			status_t			_AddUserFont(FT_Face face, node_ref nodeRef,
58 									const char* path,
59 									uint16& familyID, uint16& styleID);
60 private:
61 
62 			int32				fNextID;
63 };
64 
65 
66 #endif	/* APP_FONT_MANAGER_H */
67