 |
Blamite Game Engine - blam!
00398.09.22.23.2015.blamite
The core library for the Blamite Game Engine.
|
Go to the documentation of this file.
7 #include <OGRE/OgreTextureGpu.h>
8 #include <OGRE/Overlay/OgreFont.h>
9 #include <Strings/components/classes/map/map.h>
10 #include <Strings/components/classes/vector/vector.h>
11 #include <Strings/components/diagnostics/errors/errors.h>
12 #include <Strings/components/resources/color/BlamColor.h>
18 #define FONT_TABLE_FILE "font_table.txt"
20 #define FONTINFO_FILENAME "fontinfo.xml"
21 #define FONT_PACKAGE_EXTENSION ".bin"
22 #define FONT_PACKAGE_VERSION 2
49 BlamVector4
uv = { 0, 0, 0, 0 };
63 BlamMap<char, BlamFontGlyph*>
glyphs = BlamMap<char, BlamFontGlyph*>();
BLAM HRESULT ReloadFont(std::string id)
Reloads all data for the specified font.
Definition: fonts.cpp:867
FontGlyphFormat format
The format of the glyph image data. See FontGlyphFormat for more details.
Definition: fonts.h:123
void CleanupFontData(std::string id)
Cleans up all data for the specified font.
Definition: fonts.cpp:846
BlamFontPackage()
Definition: BlamFontPackage.cpp:7
BLAM void LogEvent(std::string message)
Logs a message to the log and/or console.
Definition: aliases.cpp:142
BLAM BlamMap< std::string, BlamFontPackage * > GetFontList()
Definition: fonts_new.cpp:652
int width
Definition: bgfx.cpp:19
BLAM bool FontExists(std::string id)
Checks whether or not a font is loaded.
Definition: fonts.cpp:26
std::string ttf_path
The path to the TrueType font file.
Definition: fonts.h:151
int ttf_offset
The offset of the embedded TrueType font data within the font package.
Definition: fonts.h:139
bool use_point_filtering
Definition: fonts.h:70
Ogre::TextureGpu * glyph_texture
Definition: fonts.h:51
ARPHIC PUBLIC LICENSE Ltd Yung Chi Taiwan All rights reserved except as specified below Everyone is permitted to copy and distribute verbatim copies of this license but changing it is forbidden Preamble The licenses for most software are designed to take away your freedom to share and change it By the ARPHIC PUBLIC LICENSE specifically permits and encourages you to use this provided that you give the recipients all the rights that we gave you and make sure they can get the modifications of this software Legal Terms Font means the TrueType fonts AR PL Mingti2L AR PL KaitiM AR PL KaitiM and the derivatives of those fonts created through any modification including modifying glyph
Definition: ARPHICPL.TXT:16
std::string name
Definition: fonts.h:60
BLAM void LoadAllFonts()
Definition: fonts_new.cpp:64
uint16_t index_y
Definition: fonts.h:47
Ogre::HlmsDatablock * glyph_datablock
Definition: fonts.h:52
Namespace containing things relating to the MF font loader.
Definition: FontLoader.h:44
std::string package_engine_version
The minimum engine version to support the font package version specified.
Definition: fonts.h:137
#define FONT_PACKAGE_EXTENSION
Definition: fonts.h:21
#define BLAM
Definition: fonts.h:15
BLAM ID2D1DeviceContext * GetD2DRenderTarget()
Retrieves the Direct2D render target.
Definition: render_manage.cpp:598
BLAM std::map< std::string, Font > * GetFontList()
Retrieves the list of loaded fonts.
Definition: fonts.cpp:835
BLAM ConfigFile * GetConfig()
Retrieves the engine configuration file.
Definition: compat.cpp:5
std::string file_path
Definition: fonts.h:61
std::string WriteFileToCache(void *data, int length, std::string id)
Writes a block of data to the cache as a file.
Definition: cache.cpp:12
BlamFontGlyph * GetGlyph(char character)
Definition: BlamFontPackage.cpp:25
~BlamFontPackage()
Definition: BlamFontPackage.cpp:12
BLAM void Cleanup()
Clean-up all font data and free any allocated memory for font data.
Definition: fonts.cpp:887
bool use_point_filtering
Definition: fonts.h:41
BLAM Font * GetFont(std::string id)
Retrieves a font from the list of loaded fonts.
Definition: fonts.cpp:806
BLAM HRESULT CreateWICBitmapFromMemory(void *data, int size, IWICBitmap **bitmap_pointer)
Creates a WIC bitmap from a block of memory.
Definition: wic.cpp:173
short charspacing
The amount of space, in pixels, between each character.
Definition: fonts.h:144
int data_length
The length of the glyph's image data. Only used in the case of a font package.
Definition: fonts.h:115
@ Fonts
Directory used for game engine fonts. Defaults to ./maps/fonts/
BlamMap< char, BlamFontGlyph * > glyphs
Definition: fonts.h:63
BLAM HRESULT LoadFont(std::string path)
Load a font from disk.
Definition: fonts.cpp:46
std::string file_path
The path of the glyph's image file. Only used in the case of an unpackaged font.
Definition: fonts.h:125
int data_offset
The file offset of the glyph's raw image data. Only used in the case of a font package.
Definition: fonts.h:114
BLAM BlamFontPackage * GetFont(std::string id)
Definition: fonts_new.cpp:662
uint32_t glyphs_per_column
Definition: fonts.h:73
uint32_t height
Definition: fonts.h:44
bool is_truetype
Whether or not the font is a TrueType based font.
Definition: fonts.h:150
Structure to contain data for a Font Glyph.
Definition: fonts.h:111
int monospace_width
Definition: fonts.h:66
uint32_t width
Definition: fonts.h:43
BlamFontPackageType
Definition: fonts.h:24
Ogre::HlmsDatablock * CreateCopiedDatablock()
Definition: BlamFontPackage.cpp:35
FontGlyphFormat
Enumerator for the image format used in a given font glyph.
Definition: fonts.h:94
Ogre::HlmsDatablock * font_datablock
Definition: fonts.h:76
BLAM HRESULT LoadFontFromFile(std::string id, std::string file_path)
Loads a TrueType font from the specified file into the list of loaded font collections.
Definition: render_manage.cpp:555
BLAM BlamResult LoadFont(std::string font_name)
Definition: fonts_new.cpp:647
int ttf_length
The length of the embedded TrueType font data.
Definition: fonts.h:140
std::map< char, FontGlyph > glyph_list
The list of glyphs for this font.
Definition: fonts.h:163
BLAM void Cleanup()
Definition: fonts_new.cpp:672
ARPHIC PUBLIC LICENSE Ltd Yung Chi Taiwan All rights reserved except as specified below Everyone is permitted to copy and distribute verbatim copies of this license but changing it is forbidden Preamble The licenses for most software are designed to take away your freedom to share and change it By the ARPHIC PUBLIC LICENSE specifically permits and encourages you to use this provided that you give the recipients all the rights that we gave you and make sure they can get the modifications of this software Legal Terms Font means the TrueType fonts AR PL Mingti2L AR PL KaitiM AR PL KaitiM and the derivatives of those fonts created through any modification including modifying reordering converting format
Definition: ARPHICPL.TXT:16
#define ENGINE_DATA_PATH(path)
Macro to quickly access a game engine data folder.
Definition: config.h:36
@ PNG
Indicates the glyph originates from a .PNG image.
Definition: fonts.h:96
BlamFontPackageType type
Definition: fonts.h:62
BLAM ID2D1Factory * GetD2DFactory()
Retrieves the Direct2D factory.
Definition: render_manage.cpp:603
int line_height
Definition: fonts.h:68
#define BL_E_FONT_INVALID_DATA
Definition: errors.h:57
BLAM BlamResult LoadFontPackage(std::string file)
Definition: fonts_new.cpp:69
Ogre::TextureGpu * font_atlas
Definition: fonts.h:75
short size
The size of the font.
Definition: fonts.h:143
#define BL_W_GLYPH_FILE_NOT_FOUND
Definition: errors.h:75
bool monospaced
Whether or not to treat the font as a monospace font.
Definition: fonts.h:145
char character
Definition: fonts.h:38
short mono_width
The width for each character to be. Extra space will be left as needed if the glyph width is too smal...
Definition: fonts.h:146
unsigned int uint32_t
Definition: stdint.h:17
bool monospace
Definition: fonts.h:65
ARPHIC PUBLIC LICENSE Ltd Yung Chi Taiwan All rights reserved except as specified below Everyone is permitted to copy and distribute verbatim copies of this license but changing it is forbidden Preamble The licenses for most software are designed to take away your freedom to share and change it By the ARPHIC PUBLIC LICENSE specifically permits and encourages you to use this provided that you give the recipients all the rights that we gave you and make sure they can get the modifications of this software Legal Terms Font means the TrueType fonts AR PL Mingti2L AR PL KaitiM AR PL KaitiM and the derivatives of those fonts created through any modification including modifying reordering converting changing font or adding deleting some characters in from glyph table PL means Public License Copyright Holder means whoever is named in the copyright or copyrights for the Font You means the or person redistributing or modifying the Font Freely Available means that you have the freedom to copy or modify the Font as well as redistribute copies of the Font under the same conditions you not price If you you can charge for this service Copying &Distribution You may copy and distribute verbatim copies of this Font in any without provided that you retain this license including modifying reordering converting changing font or adding deleting some characters in from glyph and copy and distribute such modifications under the terms of Section provided that the following conditions are such as by offering access to copy the modifications from a designated or distributing the modifications on a medium customarily used for software interchange c If the modified fonts normally reads commands interactively when you must cause it
Definition: ARPHICPL.TXT:36
Structure to contain data for a Font.
Definition: fonts.h:134
#define FONT_TABLE_FILE
Definition: fonts.h:18
BlamVector4 uv
Definition: fonts.h:49
bool is_font_package
Whether or not the data originates from a font package.
Definition: fonts.h:138
sock planetquake com All rights reserved Quake III Arena is a registered trademark of id Inc This level may be electronically distributed only at NO CHARGE to the recipient in its current MUST include this txt file
Definition: chiropteraDM.txt:95
std::string path
The path of the font package, excluding the file extension.
Definition: fonts.h:154
std::string file_path
The path to either the font package or the fontinfo.xml file for this font.
Definition: fonts.h:155
BLAM HRESULT CreateWICBitmapFromFile(std::wstring path, IWICBitmap **bitmap_pointer)
Creates a WIC bitmap from a file.
Definition: wic.cpp:141
#define BL_S_FONT_LOADED_OK_BAD_GLYPHS
Definition: errors.h:66
Ogre::HlmsDatablock * CreateCopiedDatablock()
Definition: BlamFontGlyph.cpp:7
short width
The width of the glyph image, in pixels.
Definition: fonts.h:121
int height
Definition: bgfx.cpp:20
void * bitmap_data
The raw image data loaded from a font package. This must be available for the lifetime of the font,...
Definition: fonts.h:128
uint16_t index_x
Definition: fonts.h:46
bool resolve_glyph_character(std::string xml_glyph, char *character)
Identify the character of the font glyph from the XML attribute.
Definition: fonts.cpp:755
short space_width
The amount of space, in pixels, to use for the space character.
Definition: fonts.h:147
BLAM std::string GetStringFromHResult(HRESULT hr)
Converts a result handle to a string.
Definition: errors.cpp:120
Ogre::FontPtr ttf_font
Definition: fonts.h:77
std::map< std::string, Font > font_list
Definition: fonts.cpp:23
FontGlyphFormat GetGlyphFormatFromString(std::string format)
Evaluates a string into the appropriate FontGlyphFormat.
Definition: fonts.cpp:680
BLAM FontGlyph * GetFontGlyph(Font *font, char glyph)
Retrieves a glyph from a font.
Definition: fonts.cpp:820
uint32_t glyphs_per_row
Definition: fonts.h:72
char character
The character that the glyph represents.
Definition: fonts.h:118
bool override_filtering
Definition: fonts.h:40
std::string id
The unique ID of the font.
Definition: fonts.h:142
short line_height
The amount of space, in pixels, between each line.
Definition: fonts.h:148
int charspacing
Definition: fonts.h:67
BLAM BlamResult LoadFontDirectory(std::string directory)
Definition: fonts_new.cpp:74
std::string ttf_name
The display name of the TrueType font file. TODO: Make this shit automated.
Definition: fonts.h:152
unsigned short uint16_t
Definition: stdint.h:16
BLAM bool FontExists(std::string id)
Definition: fonts_new.cpp:657
short height
The height of the glyph image, in pixels.
Definition: fonts.h:122
int space_width
Definition: fonts.h:69
IWICBitmap * bitmap
The WIC bitmap for this glyph.
Definition: fonts.h:127
std::string path
The path of the glyph's image file, relative to fontinfo.xml's location. Only used in the case of an ...
Definition: fonts.h:124
#define FONT_PACKAGE_VERSION
Definition: fonts.h:22
#define FONTINFO_FILENAME
Definition: fonts.h:20
HRESULT LoadGlyph(char character, int width, int height, std::string bitmap_path, std::string format, Font *font)
Creates a FontGlyph from the provided data.
Definition: fonts.cpp:705
BLAM void LoadAllFonts()
Loads all fonts available in the engine's configured font directory.
Definition: fonts.cpp:900
short package_version
The version of the font package.
Definition: fonts.h:136