Page MenuHome

BLF: Remove blf_mono_font_render
AbandonedPublic

Authored by Harley Acheson (harley) on Aug 8 2022, 9:27 PM.

Details

Summary

Remove duplicate loading of the monospaced font. This was done to avoid
threading issues but is no longer needed.


The monospaced font is currently loaded a second time and is used as blf_mono_font_render. This had been done to avoid problems where a separate thread drew with the mono font for the render window, the color grid, etc. This would cause threading issues while drawing the UI.

However the underlying causes of these threading issues have subsequently been fixed. FreeType is now perfectly threadsafe if a mutex lock is used around uses of FT_New_Face, FT_New_Memory_Face, and FT_Done_Face (which we do). And we properly lock protect our glyph caches.

Note that this patch is unrelated to D15644: BLF: Mutex Lock Glyph Cache Per Font, Not Global.

Diff Detail

Repository
rB Blender

Event Timeline

Harley Acheson (harley) requested review of this revision.Aug 8 2022, 9:27 PM
Harley Acheson (harley) created this revision.
Brecht Van Lommel (brecht) requested changes to this revision.Aug 9 2022, 5:57 PM

While the Freetype part is thread safe, I think the BLF API design is not.

Functions like BLF_position and BLF_size store state on the font, which won't work for multiple threads.

This revision now requires changes to proceed.Aug 9 2022, 5:57 PM

@Brecht Van Lommel (brecht) - Functions like BLF_position and BLF_size store state on the font, which won't work for multiple threads.

Yes, you are right.