3DRadSpace 0.1.0Alpha
3DRadSpace is a free, simple to use, rapid application development game engine.
Loading...
Searching...
No Matches
Engine3DRadSpace.Graphics.Font Class Reference

Represents a Font. More...

#include <Font.hpp>

Inheritance diagram for Engine3DRadSpace.Graphics.Font:
Collaboration diagram for Engine3DRadSpace.Graphics.Font:

Public Member Functions

 Font (IGraphicsDevice device, string path, uint size, string supportedCharacters)
 Font (IGraphicsDevice device, string path, uint size=14)
 Font (IntPtr handle)
Glyph? GetCharGliph (char chr)
Rectangle? GetSourceRectangle (char chr)
 Font (IGraphicsDevice *device, const std::filesystem::path &path, unsigned size, const char *supportedCharacters=nullptr)
 Constructs a Font type, with specified size and supported characters.
 Font (IGraphicsDevice *device, const std::filesystem::path &path)
 Loads a TTF font.
 Font (const Font &)=delete
 Font (Font &&font) noexcept
 Move constructor. Transfers the ownership of the given Font instance to this instance.
Font & operator= (const Font &)=delete
Font & operator= (Font &&other) noexcept
 Move assignment operator.
unsigned Size () const noexcept
 Returns the size the font was created with.
const std::string SupportedCharacters () const noexcept
 Returns a copy of the supported characters.
ITexture2D * GetTexture () const noexcept
 Returns the texture containing all glyphs.
std::optional< Glyph > GetCharGlyph (char chr) const noexcept
 Gets the glyph of a specific character.
std::optional< Math::Rectangle > GetCharSourceRectangle (char chr) const noexcept
 Gets the source rectangle of a specified character.
 ~Font ()
Public Member Functions inherited from Engine3DRadSpace.NatPtrWrapper
virtual void Dispose ()

Properties

uint Size [get]
string SupportedCharacters [get]
ITexture2D Texture [get]
Properties inherited from Engine3DRadSpace.NatPtrWrapper
IntPtr Handle [get]

Additional Inherited Members

Protected Member Functions inherited from Engine3DRadSpace.NatPtrWrapper
 NatPtrWrapper (IntPtr handle, Action< IntPtr > fnDestroy)
 NatPtrWrapper (Action< IntPtr > fnDestroy)
void Reset (IntPtr newObj)
void Dispose (bool disposing)
Protected Attributes inherited from Engine3DRadSpace.NatPtrWrapper
IntPtr _handle
bool _disposed

Detailed Description

Represents a Font.

Fonts are being loaded using FreeType. When loading fonts, a single texture is created containing all supported characters. The texture is trivially packed (in a left-right, up-down order).

Constructor & Destructor Documentation

◆ Font() [1/7]

Engine3DRadSpace.Graphics.Font.Font ( IGraphicsDevice device,
string path,
uint size,
string supportedCharacters )
inline

◆ Font() [2/7]

Engine3DRadSpace.Graphics.Font.Font ( IGraphicsDevice device,
string path,
uint size = 14 )
inline

◆ Font() [3/7]

Engine3DRadSpace.Graphics.Font.Font ( IntPtr handle)
inline

◆ Font() [4/7]

Font::Font ( IGraphicsDevice * device,
const std::filesystem::path & path,
unsigned size,
const char * supportedCharacters = nullptr )

Constructs a Font type, with specified size and supported characters.

Parameters
deviceGraphics device
pathTTF Font path.
sizeFont size
supportedCharactersA C-style string of supported characters.

◆ Font() [5/7]

Font::Font ( IGraphicsDevice * device,
const std::filesystem::path & path )

Loads a TTF font.

Parameters
deviceGraphics Device
pathTTF font file path

◆ Font() [6/7]

◆ Font() [7/7]

Font::Font ( Font && font)
noexcept

Move constructor. Transfers the ownership of the given Font instance to this instance.

Parameters
fontThe Font to move from.

◆ ~Font()

Font::~Font ( )

Member Function Documentation

◆ GetCharGliph()

Glyph? Engine3DRadSpace.Graphics.Font.GetCharGliph ( char chr)
inline

◆ GetCharGlyph()

std::optional< Glyph > Font::GetCharGlyph ( char chr) const
noexcept

Gets the glyph of a specific character.

Parameters
chrCharacter.
Returns
Nullopt if that character is not supported.

◆ GetCharSourceRectangle()

std::optional< Math::Rectangle > Font::GetCharSourceRectangle ( char chr) const
noexcept

Gets the source rectangle of a specified character.

Parameters
chrCharacter.
Returns
Nullopt if that character is not supported.

◆ GetSourceRectangle()

Rectangle? Engine3DRadSpace.Graphics.Font.GetSourceRectangle ( char chr)
inline

◆ GetTexture()

ITexture2D * Font::GetTexture ( ) const
noexcept

Returns the texture containing all glyphs.

Returns
The texture containing all glyphs.

◆ operator=() [1/2]

Font & Engine3DRadSpace.Graphics.Font.operator= ( const Font & )
delete

◆ operator=() [2/2]

Font & Font::operator= ( Font && other)
noexcept

Move assignment operator.

Parameters
otherThe Font to move from.
Returns
The moved Font.

◆ Size()

unsigned Font::Size ( ) const
noexcept

Returns the size the font was created with.

Returns
Font size.

◆ SupportedCharacters()

const std::string Font::SupportedCharacters ( ) const
noexcept

Returns a copy of the supported characters.

Returns
A string containing the supported characters.

Property Documentation

◆ Size

uint Engine3DRadSpace.Graphics.Font.Size
get

◆ SupportedCharacters

string Engine3DRadSpace.Graphics.Font.SupportedCharacters
get

◆ Texture

ITexture2D Engine3DRadSpace.Graphics.Font.Texture
get

The documentation for this class was generated from the following files:
  • E:/3DRadSpace/3DRadSpace_CSharp/Graphics/Font.cs
  • E:/3DRadSpace/Engine3DRadSpace/Graphics/Font.hpp
  • E:/3DRadSpace/Engine3DRadSpace/Graphics/Font.cpp