xref: /haiku/src/servers/app/font/FontFamily.h (revision 13581b3d2a71545960b98fefebc5225b5bf29072)
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 <Referenceable.h>
15 #include <String.h>
16 
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 : public BReferenceable {
28 public:
29 						FontFamily(const char* name, uint16 id);
30 
31 			const char*	Name() const;
32 
33 			bool		AddStyle(FontStyle* style);
34 			bool		RemoveStyle(FontStyle* style);
35 
36 			FontStyle*	GetStyle(const char* style) const;
37 			FontStyle*	GetStyleMatchingFace(uint16 face) const;
38 
39 			uint16		ID() const
40 							{ return fID; }
41 			uint32		Flags();
42 
43 			bool		HasStyle(const char* style) const;
44 			int32		CountStyles() const;
45 			FontStyle*	StyleAt(int32 index) const;
46 
47 private:
48 			FontStyle*	_FindStyle(const char* name) const;
49 
50 			BString		fName;
51 			BObjectList<FontStyle> fStyles;
52 			uint16		fID;
53 			uint16		fNextID;
54 			uint32		fFlags;
55 };
56 
57 #endif	// FONT_FAMILY_H_
58