SDL_ttf
SDL_ttf copied to clipboard
Feature request: Add variants of existing rendering functions that take a string length
The title says it all, adding functions that take a length instead of assuming strings are null-terminated would be really nice for a variety of use cases, from allowing easier interop with other languages to making styling different parts of a string possible without allocating a bunch of sub-strings for each part. This could be achieved by adding Len
to the end of the relevant functions, so the string length variant of TTF_RenderUTF8_Blended
would be TTF_RenderUTF8_BlendedLen
, and so on.
Edit: the scope of this request should actually include every function that takes a piece of text as input, not just the rendering functions, but maybe that goes without saying.
I also endorse this. Came here trying to find a way of measuring a text that is not NUL-terminated. Having to create sub-strings from a larger text is really not good for performance.
It would go well with std::string_view that is now available in C++.