On Sat, 13 Apr 2019 00:11:25 +0000, Dryden, Thomas wrote: > Does anyone know an easy method for converting a freetype demo to use > FT_Set_Pixel_Sizes() instead of FT_Set_Char_Size()?
I guess you have to find the nearest entry matching your desired size in the font’s available_sizes. The following Python code from my font_chart example <https://github.com/ldo/python_freetype_examples> doesn’t choose the right size, it just picks the first available one. But it at least shows you the right API calls: if len(show_face.available_sizes) != 0 : # fixme: quick hack for bitmap fonts sys.stderr.write("available_sizes = %s\n" % repr(show_face.available_sizes)) # debug use_size = show_face.available_sizes[0] show_face.set_pixel_sizes(use_size["x_ppem"], use_size["y_ppem"]) else : show_face.set_char_size(size = textsize, resolution = freetype.base_dpi) #end if _______________________________________________ Freetype mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/freetype
