Mercurial > repos > blastem
annotate nuklear_ui/font_mac.m @ 2179:9a8dd4ba2753
Implement frame advance debugger command
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Sat, 13 Aug 2022 19:37:17 -0700 |
parents | 18ffa9caa00c |
children |
rev | line source |
---|---|
1537
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1 #import <AppKit/AppKit.h> |
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
2 #include <stddef.h> |
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
3 #include "../paths.h" |
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
4 #include "../util.h" |
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
5 #include "sfnt.h" |
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
6 |
1560
18ffa9caa00c
Added code to fallback to Yosemite or pre-Yosemite system font in case current system font can't be found or is in an unusable format. San Francisco font used on current OS X versions is in a .otf file whih presumably means it has CFF outlines that stb_truetype can't use.
Michael Pavone <pavone@retrodev.com>
parents:
1559
diff
changeset
|
7 static sfnt_table *find_font_in_dir(char *path, char *prefix, const char *ps_name) |
1537
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
8 { |
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
9 size_t num_entries; |
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
10 dir_entry *entries = get_dir_list(path, &num_entries); |
1559
098c11aaf8f0
Fix silly bug in handling of Mac Roman font names. Make Mac font search more exhaustive if the faster prefix check fails. Added a bunch of debug printfs in case those aren't sufficient to get things working on other machines
Michael Pavone <pavone@retrodev.com>
parents:
1537
diff
changeset
|
11 size_t prefix_len = prefix ? strlen(prefix) : 0; |
1537
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
12 sfnt_table *selected = NULL; |
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
13 for (size_t i = 0; i < num_entries && !selected; i++) |
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
14 { |
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
15 char *ext = path_extension(entries[i].name); |
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
16 if (!ext || (strcasecmp(ext, "ttf") && strcasecmp(ext, "ttc") && strcasecmp(ext, "dfont"))) { |
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
17 //not a truetype font, ignore |
1559
098c11aaf8f0
Fix silly bug in handling of Mac Roman font names. Make Mac font search more exhaustive if the faster prefix check fails. Added a bunch of debug printfs in case those aren't sufficient to get things working on other machines
Michael Pavone <pavone@retrodev.com>
parents:
1537
diff
changeset
|
18 printf("Skipping %s because of its extension\n", entries[i].name); |
1537
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
19 free(ext); |
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
20 continue; |
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
21 } |
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
22 free(ext); |
1559
098c11aaf8f0
Fix silly bug in handling of Mac Roman font names. Make Mac font search more exhaustive if the faster prefix check fails. Added a bunch of debug printfs in case those aren't sufficient to get things working on other machines
Michael Pavone <pavone@retrodev.com>
parents:
1537
diff
changeset
|
23 if (!prefix || !strncasecmp(entries[i].name, prefix, prefix_len)) { |
1537
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
24 char *full_path = path_append(path, entries[i].name); |
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
25 FILE *f = fopen(full_path, "rb"); |
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
26 if (f) |
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
27 { |
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
28 long font_size = file_size(f); |
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
29 uint8_t *blob = malloc(font_size); |
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
30 if (font_size == fread(blob, 1, font_size, f)) |
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
31 { |
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
32 sfnt_container *sfnt = load_sfnt(blob, font_size); |
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
33 if (sfnt) { |
1559
098c11aaf8f0
Fix silly bug in handling of Mac Roman font names. Make Mac font search more exhaustive if the faster prefix check fails. Added a bunch of debug printfs in case those aren't sufficient to get things working on other machines
Michael Pavone <pavone@retrodev.com>
parents:
1537
diff
changeset
|
34 printf("Examining font file %s\n", entries[i].name); |
1537
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
35 for (uint8_t j = 0; j < sfnt->num_fonts && !selected; j++) |
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
36 { |
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
37 char *cur_ps = sfnt_name(sfnt->tables + j, SFNT_POSTSCRIPT); |
1559
098c11aaf8f0
Fix silly bug in handling of Mac Roman font names. Make Mac font search more exhaustive if the faster prefix check fails. Added a bunch of debug printfs in case those aren't sufficient to get things working on other machines
Michael Pavone <pavone@retrodev.com>
parents:
1537
diff
changeset
|
38 printf("\t%s\n", cur_ps); |
1537
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
39 if (!strcmp(cur_ps, ps_name)) { |
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
40 selected = sfnt->tables + j; |
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
41 } |
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
42 free(cur_ps); |
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
43 } |
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
44 } else { |
1559
098c11aaf8f0
Fix silly bug in handling of Mac Roman font names. Make Mac font search more exhaustive if the faster prefix check fails. Added a bunch of debug printfs in case those aren't sufficient to get things working on other machines
Michael Pavone <pavone@retrodev.com>
parents:
1537
diff
changeset
|
45 printf("Failed to load %s as sfnt containern\n", entries[i].name); |
1537
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
46 free(blob); |
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
47 } |
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
48 } else { |
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
49 free(blob); |
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
50 } |
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
51 fclose(f); |
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
52 } |
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
53 free(full_path); |
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
54 } |
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
55 } |
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
56 return selected; |
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
57 } |
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
58 |
1560
18ffa9caa00c
Added code to fallback to Yosemite or pre-Yosemite system font in case current system font can't be found or is in an unusable format. San Francisco font used on current OS X versions is in a .otf file whih presumably means it has CFF outlines that stb_truetype can't use.
Michael Pavone <pavone@retrodev.com>
parents:
1559
diff
changeset
|
59 static sfnt_table *find_font_by_ps_name(const char*ps_name, uint8_t exhaustive) |
1537
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
60 { |
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
61 const unsigned char *prefix_start = (const unsigned char *)ps_name; |
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
62 while(*prefix_start && ( |
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
63 *prefix_start < '0' || |
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
64 (*prefix_start > 'z' && *prefix_start <= 0x80) || |
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
65 (*prefix_start > 'Z' && *prefix_start < 'a') || |
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
66 (*prefix_start > '9' && *prefix_start < 'A') |
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
67 )) |
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
68 { |
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
69 prefix_start++; |
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
70 } |
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
71 if (!*prefix_start) { |
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
72 //Didn't find a suitable starting character, just start from the beginning |
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
73 prefix_start = (const unsigned char *)ps_name; |
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
74 } |
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
75 const unsigned char *prefix_end = (const unsigned char *)prefix_start + 1; |
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
76 while (*prefix_end && *prefix_end >= 'a') |
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
77 { |
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
78 prefix_end++; |
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
79 } |
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
80 char *prefix = malloc(prefix_end - prefix_start + 1); |
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
81 memcpy(prefix, prefix_start, prefix_end - prefix_start); |
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
82 prefix[prefix_end-prefix_start] = 0; |
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
83 //check /Library/Fonts first |
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
84 sfnt_table *selected = find_font_in_dir("/Library/Fonts", (char *)prefix, ps_name); |
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
85 if (!selected) { |
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
86 selected = find_font_in_dir("/System/Library/Fonts", (char *)prefix, ps_name); |
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
87 } |
1560
18ffa9caa00c
Added code to fallback to Yosemite or pre-Yosemite system font in case current system font can't be found or is in an unusable format. San Francisco font used on current OS X versions is in a .otf file whih presumably means it has CFF outlines that stb_truetype can't use.
Michael Pavone <pavone@retrodev.com>
parents:
1559
diff
changeset
|
88 if (exhaustive) { |
18ffa9caa00c
Added code to fallback to Yosemite or pre-Yosemite system font in case current system font can't be found or is in an unusable format. San Francisco font used on current OS X versions is in a .otf file whih presumably means it has CFF outlines that stb_truetype can't use.
Michael Pavone <pavone@retrodev.com>
parents:
1559
diff
changeset
|
89 if (!selected) { |
18ffa9caa00c
Added code to fallback to Yosemite or pre-Yosemite system font in case current system font can't be found or is in an unusable format. San Francisco font used on current OS X versions is in a .otf file whih presumably means it has CFF outlines that stb_truetype can't use.
Michael Pavone <pavone@retrodev.com>
parents:
1559
diff
changeset
|
90 puts("Check using prefix failed, exhaustively checking fonts"); |
18ffa9caa00c
Added code to fallback to Yosemite or pre-Yosemite system font in case current system font can't be found or is in an unusable format. San Francisco font used on current OS X versions is in a .otf file whih presumably means it has CFF outlines that stb_truetype can't use.
Michael Pavone <pavone@retrodev.com>
parents:
1559
diff
changeset
|
91 selected = find_font_in_dir("/Library/Fonts", NULL, ps_name); |
18ffa9caa00c
Added code to fallback to Yosemite or pre-Yosemite system font in case current system font can't be found or is in an unusable format. San Francisco font used on current OS X versions is in a .otf file whih presumably means it has CFF outlines that stb_truetype can't use.
Michael Pavone <pavone@retrodev.com>
parents:
1559
diff
changeset
|
92 } |
18ffa9caa00c
Added code to fallback to Yosemite or pre-Yosemite system font in case current system font can't be found or is in an unusable format. San Francisco font used on current OS X versions is in a .otf file whih presumably means it has CFF outlines that stb_truetype can't use.
Michael Pavone <pavone@retrodev.com>
parents:
1559
diff
changeset
|
93 if (!selected) { |
18ffa9caa00c
Added code to fallback to Yosemite or pre-Yosemite system font in case current system font can't be found or is in an unusable format. San Francisco font used on current OS X versions is in a .otf file whih presumably means it has CFF outlines that stb_truetype can't use.
Michael Pavone <pavone@retrodev.com>
parents:
1559
diff
changeset
|
94 selected = find_font_in_dir("/System/Library/Fonts", NULL, ps_name); |
18ffa9caa00c
Added code to fallback to Yosemite or pre-Yosemite system font in case current system font can't be found or is in an unusable format. San Francisco font used on current OS X versions is in a .otf file whih presumably means it has CFF outlines that stb_truetype can't use.
Michael Pavone <pavone@retrodev.com>
parents:
1559
diff
changeset
|
95 } |
18ffa9caa00c
Added code to fallback to Yosemite or pre-Yosemite system font in case current system font can't be found or is in an unusable format. San Francisco font used on current OS X versions is in a .otf file whih presumably means it has CFF outlines that stb_truetype can't use.
Michael Pavone <pavone@retrodev.com>
parents:
1559
diff
changeset
|
96 } |
18ffa9caa00c
Added code to fallback to Yosemite or pre-Yosemite system font in case current system font can't be found or is in an unusable format. San Francisco font used on current OS X versions is in a .otf file whih presumably means it has CFF outlines that stb_truetype can't use.
Michael Pavone <pavone@retrodev.com>
parents:
1559
diff
changeset
|
97 free(prefix); |
18ffa9caa00c
Added code to fallback to Yosemite or pre-Yosemite system font in case current system font can't be found or is in an unusable format. San Francisco font used on current OS X versions is in a .otf file whih presumably means it has CFF outlines that stb_truetype can't use.
Michael Pavone <pavone@retrodev.com>
parents:
1559
diff
changeset
|
98 return selected; |
18ffa9caa00c
Added code to fallback to Yosemite or pre-Yosemite system font in case current system font can't be found or is in an unusable format. San Francisco font used on current OS X versions is in a .otf file whih presumably means it has CFF outlines that stb_truetype can't use.
Michael Pavone <pavone@retrodev.com>
parents:
1559
diff
changeset
|
99 } |
18ffa9caa00c
Added code to fallback to Yosemite or pre-Yosemite system font in case current system font can't be found or is in an unusable format. San Francisco font used on current OS X versions is in a .otf file whih presumably means it has CFF outlines that stb_truetype can't use.
Michael Pavone <pavone@retrodev.com>
parents:
1559
diff
changeset
|
100 |
18ffa9caa00c
Added code to fallback to Yosemite or pre-Yosemite system font in case current system font can't be found or is in an unusable format. San Francisco font used on current OS X versions is in a .otf file whih presumably means it has CFF outlines that stb_truetype can't use.
Michael Pavone <pavone@retrodev.com>
parents:
1559
diff
changeset
|
101 uint8_t *default_font(uint32_t *size_out) |
18ffa9caa00c
Added code to fallback to Yosemite or pre-Yosemite system font in case current system font can't be found or is in an unusable format. San Francisco font used on current OS X versions is in a .otf file whih presumably means it has CFF outlines that stb_truetype can't use.
Michael Pavone <pavone@retrodev.com>
parents:
1559
diff
changeset
|
102 { |
18ffa9caa00c
Added code to fallback to Yosemite or pre-Yosemite system font in case current system font can't be found or is in an unusable format. San Francisco font used on current OS X versions is in a .otf file whih presumably means it has CFF outlines that stb_truetype can't use.
Michael Pavone <pavone@retrodev.com>
parents:
1559
diff
changeset
|
103 NSFont *sys = [NSFont systemFontOfSize:0]; |
18ffa9caa00c
Added code to fallback to Yosemite or pre-Yosemite system font in case current system font can't be found or is in an unusable format. San Francisco font used on current OS X versions is in a .otf file whih presumably means it has CFF outlines that stb_truetype can't use.
Michael Pavone <pavone@retrodev.com>
parents:
1559
diff
changeset
|
104 NSString *name = [sys fontName]; |
18ffa9caa00c
Added code to fallback to Yosemite or pre-Yosemite system font in case current system font can't be found or is in an unusable format. San Francisco font used on current OS X versions is in a .otf file whih presumably means it has CFF outlines that stb_truetype can't use.
Michael Pavone <pavone@retrodev.com>
parents:
1559
diff
changeset
|
105 sfnt_table *selected = find_font_by_ps_name([name UTF8String], 1); |
1537
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
106 if (!selected) { |
1560
18ffa9caa00c
Added code to fallback to Yosemite or pre-Yosemite system font in case current system font can't be found or is in an unusable format. San Francisco font used on current OS X versions is in a .otf file whih presumably means it has CFF outlines that stb_truetype can't use.
Michael Pavone <pavone@retrodev.com>
parents:
1559
diff
changeset
|
107 selected = find_font_by_ps_name(".HelveticaNeueDeskInterface-Regular", 0); |
1559
098c11aaf8f0
Fix silly bug in handling of Mac Roman font names. Make Mac font search more exhaustive if the faster prefix check fails. Added a bunch of debug printfs in case those aren't sufficient to get things working on other machines
Michael Pavone <pavone@retrodev.com>
parents:
1537
diff
changeset
|
108 } |
098c11aaf8f0
Fix silly bug in handling of Mac Roman font names. Make Mac font search more exhaustive if the faster prefix check fails. Added a bunch of debug printfs in case those aren't sufficient to get things working on other machines
Michael Pavone <pavone@retrodev.com>
parents:
1537
diff
changeset
|
109 if (!selected) { |
1560
18ffa9caa00c
Added code to fallback to Yosemite or pre-Yosemite system font in case current system font can't be found or is in an unusable format. San Francisco font used on current OS X versions is in a .otf file whih presumably means it has CFF outlines that stb_truetype can't use.
Michael Pavone <pavone@retrodev.com>
parents:
1559
diff
changeset
|
110 selected = find_font_by_ps_name(".LucidaGrandeUI", 0); |
1559
098c11aaf8f0
Fix silly bug in handling of Mac Roman font names. Make Mac font search more exhaustive if the faster prefix check fails. Added a bunch of debug printfs in case those aren't sufficient to get things working on other machines
Michael Pavone <pavone@retrodev.com>
parents:
1537
diff
changeset
|
111 } |
1560
18ffa9caa00c
Added code to fallback to Yosemite or pre-Yosemite system font in case current system font can't be found or is in an unusable format. San Francisco font used on current OS X versions is in a .otf file whih presumably means it has CFF outlines that stb_truetype can't use.
Michael Pavone <pavone@retrodev.com>
parents:
1559
diff
changeset
|
112 |
1559
098c11aaf8f0
Fix silly bug in handling of Mac Roman font names. Make Mac font search more exhaustive if the faster prefix check fails. Added a bunch of debug printfs in case those aren't sufficient to get things working on other machines
Michael Pavone <pavone@retrodev.com>
parents:
1537
diff
changeset
|
113 if (!selected) { |
1560
18ffa9caa00c
Added code to fallback to Yosemite or pre-Yosemite system font in case current system font can't be found or is in an unusable format. San Francisco font used on current OS X versions is in a .otf file whih presumably means it has CFF outlines that stb_truetype can't use.
Michael Pavone <pavone@retrodev.com>
parents:
1559
diff
changeset
|
114 fatal_error("Failed to find system font %s\n", [name UTF8String]); |
1537
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
115 } |
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
116 return sfnt_flatten(selected, size_out); |
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
117 } |
b4914d92308b
Added OSX implementation of default_font
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
118 |