You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
FontCollector tries to reproduce what VSFilter does. VSFilter uses GDI to select a font and display it, so we need to emulate it.
We already properly emulate the score for the lfWeight and lfItalic attributes, but we don't emulate the score for lfPitchAndFamily and lfCharSet.
99% of the time, these properties don't affect the font that will be picked up. In general, they can affect the font picked up when the user has two fonts that are the same, but one is TrueType and the other is OpenType.
lfPitchAndFamily score algorithm
font_family = FF_DECORATIVE, FF_DONTCARE, FF_MODERN, FF_ROMAN, FF_SCRIPT or FF_SWISS
requested_family = is it always FF_DONTCARE
requested_charset = Depend on \fe tag or the ass style
if (jMapCharSet == SYMBOL_CHARSET) {
requested_family = font_family
} elseif (font_family != FF_DONTCARE) {
requested_family = FF_SWISS // Technically, if the requested font is "Tms Rmn", it will be FF_ROMAN, but I am not sure if we want this behavior
}
if (requested_family != font_family) {
if (font_family == FF_DONTCARE) {
score += 8000;
} else {
if (font_family > FF_MODERN) {
score += 50;
}
score += 9000;
}
}
FontCollector tries to reproduce what VSFilter does. VSFilter uses GDI to select a font and display it, so we need to emulate it.
We already properly emulate the score for the lfWeight and lfItalic attributes, but we don't emulate the score for lfPitchAndFamily and lfCharSet.
99% of the time, these properties don't affect the font that will be picked up. In general, they can affect the font picked up when the user has two fonts that are the same, but one is TrueType and the other is OpenType.
lfPitchAndFamily score algorithm
lfCharSet score algorithm
I still don't fully understand how GDI sets lfCharSet and lfPitchAndFamily, so I will need to dig deeper before I can implement it.
The text was updated successfully, but these errors were encountered: