I am trying to render text with the help of stb_truetype library.
And I am very confused by the types for the vertices
here are the types in odin from: Odin/vendor/stb/truetype/stb_truetype.odin at master · odin-lang/Odin · GitHub
vmove :: enum c.int {
none,
vmove=1,
vline,
vcurve,
vcubic,
}
vertex_type :: distinct c.short // can't use stbtt_int16 because that's not visible in the header file
vertex :: struct {
x, y, cx, cy, cx1, cy1: vertex_type,
type, padding: byte,
}
here are the types in c from: stb/stb_truetype.h at master · nothings/stb · GitHub
#ifndef STBTT_vmove // you can predefine these to use different values (but why?)
enum {
STBTT_vmove=1,
STBTT_vline,
STBTT_vcurve,
STBTT_vcubic
};
#endif
#ifndef stbtt_vertex // you can predefine this to use different values
// (we share this with other code at RAD)
#define stbtt_vertex_type short // can't use stbtt_int16 because that's not visible in the header file
typedef struct
{
stbtt_vertex_type x,y,cx,cy,cx1,cy1;
unsigned char type,padding;
} stbtt_vertex;
#endif
the stbtt_vertex struct has a field type, that is of type unsigned char
and x,y of type stbtt_vertex_type
Shouldn’t the vertex.type field have the type: sttbtt_vertex_type? This is very confusing for me, am I missing something here?
Also, the vmove enum is a c.int, but in the library the, STBTT_vmove, STBTT_vcurve, … values are unsigned char, or u8 int odin values.