Custom Markers - Text quality in VSE

Hi everybody.

I am trying to draw on the sequence editor by using bgl and blf python modules. All good with bgl (drawing a vertical line), but when it comes to text, it would render at a very low resolution (I am using PRE_VIEW or POST_VIEW as I need the text to be stick to the frame it refers to).

My aim is to draw some extra Markers to organize automatic trimming of videos: default markers do the trimming and extra markers do some grouping.

In order to better understand the issue, I am trying to get a visualization similar to the cursor line when it also shows the current frame.

How can I improve the text quality?

A solution I have investigated, that would also permit to keep the text always visible, is to use POST_PIXEL and adjust the horizontal position according to the scrolling of the timeline behind, but I don’t seem to find any means of asking the sequencer window the portion of timeline shown (start-end frame or center frame and zoom level).

Does anybody know how to help me on this?

Thank you in advance for any help.

[Edit]
I’ve found the solution myself.
The answer is in
bpy.context.region.view2d.view_to_region(frame, channel, clip=False)
which returns the x window coordinate correspoding to the frame and the y window coordinate corresponding to the channel.

Hence, I derive the x from the frame to let the label stick to the frame position and the y from the window height to always keep the text on the top of the window.