Fix thread safety of FT_New_Face, FT_New_Memory_Face and FT_Done_Face
As is stated in https://www.freetype.org/freetype2/docs/reference/ft2-base_interface.html:
"In multi-threaded applications it is easiest to use one FT_Library object per thread. In case this is too cumbersome, a single FT_Library object across threads is possible also, as long as a mutex lock is used around FT_New_Face and FT_Done_Face."
It is not well possible to use FT_Library
object per thread because cairo can call _ft_done_face_uncached
from any thread so this patch adds proper mutex locking around FT_New_Face
, FT_New_Memory_Face
and FT_Done_Face
. Mutex is defined alongside FT_Library
.
Unfortunately this patch depends on !798 (closed) because it touches similar regions.