INNER CODE UNIT · Python

__init__

mosra/magnum-examples · src/python/magnum-text.py:40

    def __init__(self):
        Application.__init__(self, self.Configuration(
            title="Magnum Python Text Example",
            window_flags=self.Configuration.WindowFlags.RESIZABLE
        ))

        # Load a TrueTypeFont plugin and open the font
        self._font = text.FontManager().load_and_instantiate('TrueTypeFont')
        self._font.open_file(os.path.join(os.path.dirname(__file__),
            '../text/SourceSansPro-Regular.ttf'), 180.0)

        # Glyphs we need to render everything
        self._cache = text.DistanceFieldGlyphCacheGL(Vector2i(2048), Vector2i(512), 22)
        self._font.fill_glyph_cache(self._cache,
            "abcdefghijklmnopqrstuvwxyz"
            "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
            "0123456789:-+,.!°ěäПривітСΓειασουκόμ ")

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…