xref: /haiku/src/servers/app/font/FontFamily.h (revision 52c4471a3024d2eb81fe88e2c3982b9f8daa5e56)
1 /*
2  * Copyright 2001-2008, 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 FONT_FAMILY_H_
10 #define FONT_FAMILY_H_
11 
12 
13 #include <ObjectList.h>
14 #include <String.h>
15 
16 #include "AppFontManager.h"
17 #include "FontStyle.h"
18 
19 
20 /*!
21 	\class FontFamily FontFamily.h
22 	\brief Class representing a collection of similar styles
23 
24 	FontFamily objects bring together many styles of the same face, such as
25 	Arial Roman, Arial Italic, Arial Bold, etc.
26 */
27 class FontFamily {
28 public:
29 						FontFamily(const char* name, uint16 id);
30 	virtual				~FontFamily();
31 
32 			const char*	Name() const;
33 
34 			bool		AddStyle(FontStyle* style,
35 							AppFontManager* fontManager = NULL);
36 			bool		RemoveStyle(FontStyle* style,
37 							AppFontManager* fontManager = NULL);
38 
39 			FontStyle*	GetStyle(const char* style) const;
40 			FontStyle*	GetStyleMatchingFace(uint16 face) const;
41 			FontStyle*	GetStyleByID(uint16 face) const;
42 
43 			uint16		ID() const
44 							{ return fID; }
45 			uint32		Flags();
46 
47 			bool		HasStyle(const char* style) const;
48 			int32		CountStyles() const;
49 			FontStyle*	StyleAt(int32 index) const;
50 
51 private:
52 			FontStyle*	_FindStyle(const char* name) const;
53 
54 			BString		fName;
55 			BObjectList<FontStyle> fStyles;
56 			uint16		fID;
57 			uint16		fNextID;
58 			uint32		fFlags;
59 };
60 
61 #endif	// FONT_FAMILY_H_
62