aboutsummaryrefslogtreecommitdiff
path: root/vendor/fontstash/fontstash_os.odin
blob: d04df044c7e2ef5d23bed78572dcca71fdfba884 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#+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, data_err := os.read_entire_file(path, context.allocator)

	if data_err != nil {
		log.panicf("FONT: failed to read font at %s", path)
	}

	return AddFontMem(ctx, name, data, true, fontIndex)
}