36 asc_context.active_font.style = style; |
36 asc_context.active_font.style = style; |
37 asc_context.active_font.size = size; |
37 asc_context.active_font.size = size; |
38 } |
38 } |
39 |
39 |
40 static char const *asc_font_filename(enum AscFontStyle style) { |
40 static char const *asc_font_filename(enum AscFontStyle style) { |
41 // TODO: do not assume we are running from the program dir |
|
42 switch (style) { |
41 switch (style) { |
43 case ASC_FONT_REGULAR: |
42 case ASC_FONT_REGULAR: |
44 return "fonts/OpenSans-Regular.ttf"; |
43 return "fonts/OpenSans-Regular.ttf"; |
45 case ASC_FONT_BOLD: |
44 case ASC_FONT_BOLD: |
46 return "fonts/OpenSans-Bold.ttf"; |
45 return "fonts/OpenSans-Bold.ttf"; |
47 case ASC_FONT_ITALIC: |
46 case ASC_FONT_ITALIC: |
48 return "fonts/OpenSans-Italic.ttf"; |
47 return "fonts/OpenSans-Italic.ttf"; |
49 case ASC_FONT_BOLD_ITALIC: |
48 case ASC_FONT_BOLD_ITALIC: |
50 return "fonts/OpenSans-BoldItalic.ttf"; |
49 return "fonts/OpenSans-BoldItalic.ttf"; |
|
50 default: |
|
51 assert(false); |
|
52 return NULL; |
51 } |
53 } |
52 } |
54 } |
53 |
55 |
54 struct asc_font_cache_entry { |
56 struct asc_font_cache_entry { |
55 AscFont font; |
57 AscFont font; |