mirror of
https://github.com/Ed94/Odin.git
synced 2026-06-13 09:22:22 -07:00
Fix for fontstash crash because it didn't fetch the offset of the first font correctly. The old setup didn't work with TTC files that contain multiple fonts.
This commit is contained in:
Vendored
+4
-1
@@ -335,7 +335,10 @@ AddFontMem :: proc(
|
||||
res.freeLoadedData = freeLoadedData
|
||||
res.name = strings.clone(name)
|
||||
|
||||
stbtt.InitFont(&res.info, &res.loadedData[0], 0)
|
||||
// Get offset of first font (if the font is a TTC then it can contain multiple fonts)
|
||||
// Note: There is currently no support for specifying any other font than first one.
|
||||
font_offset := stbtt.GetFontOffsetForIndex(raw_data(res.loadedData), 0)
|
||||
stbtt.InitFont(&res.info, raw_data(res.loadedData), font_offset)
|
||||
ascent, descent, line_gap: i32
|
||||
|
||||
stbtt.GetFontVMetrics(&res.info, &ascent, &descent, &line_gap)
|
||||
|
||||
Reference in New Issue
Block a user