opengl freetype library code example
Example: python opengl freetype
import freetype as ft
face = ft.Face("Vera.ttf")
face.set_char_size(48*64)
stroker = ft.Stroker()
stroker.set(1, ft.FT_STROKER_LINECAPS['FT_STROKER_LINECAP_ROUND'], ft.FT_STROKER_LINEJOINS['FT_STROKER_LINEJOIN_ROUND'], 0)
face.load_char('S', ft.FT_LOAD_FLAGS['FT_LOAD_DEFAULT'])
glyph = ft.FT_Glyph()
ft.FT_Get_Glyph(face.glyph._FT_GlyphSlot, ft.byref(glyph))
glyph = ft.Glyph(glyph)
error = ft.FT_Glyph_StrokeBorder(ft.byref(glyph._FT_Glyph), stroker._FT_Stroker, False, False)
if error:
raise ft.FT_Exception(error)
bitmapGlyph = glyph.to_bitmap(ft.FT_RENDER_MODES['FT_RENDER_MODE_NORMAL'], 0)