Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions vendor/stb/truetype/stb_truetype.odin
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@ packedchar :: struct {
pack_range :: struct {
font_size: f32,
first_unicode_codepoint_in_range: c.int,
array_of_unicode_codepoints: [^]rune,
array_of_unicode_codepoints: [^]rune, // optional
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe([^]rune) could be added? Not saying it should be though.

Copy link
Contributor Author

@leecommamichael leecommamichael Sep 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My mistake, the comment is erroneous since either first_unicode_codepoint_in_range or array_of_unicode_codepoints is expected. The first_codepoint... is ignored if the array is present. I can't think of a better Odin binding that isn't a wrapper. I could do two Maybe parameters, but then it seems that neither are needed 😅

By the way, would you mind if I converted some of these c.int returns to b32? Sean returns only 1 or 0 in many of these functions. Thanks.

EDIT: Check my math, but; I think in practice Odin only supports ILP32/LP64 things, so c.int can safely be typed as i32 (and thus b32) in all cases, so there'd be no ABI fuss.

num_chars: c.int,
chardata_for_range: ^packedchar,
chardata_for_range: [^]packedchar, // output
_, _: u8, // used internally to store oversample info
}

Expand Down Expand Up @@ -154,7 +154,7 @@ foreign stbtt {
// and pass that result as 'font_size':
// ..., 20 , ... // font max minus min y is 20 pixels tall
// ..., POINT_SIZE(20), ... // 'M' is 20 pixels tall
PackFontRange :: proc(spc: ^pack_context, fontdata: [^]byte, font_index: c.int, font_size: f32, first_unicode_char_in_range, num_chars_in_range: c.int, chardata_for_range: ^packedchar) -> c.int ---
PackFontRange :: proc(spc: ^pack_context, fontdata: [^]byte, font_index: c.int, font_size: f32, first_unicode_char_in_range, num_chars_in_range: c.int, chardata_for_range: [^]packedchar) -> c.int ---

// Creates character bitmaps from multiple ranges of characters stored in
// ranges. This will usually create a better-packed bitmap than multiple
Expand Down Expand Up @@ -200,9 +200,9 @@ foreign stbtt {
// then call RenderIntoRects repeatedly. This may result in a
// better packing than calling PackFontRanges multiple times
// (or it may not).
PackFontRangesGatherRects :: proc(spc: ^pack_context, info: ^fontinfo, ranges: ^pack_range, num_ranges: c.int, rects: [^]stbrp.Rect) -> c.int ---
PackFontRangesGatherRects :: proc(spc: ^pack_context, info: ^fontinfo, ranges: [^]pack_range, num_ranges: c.int, rects: [^]stbrp.Rect) -> c.int ---
PackFontRangesPackRects :: proc(spc: ^pack_context, rects: [^]stbrp.Rect, num_rects: c.int) ---
PackFontRangesRenderIntoRects :: proc(spc: ^pack_context, info: ^fontinfo, ranges: ^pack_range, num_ranges: c.int, rects: [^]stbrp.Rect) -> c.int ---
PackFontRangesRenderIntoRects :: proc(spc: ^pack_context, info: ^fontinfo, ranges: [^]pack_range, num_ranges: c.int, rects: [^]stbrp.Rect) -> c.int ---
}

//////////////////////////////////////////////////////////////////////////////
Expand Down
Loading