def text_size(self, context): """ overall on-screen size in pixels """ dpi, font_id = context.user_preferences.system.dpi, 0 if self.angle != 0: blf.enable(font_id, blf.ROTATION) blf.rotation(font_id, self.angle) blf.aspect(font_id, 1.0) blf.size(font_id, self.font_size, dpi) x, y = blf.dimensions(font_id, self.text) if self.angle != 0: blf.disable(font_id, blf.ROTATION) return Vector((x, y))
def aspect(aspect, fontid=None): return blf.aspect(FontManager.load(fontid), aspect)