- nom
- BitmapFont
Public Member Functions | |
| BitmapFont (void) | |
| Default constructor. | |
| ~BitmapFont (void) | |
| Default destructor. | |
| IFont::SharedPtr | clone (void) const |
| Return a std::shared_ptr copy of this instance. | |
| const std::string & | getText (void) const |
| Obtains set text string buffer; defaults to \0. | |
| void | setText (const std::string &text) |
| Set a new text string for drawing; defaults to \0. | |
| int32 | getFontWidth (void) const |
| int32 | getFontHeight (void) const |
| const Color & | getColor (void) const |
| const Coords & | getPosition (void) const |
| uint32 | getSpacing (void) const |
| void | setSpacing (uint32 spaces) |
| uint32 | getNewline (void) const |
| IFont::TextAlignment | getTextJustification (void) const |
| void | setNewline (uint32_t newline) |
| Set new text character spacing height offsets in pixels. | |
| IFont::FontStyle | getFontStyle (void) const |
| void | setFontStyle (int32 style, uint8 options=150) |
| void | setColor (const Color &color) |
| Not implemented. More... | |
| void | setPosition (const Coords &coords) |
| void | setTextJustification (IFont::TextAlignment alignment) |
| const Coords | findGlyph (const std::string &glyph) |
| bool | load (const std::string &filename, const Color &colorkey, bool use_cache=false) |
| void | update (void) |
| void | draw (RenderTarget target) const |
| bool | resize (enum ResizeAlgorithm scaling_algorithm) |
Public Member Functions inherited from nom::IFont | |
| virtual void | setFontSize (int32 point_size) |
| virtual IFont::RenderStyle | getRenderingStyle (void) const |
| virtual void | setRenderingStyle (IFont::RenderStyle) |
Public Member Functions inherited from nom::IDrawable | |
| IDrawable (void) | |
| Do nothing at all default constructor. | |
| virtual | ~IDrawable (void) |
| Do nothing at all destructor. | |
Private Member Functions | |
| bool | rebuild (void) |
Private Attributes | |
| int32 | sheet_width |
| int32 | sheet_height |
| Texture | bitmap_font |
| pointer reference holding our bitmap font image sheet | |
| Coords | chars [256] |
| individual chars positioning offsets within bitmap_font | |
| Coords | coords |
| Positioning coordinates. | |
| uint32 | newline |
| height (in pixels) to offset when newline carriage char is encountered | |
| uint32 | spacing |
| std::string | text_buffer |
| holds contents of text as a string | |
| enum IFont::FontStyle | text_style |
| Current text effect set. | |
| Color | color |
| Not implemented (yet) | |
| enum IFont::TextAlignment | text_alignment |
| enum IFont::RenderStyle | rendering |
Additional Inherited Members | |
Public Types inherited from nom::IFont | |
| enum | FontStyle { Regular = 0, Bold = 1, Italic = 2, Underlined = 3, Faded = 4 } |
| Text effect styling. | |
| enum | TextAlignment { TopLeft = 0, TopCenter, TopRight, MiddleLeft, MiddleCenter, MiddleRight, BottomLeft, BottomCenter, BottomRight } |
| enum | RenderStyle { NotImplemented = 0, Solid, Shaded, Blended } |
| Text rendering qualities. | |
| typedef IFont * | RawPtr |
| typedef std::unique_ptr< IFont > | UniquePtr |
| typedef std::shared_ptr< IFont > | SharedPtr |
Public Types inherited from nom::IDrawable | |
|
typedef std::unique_ptr < IDrawable > | UniquePtr |
| std::unique_ptr definition type for your convenience, sir! | |
|
typedef std::shared_ptr < IDrawable > | SharedPtr |
| std::shared_ptr definition type at your leisure, sir! | |
|
typedef std::vector < std::shared_ptr< IDrawable > > | SharedDrawables |
| Vector of std::shared_ptr definition type for the brotherhood, sir! | |
|
typedef std::vector < std::unique_ptr< IDrawable > > | UniqueDrawables |
| std::unique_ptr vector container type | |
| typedef const Window & | RenderTarget |
Definition at line 53 of file BitmapFont.hpp.
|
virtual |
Draw the set text string to the video surface
Implements nom::IDrawable.
Definition at line 460 of file BitmapFont.cpp.
|
virtual |
Obtain the text height in pixels of the set text string.
This calculation mimics the rendering calculations done and should be exact within one pixel accuracy.
Implements nom::IFont.
Definition at line 113 of file BitmapFont.cpp.
|
virtual |
Obtain the text width in pixels of the set text string.
This calculation mimics the rendering calculations done and should be exact within one pixel accuracy.
Rename me to text_width
Support multi-line texts
Implements nom::IFont.
Definition at line 72 of file BitmapFont.cpp.
|
virtual |
Obtain text character spacing height offsets in pixels; defaults to variable calculations made within Load method
Implements nom::IFont.
Definition at line 186 of file BitmapFont.cpp.
|
virtual |
Obtain text character spacing width in pixels; this variable is affected by the total image width size.
Implements nom::IFont.
Definition at line 176 of file BitmapFont.cpp.
|
virtual |
Loads a new bitmap font from a file
Implements nom::IFont.
Definition at line 415 of file BitmapFont.cpp.
|
private |
Trigger a rebuild of the font characteristics gleaned from the image file; recalculate the character sizes, coordinate origins, spacing, etc.
Definition at line 246 of file BitmapFont.cpp.
|
virtual |
Rescale the font with a chosen resizing algorithm
Re-implements IFont::resize
Reimplemented from nom::IFont.
Definition at line 530 of file BitmapFont.cpp.
|
virtual |
Not implemented.
Not implemented
Implements nom::IFont.
Definition at line 161 of file BitmapFont.cpp.
|
virtual |
Text effect utilizing alpha channels for the appearance of gray text
Implements nom::IFont.
Definition at line 206 of file BitmapFont.cpp.
|
virtual |
Set new text character spacing width (in pixels) – this variable is used during the calculation of the text width (see getFontWidth method) in addition to the rendering process (see draw method) when there is a space character (' ') found in the provided text string.
Implements nom::IFont.
Definition at line 181 of file BitmapFont.cpp.
|
virtual |
Set the justification of the text.
This modifies the destination positions used in rendering text.
Implements nom::IFont.
Definition at line 440 of file BitmapFont.cpp.
|
virtual |
Intended to be used internally by the class re-implementing this method; for use in preparing the buffer to be drawn using the draw method call. Whereas both Update & Draw are typically publicly exposed to the end-user, only the Draw method call should be expected of the end-user to be explicitly called.
Implements nom::IDrawable.
Definition at line 455 of file BitmapFont.cpp.
|
private |
Width in pixels to offset when a space carriage char is encountered.
Note that you may need to reset this if you are using bitmap fonts with high resolution graphics. I recently went from 384x224 to 768x448 and this was enough to offset this variable by 18 pixels.
Definition at line 174 of file BitmapFont.hpp.