Blf.aspect not working. Should i report a bug?


#1

Hi!
I’m trying to control the pixel aspect of the text shown with blf but the function used to it (blf.aspect) don’t seems to work. I’m doing something wrong?

import bgl
import blf
import bpy

font_info = {
    "font_id": 0,
    "handler": None,
}


def init():
    """init function - runs once"""
    import os
    # Create a new font object, use external ttf file.
    font_path = bpy.path.abspath('//Zeyada.ttf')
    # Store the font indice - to use later.
    if os.path.exists(font_path):
        font_info["font_id"] = blf.load(font_path)
    else:
        # Default font.
        font_info["font_id"] = 0

    # set the font drawing routine to run every frame
    font_info["handler"] = bpy.types.SpaceView3D.draw_handler_add(
        draw_callback_px, (None, None), 'WINDOW', 'POST_PIXEL')


def draw_callback_px(self, context):
    """Draw on the viewports"""
    # BLF drawing routine
    font_id = font_info["font_id"]
    blf.position(font_id, 2, 80, 0)
    blf.size(font_id, 50, 72)
    blf.aspect(font_id,0.5) # You can change the value, didn't work.
    blf.draw(font_id, "Hello World")


if __name__ == '__main__':
    init()

#2

I found out that we need to use blf.enable(fond_id,32) to make it “work” but beside its not documented anywhere its not working as a “pixel_aspect” handler. it only scales the text uniformly just like changing the size. Should i report it as a bug?