forked from 15-466/15-466-f22-base4
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PathFont.hpp
39 lines (30 loc) · 951 Bytes
/
PathFont.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#pragma once
/*
* PathFont -- line based font used by DrawLines.
*
* Based on code from Chesskoban (c) 2017-2019 Jim McCann;
* this adapted-for-15-466 code is released into the public domain.
*
*/
#include <glm/glm.hpp>
#include <string>
#include <vector>
#include <map>
struct PathFont {
//meant to be intitialized with some pointers to constant data:
PathFont(uint32_t glyphs,
const float *glyph_widths,
const uint32_t *glyph_char_starts, const uint8_t *chars,
const uint32_t *glyph_coord_starts, const float *coords
);
const uint32_t glyphs = 0;
const float *glyph_widths = nullptr;
const uint32_t *glyph_char_starts = nullptr; //indices into 'chars' table
const uint8_t *chars = nullptr;
const uint32_t *glyph_coord_starts = nullptr; //indices into 'coords' table
const float *coords = nullptr;
//computed in constructor:
std::map< std::string, uint32_t > glyph_map;
//the default font:
static PathFont font;
};