![]() |
Gorgon Game Engine
|
Public Member Functions | |
Font () | |
Font (const Font &)=delete | |
Font (Graphics::GlyphRenderer &renderer) | |
Filling constructor, for now can only hold Graphics::BitmapFont. More... | |
virtual | ~Font () |
void | AssumeRenderer (Graphics::GlyphRenderer &renderer) |
Changes the renderer to the given renderer and assumes ownership. More... | |
virtual void | Discard () override |
This function shall discard any transitional data which is not vital after Prepare function is issued. More... | |
virtual GID::Type | GetGID () const override |
This function shall return Gorgon ID of this resource. More... | |
Graphics::GlyphRenderer & | GetRenderer () const |
Returns the renderer stored in this resource. More... | |
bool | HasRenderer () const |
Returns true if the resource has renderer. More... | |
virtual void | Prepare () override |
This function will only prepare images loaded from a resource, does not work for images loaded later. More... | |
Graphics::GlyphRenderer & | Release () |
Releases the renderer. More... | |
void | RemoveRenderer () |
Removes the renderer from this resource. More... | |
void | SetRenderer (Graphics::GlyphRenderer &renderer) |
Changes the renderer to the given renderer. More... | |
![]() | |
Base () | |
Default constructor. More... | |
const Containers::Collection< Base >::ConstIterator | begin () const |
Allows easy iteration through range based fors. More... | |
const Containers::Collection< Base >::ConstIterator | cbegin () const |
Beginning of children. More... | |
const Containers::Collection< Base >::ConstIterator | cend () const |
End of children. More... | |
bool | DeleteResource () |
Safely deletes the resource. More... | |
const Containers::Collection< Base >::ConstIterator | end () const |
Allows easy iteration through range based fors. More... | |
virtual SGuid | GetGuid () const |
Returns the guid of the object. More... | |
const std::string & | GetName () const |
Returns the name of this object. More... | |
Base & | GetParent () const |
Returns the parent. If no parent set, this function throws std::runtime_error. More... | |
Base * | GetParentPtr () const |
Returns the pointer to the parent. This function may return nullptr. More... | |
const Base & | GetRoot () const |
Returns the root of this resource. More... | |
bool | HasParent () const |
Returns whether this object has a parent. More... | |
virtual bool | IsEqual (const SGuid &guid) const |
This function tests whether this object has the given SGuid. More... | |
virtual void | Resolve (File &file) |
This function shall resolve links or similar constructs. More... | |
void | Save (Writer &writer) |
Saves this object into the given writer. The writer should be open prior to this call. More... | |
virtual void | SetGuid (SGuid guid) |
Changes the guid of the object. More... | |
virtual void | SetName (const std::string &name) |
Sets the name of the object. More... | |
Static Public Member Functions | |
static Font * | LoadResource (std::weak_ptr< File > file, std::shared_ptr< Reader > reader, unsigned long size) |
This function loads a bitmap font resource from the given file. More... | |
Protected Member Functions | |
void | save (Writer &writer) const override |
![]() | |
virtual | ~Base () |
Destructor, Always children gets destroyed first. More... | |
void | destroychildren () |
Destroys the children of this resource. More... | |
void | setparenttonullptr (Base &base) |
Sets the parent of an object to nullptr, provides access. More... | |
Protected Attributes | |
Graphics::GlyphRenderer * | data |
bool | isowner |
Containers::Collection< Image > | tobeprepared |
![]() | |
Containers::Collection< Base > | children |
Child objects that this resource object have. More... | |
SGuid | guid |
SGuid to identify this resource object. More... | |
std::string | name |
Name of this resource object, may not be loaded. More... | |
Base * | parent |
Immediate parent of this resource. More... | |
const Base * | root |
Root of this resource. More... | |
Additional Inherited Members | |
![]() | |
const Containers::Collection< Base > & | Children |
The children this object have. More... | |
unsigned long | refcount |
INTERNAL, Reference count, used in linking mechanism. More... | |
Font resource.
Can hold a bitmap font for now. Raster fonts over free type will be implemented later.
Font | ( | ) |
|
virtual |
References Font::data, and Font::isowner.
Font | ( | Graphics::GlyphRenderer & | renderer | ) |
Filling constructor, for now can only hold Graphics::BitmapFont.
All images in the renderer should be bitmaps or their derivatives with data buffers still attached.
References Font::SetRenderer().
void AssumeRenderer | ( | Graphics::GlyphRenderer & | renderer | ) |
Changes the renderer to the given renderer and assumes ownership.
References Font::isowner, and Font::SetRenderer().
|
overridevirtual |
This function shall discard any transitional data which is not vital after Prepare function is issued.
This data can be image pixel buffer sound data buffer. Default behavior is to pass the request to children
Reimplemented from Base.
References Font::data, BitmapFont::Pack(), and Font::tobeprepared.
|
overridevirtual |
This function shall return Gorgon ID of this resource.
Implements Base.
References Gorgon::Resource::GID::Font.
Graphics::GlyphRenderer& GetRenderer | ( | ) | const |
Returns the renderer stored in this resource.
References ASSERT, and Font::data.
bool HasRenderer | ( | ) | const |
Returns true if the resource has renderer.
References Font::data.
|
static |
This function loads a bitmap font resource from the given file.
References Font::Font(), Gorgon::Utils::ASSERT_FALSE(), FreeType::Assume(), BitmapFont::AssumeGlyph(), Font::data, Reader::EatChunk(), Gorgon::Resource::GID::Font_BitmapKerning, Gorgon::Resource::GID::Font_BitmapProps, Gorgon::Resource::GID::Font_Charmap, Gorgon::Resource::GID::Font_Charmap_II, Gorgon::Resource::GID::Font_FreeTypeData, Gorgon::Resource::GID::Font_FreeTypeProps, Gorgon::Resource::GID::Font_Image, Gorgon::Resource::GID::Font_Props, Gorgon::String::From(), BitmapFont::GetBaseLine(), BitmapFont::GetLineGap(), Collection< T_ >::GetSize(), Gorgon::Resource::GID::Image, FreeType::LoadGlyphs(), FreeType::LoadMetrics(), Image::LoadResource(), Collection< T_ >::Push(), Reader::ReadArray(), Reader::ReadChunkSize(), Reader::ReadCommonChunk(), Reader::ReadFloat(), Reader::ReadGID(), Reader::ReadInt32(), Reader::ReadPointf(), Reader::ReadUInt32(), BitmapFont::SetBaseline(), BitmapFont::SetGlyphSpacing(), BitmapFont::SetHeight(), BitmapFont::SetKerning(), BitmapFont::SetLineGap(), BitmapFont::SetLineThickness(), BitmapFont::SetMaxWidth(), BitmapFont::SetUnderlineOffset(), and Reader::Target().
|
overridevirtual |
This function will only prepare images loaded from a resource, does not work for images loaded later.
Reimplemented from Base.
References Base::Prepare(), and Font::tobeprepared.
Graphics::GlyphRenderer& Release | ( | ) |
Releases the renderer.
If renderer is created by loading resource or set by assume renderer, it will be destroyed along with the resource. This function releases the ownership of the data, removing it from the resource.
References Font::data, and Font::isowner.
void RemoveRenderer | ( | ) |
Removes the renderer from this resource.
References Font::data, and Font::isowner.
|
overrideprotectedvirtual |
Implements Base.
References Collection< T_ >::Add(), Gorgon::Utils::ASSERT_FALSE(), Collection< T_ >::FindLocation(), Gorgon::Resource::GID::Font_BitmapKerning, Gorgon::Resource::GID::Font_BitmapProps, Gorgon::Resource::GID::Font_Charmap_II, Gorgon::Resource::GID::Font_FreeTypeData, Gorgon::Resource::GID::Font_FreeTypeProps, Writer::GetStream(), Image::SaveThis(), Writer::WriteChunkHeader(), Writer::WriteChunkStart(), Writer::WriteEnd(), Writer::WriteFloat(), Writer::WriteInt32(), Writer::WriteObjectStart(), Writer::WritePointf(), and Writer::WriteUInt32().
void SetRenderer | ( | Graphics::GlyphRenderer & | renderer | ) |
Changes the renderer to the given renderer.
References ASSERT, Gorgon::Utils::ASSERT_FALSE(), Font::data, Bitmap::HasData(), and Font::isowner.
|
protected |
|
protected |
|
protected |