On 05/23/2018 09:07 PM, Lucian Poston wrote:
+ /** + * This is a rough hack. We search the system font collection because + * the system fontfallback, which would have been searched above, is not + * fully implemented as it isn't populated with any system fonts. Once + * implemented, the block below can be removed. + * */ + if (!*mapped_length) { + IDWriteFontFamily *family; + IDWriteFont *font; + UINT32 i, count = IDWriteFontCollection_GetFontFamilyCount((IDWriteFontCollection *)fallback->systemcollection); + for (i = 0; i < count; i++) { + hr = IDWriteFontCollection_GetFontFamily((IDWriteFontCollection *)fallback->systemcollection, i, &family); + if (FAILED(hr)) { + ERR("Failed to get font family.\n"); + continue; } + + hr = IDWriteFontFamily_GetFirstMatchingFont(family, weight, stretch, style, &font); + IDWriteFontFamily_Release(family); + if (FAILED(hr)) { + continue; + } + + hr = fallback_map_characters(font, text, length, mapped_length); + if (SUCCEEDED(hr) && mapped_length > 0) { + *ret_font = font; + break; + } + + IDWriteFont_Release(font); }
This block will pick arbitrary font, depending on fonts user has installed, and can change if user installs more or removes some. That doesn't sound like a good idea to me, and your comment already hints at that.