

def _set_face(self, face, size, dpi):
    self.face = face.contents
    self._face_size = float_to_f26p6(size)
    self._dpi = dpi
    FT_Set_Char_Size(self.face, 0, float_to_f26p6(size), dpi, dpi)
    metrics = self.face.size.contents.metrics
    if ((metrics.ascender == 0) and (metrics.descender == 0)):
        i = fontconfig.FcFreeTypeCharIndex(byref(self.face), ord('X'))
        FT_Load_Glyph(self.face, i, FT_LOAD_RENDER)
        self.ascent = self.face.available_sizes.contents.height
        self.descent = ((- self.ascent) // 4)
    else:
        self.ascent = int(f26p6_to_float(metrics.ascender))
        self.descent = int(f26p6_to_float(metrics.descender))

dataset/ETHPy150Open ardekantur/pyglet/pyglet/font/freetype.py FreeTypeFont._set_face/original