JNGL
Easy to use cross-platform 2D game library
Loading...
Searching...
No Matches
Classes | Namespaces | Functions
font.hpp File Reference

Contains jngl::Font class and related functions. More...

#include "Rgb.hpp"
#include "Rgba.hpp"
#include "Vec2.hpp"
#include <memory>
#include <string>
Include dependency graph for font.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  Font
 Font loaded from a TTF or OTF file. More...
 

Namespaces

namespace  jngl
 JNGL's main namespace.
 

Functions

void print (const std::string &text, jngl::Vec2 position)
 Print text at position.
 
void print (const std::string &text, int xposition, int yposition)
 Print text at { xposition, yposition }.
 
void print (const Mat3 &modelview, const std::string &text)
 Print text using modelview.
 
int getFontSize ()
 Get the font size used by print()
 
void setFontSize (int size)
 Change the font size used by print()
 
std::string getFont ()
 Returns the currently active font name.
 
void setFont (const std::string &filename)
 Sets the currently active font to filename.
 
void setFontByName (const std::string &name)
 Sets the currently active font by a font name.
 
void setFontColor (Rgba)
 Sets the color and alpha value of the currently active font.
 
void setFontColor (Rgb, float alpha=1.f)
 Sets the color of the currently active font and the alpha value.
 
void setFontColor (unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha=255)
 Sets the color of the currently active font.
 
void pushFontColor (unsigned char red, unsigned char green, unsigned char blue)
 Pushes the currently active font color on a stack and sets a new one.
 
void popFontColor ()
 Resets the font color on the top of stack which is used by jngl::pushFontColor.
 
double getLineHeight ()
 Get line height used py print() in scale-independent pixel.
 
void setLineHeight (double)
 Set line height used by print() in scale-independent pixel.
 
double getTextWidth (const std::string &text)
 Calculates the width of text in scale-independent pixels if it would be drawn with the currently active font.
 

Detailed Description

Contains jngl::Font class and related functions.

Definition in file font.hpp.