File: VFNTFont.h

package info (click to toggle)
freespace2 24.0.2%2Brepack-1
  • links: PTS, VCS
  • area: non-free
  • in suites: trixie
  • size: 43,188 kB
  • sloc: cpp: 583,107; ansic: 21,729; python: 1,174; sh: 464; makefile: 248; xml: 181
file content (70 lines) | stat: -rw-r--r-- 1,516 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#pragma once

#include "globalincs/pstypes.h"
#include "graphics/software/FSFont.h"

namespace font
{
	struct font;

	/**
	* @brief	A VFNT font
	*
	* Class that contains a font of type FontType::VFNT_FONT
	* Name of the class is derived from the first four bytes of a font file which are "VFNT"
	*/
	class VFNTFont : public FSFont
	{
	private:
		font *fontPtr;  //!< The font pointer

	public:

		/**
		* @brief	Constructor that initializes the object with a primary font pointer
		*
		* @param [in]	fnt	A pointer to the font data. Has to be non-null
		*/
		explicit VFNTFont(font *fnt);

		/**
		* @brief	Destroys the allocated font pointer
		*/
		~VFNTFont() override;

		/**
		* @brief	Gets the font data struct.
		*
		* @return	the font data.
		*/
		font *getFontData();

		/**
		* @brief	Gets the type. This will always return FontType::VFNT_FONT
		*
		* @return	The type.
		*/
		FontType getType() const override;

		/**
		* @brief	Gets the height of this font
		*
		* @see FSFont::getHeight()
		*
		* @return	The height.
		*/
		float getTextHeight() const override;

		/**
		* @brief	Gets the size of the specified string in pixels.
		*
		* @param [in]	text  	the text which should be checked.
		* @param	textLen		  	Length of the text.
		* @param	resize_mode		The used resize mode
		* @param [out]	width 	If non-null, the width.
		* @param [out]	height	If non-null, the height.
		*/
		void
		getStringSize(const char* text, size_t textLen, int resize_mode, float* width, float* height) const override;
	};
}