mirror of
https://github.com/Ed94/Odin.git
synced 2026-07-29 02:40:05 +00:00
24 lines
499 B
Odin
24 lines
499 B
Odin
#+build !js
|
|
package fontstash
|
|
|
|
import "core:log"
|
|
import "core:os"
|
|
|
|
// 'fontIndex' controls which font you want to load within a multi-font format such
|
|
// as TTC. Leave it as zero if you are loading a single-font format such as TTF.
|
|
AddFontPath :: proc(
|
|
ctx: ^FontContext,
|
|
name: string,
|
|
path: string,
|
|
fontIndex: int = 0,
|
|
) -> int {
|
|
data, ok := os.read_entire_file(path)
|
|
|
|
if !ok {
|
|
log.panicf("FONT: failed to read font at %s", path)
|
|
}
|
|
|
|
return AddFontMem(ctx, name, data, true, fontIndex)
|
|
}
|
|
|