| <<<Back 1 day (to 2018/02/21) | 20180222 |
paulgardiner | tor5: I thought I was close to having the CJK font loading callback implemented, but I've run into a problem. On iOS, we know of some ttc font collections to search for and we know the names of the relevant fonts within them, but we cannot be sure of the index. I've tried loading at each index in turn and checking the name, but fz_font_name seems to be giving me the family name (which isn't... | 16:21.19 |
| ...unique within the collection) rather than the font name. | 16:21.21 |
Robin_Watts | paulgardiner: fz_new_font_from_buffer... | 16:46.05 |
| calls FZ_New_Memory_Face to open the font. | 16:46.10 |
| then sets name from face->family_name. | 16:46.27 |
| sounds like you're asking for something to let you access style name ? | 16:46.56 |
| style_name, even. | 16:47.09 |
kens | TTCs have more than one font, you access them by index IIRC | 16:47.42 |
Robin_Watts | kens: Yes, we appreciate that. | 16:47.57 |
kens | Sounds like Paul wants to access something other than index 0 | 16:47.57 |
Robin_Watts | yeah, he said he'd tried accessing each index in turn. | 16:48.12 |
kens | Oh missed that sorry | 16:48.18 |
Robin_Watts | no worries. | 16:48.22 |
| Possibly we should be using style_name for the font name rather than family_name | 16:49.30 |
paulgardiner | Robin_Watts: Joseph viewed the font in a program called font explorer and that listed the font Name as the string I was expecting. As you say fz_font_name seems to be giving back the family name. | 16:49.57 |
Robin_Watts | paulgardiner: So, try tweaking fz_new_font_from_buffer to use style_name. | 16:50.21 |
paulgardiner | Oh okay. Ta | 16:50.30 |
| Good plan | 16:50.35 |
Robin_Watts | (and it if's NULL or empty, to revert to family_name). | 16:50.41 |
| Then we can run that past tor. | 16:50.45 |
| I generally stay clear of the font stuff, cos fonts are hard. | 16:51.00 |
paulgardiner | The style name isn't it either. It looks like the font name is built from the family name and the style name, but not in a consistent way. | 17:07.38 |
kens | MS usually names font + style as (eg) Arial,Italic | 17:08.40 |
| What are you seeing ? | 17:08.58 |
paulgardiner | "Font Style" in same cases "Font-Style" in others | 17:11.24 |
kens | Can you point me at some example fonts ? | 17:11.49 |
Robin_Watts | Can you give me a concrete example please? | 17:11.56 |
| The name you're being asked for, and the family name/style names found? | 17:12.24 |
paulgardiner | Can't just now, but will in a minute | 17:12.38 |
Robin_Watts | Either someone needs to write a clever function to intelligently combine family and style to a single name... | 17:13.45 |
| or we need to make fz_fonts have both family and style name, and then people can search that smartly. | 17:14.10 |
| The latter may be most foolproof. | 17:15.35 |
| but less convenient for callers. | 17:15.47 |
kens | I'm off to see about dinner, I'll read the logs tomorrow | 17:19.51 |
paulgardiner | Actually all the ttc cases look to be name concatenated with style with an intervening space. There are cases such as Verdana-Bold that looks like it breaks the pattern, but that is a ttf and perhaps Verdana-Bold is the name and the style is empty. I don't have all the info at hand to check. | 17:28.15 |
Robin_Watts | paulgardiner: Does the style often have the family as a prefix? | 17:29.22 |
| If that's a common case, then we could do something like: | 17:29.57 |
| if (family is prefix of style) name = style; else name = family + style; | 17:30.28 |
paulgardiner | It looks like providing access to the style in addition to the name would work well enough | 17:30.35 |
| The style looks to be just that without the family prefix. When I tried your experiment I got back just "W3" | 17:31.17 |
Robin_Watts | So: if (family is prefix of style) name = style; else name = family + style; would cover us nicely ? | 17:31.58 |
paulgardiner | I don't know if family is ever a prefix of style. | 18:55.26 |
Robin_Watts | When I've poked around in ttfs before, I've seen various font names in there. | 18:56.05 |
| let me have a quick poke here. | 18:56.17 |
paulgardiner | Thanks. I was originally hoping that tt fonts had a separate name independent of family and style, but I guess not. | 18:56.50 |
Robin_Watts | For the first font, I picked randomly, I see name ID 1 = "MotoyaLMaru", name ID 2 = "W3 mono", name ID 3 = "MTY MotoyaLMaru-W3-90ms-RKSJ-H" | 18:58.53 |
| Name ID 4 = "MotoyaLMaru W3 mono" | 18:59.15 |
| 1 = font family, 2 = font subfamily name (style) ("Regular" if no other style), 3 = Unique font identifier, 4 = Full Font Name (a combination of 1 and 2, unless 2 was Regular) | 19:01.32 |
| 6 = Postscript name for the font. | 19:01.41 |
| paulgardiner: So I guess if we're having 1 and 2 returned to us by freetype, then just concatenating them is probably safe. | 19:04.12 |
paulgardiner | So freetype doesn't provide access to 4? | 19:07.54 |
Robin_Watts | paulgardiner: I didn't see it obviously in the FT_Face structure. | 19:32.51 |
| (also freetype has to cope with things other than TTFs, where the exact definitions of what is available may be different). | 19:33.20 |
| Forward 1 day (to 2018/02/23)>>> | |