本文整理匯總了Python中freetype.FT_LOAD_RENDER屬性的典型用法代碼示例。如果您正苦於以下問題:Python freetype.FT_LOAD_RENDER屬性的具體用法?Python freetype.FT_LOAD_RENDER怎麽用?Python freetype.FT_LOAD_RENDER使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類freetype
的用法示例。
在下文中一共展示了freetype.FT_LOAD_RENDER屬性的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _glyph_for_character
# 需要導入模塊: import freetype [as 別名]
# 或者: from freetype import FT_LOAD_RENDER [as 別名]
def _glyph_for_character(self, char):
# Let FreeType load the glyph for the given character and tell it to
# render a monochromatic bitmap representation.
assert char != ''
self._face.load_char(char, freetype.FT_LOAD_RENDER |
freetype.FT_LOAD_TARGET_MONO)
return Glyph.from_glyphslot(self._face.glyph)
示例2: _glyph_for_character
# 需要導入模塊: import freetype [as 別名]
# 或者: from freetype import FT_LOAD_RENDER [as 別名]
def _glyph_for_character(self, char):
# Let FreeType load the glyph for the given character and tell it to
# render a monochromatic bitmap representation.
self._face.load_char(char, freetype.FT_LOAD_RENDER |
freetype.FT_LOAD_TARGET_MONO)
return Glyph.from_glyphslot(self._face.glyph)
示例3: get_rendered_char_height
# 需要導入模塊: import freetype [as 別名]
# 或者: from freetype import FT_LOAD_RENDER [as 別名]
def get_rendered_char_height(font_filename, font_size, char, target="mono"):
if target == "mono":
render_params = freetype.FT_LOAD_TARGET_MONO
elif target == "lcd":
render_params = freetype.FT_LOAD_TARGET_LCD
render_params |= freetype.FT_LOAD_RENDER
face = freetype.Face(font_filename)
face.set_char_size(font_size * 64)
face.load_char(char, render_params)
return face.glyph.bitmap.rows
示例4: glyph_for_character
# 需要導入模塊: import freetype [as 別名]
# 或者: from freetype import FT_LOAD_RENDER [as 別名]
def glyph_for_character(self, char):
# Let FreeType load the glyph for the given character and tell it to render
# a monochromatic bitmap representation.
self.face.load_char(char, freetype.FT_LOAD_RENDER | freetype.FT_LOAD_TARGET_MONO)
return Glyph.from_glyphslot(self.face.glyph)