ryancheung / FreeTypeSharp

A modern cross-platform managed FreeType2 library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FreeType cleanup

opened this issue · comments

@ryancheung I was wondering about cleanup in regards to using FreeType.

Do I need to call FT_Done_Face, FT_Done_Glyph or FT_Done_FreeType?

FT_Done_FreeType seems to be an obvious one but the other 2 I am not sure about. I checked the documentation on the FreeType Done Glyph Docs site but there is nothing there about it.

FT_Done_Face documentation does not say anything about needing to call this for cleanup purposes either.

Any guidance on what needs to be done with cleanup would be great!! :)

Cheers.

When to render font texts with freetype, you first have to create a freetype library with FT_Init_FreeType, then you have to load a font face from a font file(.ttf) with FT_New_Face, then you'll be able to start rendering a glyph with FT_Load_Char or the like APIs.

So when you don't need any of them (freetype library, font face, glyph), you call the "done" methods.

Commonly you need do FT_Done_Face or FT_Done_FreeType only when you don't need that loaded freetype library or font face anymore, like while game shutdown.

Ok, awesome. I am already currently loading the glyphs up and creating atlas textures containing all the characters I want with the associated atlas data for rendering purposes. It all works great, I just wanted to make sure I am cleaning up properly.