Add a warning for faux bold/italic to the fonts collector
This commit is contained in:
parent
1a67ee1fdf
commit
e729d38164
3 changed files with 15 additions and 0 deletions
|
@ -142,6 +142,11 @@ void FontCollector::ProcessChunk(std::pair<StyleInfo, UsageData> const& style) {
|
|||
status_callback(wxString::Format(_("Found '%s' at '%s'\n"), to_wx(style.first.facename), elem.make_preferred().wstring()), 0);
|
||||
}
|
||||
|
||||
if (res.fake_bold)
|
||||
status_callback(wxString::Format(_("'%s' does not have a bold variant.\n"), to_wx(style.first.facename)), 3);
|
||||
if (res.fake_italic)
|
||||
status_callback(wxString::Format(_("'%s' does not have an italic variant.\n"), to_wx(style.first.facename)), 3);
|
||||
|
||||
if (res.missing.size()) {
|
||||
if (res.missing.size() > 50)
|
||||
status_callback(wxString::Format(_("'%s' is missing %d glyphs used.\n"), to_wx(style.first.facename), (int)res.missing.size()), 2);
|
||||
|
|
|
@ -46,6 +46,8 @@ public:
|
|||
wxString missing;
|
||||
/// Paths to the file(s) containing the requested font
|
||||
std::vector<agi::fs::path> paths;
|
||||
bool fake_bold = false;
|
||||
bool fake_italic = false;
|
||||
};
|
||||
|
||||
/// @brief Get the path to the font with the given styles
|
||||
|
|
|
@ -133,6 +133,14 @@ FontFileLister::CollectionResult FontConfigFontFileLister::GetFontPaths(std::str
|
|||
}
|
||||
}
|
||||
|
||||
int actual_weight = weight;
|
||||
if (FcPatternGetInteger(match, FC_WEIGHT, 0, &actual_weight) == FcResultMatch)
|
||||
ret.fake_bold = actual_weight < weight;
|
||||
|
||||
int actual_slant = slant;
|
||||
if (FcPatternGetInteger(match, FC_SLANT, 0, &actual_slant) == FcResultMatch)
|
||||
ret.fake_italic = italic && !actual_slant;
|
||||
|
||||
ret.paths.emplace_back((const char *)file);
|
||||
return ret;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue