Get SDL TTF string width from another thread

I’m writing a multithreaded C++ library that uses SDL, and I can’t call TTF_SizeText while calling any other SDL method. All other SDL methods are either graphics functions (only on one thread) or basic window functions (not used often and locked).

I was going to cache the font glyphs and the kerning between each letter but TTF_GetFontKerningSize and TTF_GetFontKerningSizeGlyphs always return 0.

I believe the only reason I can’t use TTF_SizeText at the same time as any other SDL function is because it uses basic SDL functions like SDL_strlen and could be rewritten but I have mostly developed in Java and this is just a guess.

Another option might be to only load string widths on the graphics thread but I have to load a lot of various strings and it would be messy to code

One last idea I had was loading freetype seperately and using that,but it could be messy as well.

Any insight into my problem is appreciated