diff options
Diffstat (limited to '')
-rw-r--r-- | libraries/irrlicht-1.8/include/IGUIFont.h | 104 |
1 files changed, 104 insertions, 0 deletions
diff --git a/libraries/irrlicht-1.8/include/IGUIFont.h b/libraries/irrlicht-1.8/include/IGUIFont.h new file mode 100644 index 0000000..4746c81 --- /dev/null +++ b/libraries/irrlicht-1.8/include/IGUIFont.h | |||
@@ -0,0 +1,104 @@ | |||
1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt | ||
2 | // This file is part of the "Irrlicht Engine". | ||
3 | // For conditions of distribution and use, see copyright notice in irrlicht.h | ||
4 | |||
5 | #ifndef __I_GUI_FONT_H_INCLUDED__ | ||
6 | #define __I_GUI_FONT_H_INCLUDED__ | ||
7 | |||
8 | #include "IReferenceCounted.h" | ||
9 | #include "SColor.h" | ||
10 | #include "rect.h" | ||
11 | #include "irrString.h" | ||
12 | |||
13 | namespace irr | ||
14 | { | ||
15 | namespace gui | ||
16 | { | ||
17 | |||
18 | //! An enum for the different types of GUI font. | ||
19 | enum EGUI_FONT_TYPE | ||
20 | { | ||
21 | //! Bitmap fonts loaded from an XML file or a texture. | ||
22 | EGFT_BITMAP = 0, | ||
23 | |||
24 | //! Scalable vector fonts loaded from an XML file. | ||
25 | /** These fonts reside in system memory and use no video memory | ||
26 | until they are displayed. These are slower than bitmap fonts | ||
27 | but can be easily scaled and rotated. */ | ||
28 | EGFT_VECTOR, | ||
29 | |||
30 | //! A font which uses a the native API provided by the operating system. | ||
31 | /** Currently not used. */ | ||
32 | EGFT_OS, | ||
33 | |||
34 | //! An external font type provided by the user. | ||
35 | EGFT_CUSTOM | ||
36 | }; | ||
37 | |||
38 | //! Font interface. | ||
39 | class IGUIFont : public virtual IReferenceCounted | ||
40 | { | ||
41 | public: | ||
42 | |||
43 | //! Draws some text and clips it to the specified rectangle if wanted. | ||
44 | /** \param text: Text to draw | ||
45 | \param position: Rectangle specifying position where to draw the text. | ||
46 | \param color: Color of the text | ||
47 | \param hcenter: Specifies if the text should be centered horizontally into the rectangle. | ||
48 | \param vcenter: Specifies if the text should be centered vertically into the rectangle. | ||
49 | \param clip: Optional pointer to a rectangle against which the text will be clipped. | ||
50 | If the pointer is null, no clipping will be done. */ | ||
51 | virtual void draw(const core::stringw& text, const core::rect<s32>& position, | ||
52 | video::SColor color, bool hcenter=false, bool vcenter=false, | ||
53 | const core::rect<s32>* clip=0) = 0; | ||
54 | |||
55 | //! Calculates the width and height of a given string of text. | ||
56 | /** \return Returns width and height of the area covered by the text if | ||
57 | it would be drawn. */ | ||
58 | virtual core::dimension2d<u32> getDimension(const wchar_t* text) const = 0; | ||
59 | |||
60 | //! Calculates the index of the character in the text which is on a specific position. | ||
61 | /** \param text: Text string. | ||
62 | \param pixel_x: X pixel position of which the index of the character will be returned. | ||
63 | \return Returns zero based index of the character in the text, and -1 if no no character | ||
64 | is on this position. (=the text is too short). */ | ||
65 | virtual s32 getCharacterFromPos(const wchar_t* text, s32 pixel_x) const = 0; | ||
66 | |||
67 | //! Returns the type of this font | ||
68 | virtual EGUI_FONT_TYPE getType() const { return EGFT_CUSTOM; } | ||
69 | |||
70 | //! Sets global kerning width for the font. | ||
71 | virtual void setKerningWidth (s32 kerning) = 0; | ||
72 | |||
73 | //! Sets global kerning height for the font. | ||
74 | virtual void setKerningHeight (s32 kerning) = 0; | ||
75 | |||
76 | //! Gets kerning values (distance between letters) for the font. If no parameters are provided, | ||
77 | /** the global kerning distance is returned. | ||
78 | \param thisLetter: If this parameter is provided, the left side kerning | ||
79 | for this letter is added to the global kerning value. For example, a | ||
80 | space might only be one pixel wide, but it may be displayed as several | ||
81 | pixels. | ||
82 | \param previousLetter: If provided, kerning is calculated for both | ||
83 | letters and added to the global kerning value. For example, in a font | ||
84 | which supports kerning pairs a string such as 'Wo' may have the 'o' | ||
85 | tucked neatly under the 'W'. | ||
86 | */ | ||
87 | virtual s32 getKerningWidth(const wchar_t* thisLetter=0, const wchar_t* previousLetter=0) const = 0; | ||
88 | |||
89 | //! Returns the distance between letters | ||
90 | virtual s32 getKerningHeight() const = 0; | ||
91 | |||
92 | //! Define which characters should not be drawn by the font. | ||
93 | /** For example " " would not draw any space which is usually blank in | ||
94 | most fonts. | ||
95 | \param s String of symbols which are not send down to the videodriver | ||
96 | */ | ||
97 | virtual void setInvisibleCharacters( const wchar_t *s ) = 0; | ||
98 | }; | ||
99 | |||
100 | } // end namespace gui | ||
101 | } // end namespace irr | ||
102 | |||
103 | #endif | ||
104 | |||