3#include "ResourceManager.h"
5#include <unordered_map>
9#include "IFontLoader.h"
16 struct hash<
Cogs::Core::FontDefinition>
20 size_t val = std::hash<std::string>()(definition.
fontFamily);
21 val *= std::hash<float>()(definition.
fontSize);
32 class IGraphicsDevice;
52 void clear()
override;
A Context instance contains all the services, systems and runtime components needed to use Cogs.
Font manager responsible for loading, processing and lifetime of Font resources.
ResourceId DefaultMonospaceFont
Id of the default monospace font.
FontManager(Context *context)
Constructs a FontManager in the given context.
std::unordered_map< FontDefinition, FontHandle > sharedFonts
FontHandle boldFont
Handle to the bold font.
FontHandle regularFont
Handle to the regular font.
ActivationResult handleActivation(FontHandle handle, Font *font) override
Overridden to activate loaded font resources, triggering loading of the font Texture.
void handleDeletion(Font *font) override
Handler for deletion of resources.
ResourceId DefaultRegularFont
Id of the default font.
~FontManager() override
Destructs the FontManaer.
void clear() override
Clear the FontManager, releasing all default Font resources.
void getBakedCharacter(const Font *font, int characterIndex, float &x, float &y, Font::BakedCharacter &bakedCharacter) const
Retrieve baked character information for rendering.
void handleLoad(FontLoadInfo *loadInfo) override
Overridden to load Font resources.
void handleFailedLoad(const FontLoadInfo *loadInfo) override
Handle failed Font loads, logging and cleaning up.
virtual bool shouldMergeBySource() const override
Checking unique handle should not be performed using resource path only. Handled in FontManager.
ResourceId DefaultBoldFont
Id of the default bold font.
void initialize() override
Initialize the FontManager, creating default Font resources.
COGSCORE_DLL_API FontHandle loadFont(const std::string &name, float size, ResourceId resourceId, ResourceLoadFlags flags=ResourceLoadFlags::None)
Load a Font resource from the file resource with the given name.
The generic resource manager provides a base implementation for specialized resource managers to buil...
ActivationResult
Defines results for resource activation.
ResourceLoadFlags
Flags for describing how to load a resource.
@ None
No flags specified,.
Contains all Cogs related functionality.
std::string fontFamily
Font family name, such as "Arial" or "Tahoma".
float fontSize
Size of the font in pixels.
Defines information used to load a Font resource.
Defines a quad with locations in screen space defined by [x0, y0] and [x1, y1].
Font resources are used to render text with a specific font and size.
static const ResourceHandle_t NoHandle
Handle representing a default (or none if default not present) resource.