nothings / stb

stb single-file public domain libraries for C/C++
https://twitter.com/nothings
Other
25.99k stars 7.67k forks source link

stb_truetype #1493

Open tuket opened 1 year ago

tuket commented 1 year ago

In the library there is this struct:

typedef struct
{
   float font_size;
   int first_unicode_codepoint_in_range;  // if non-zero, then the chars are continuous, and this is the first codepoint
   int *array_of_unicode_codepoints;       // if non-zero, then this is an array of unicode codepoints
   int num_chars;
   stbtt_packedchar *chardata_for_range; // output
   unsigned char h_oversample, v_oversample; // don't set these, they're used internally
} stbtt_pack_range;

I think array_of_unicode_codepoints should be const int * because it's an input-only array.

nothings commented 1 year ago

Yeah, I guess so. Generally using const is a stylistic choice and I don't write const-safe code. But the API is supposed to be const-safe, and I guess this is part of the API.