Bug 321132 Japanese font grouping is not correct on font pref dialog. patch by Masatoshi Kimura (emk) <VYV03354@nifty.ne.jp> r+sr=rbs

This commit is contained in:
masayuki%d-toybox.com 2005-12-23 15:15:49 +00:00
Родитель 7c7d1ebe49
Коммит b117bec4bf
1 изменённых файлов: 17 добавлений и 1 удалений

Просмотреть файл

@ -5691,7 +5691,23 @@ SignatureMatchesLangGroup(FONTSIGNATURE* aSignature,
static int
FontMatchesGenericType(nsGlobalFont* aFont, const char* aGeneric)
{
switch (aFont->logFont.lfPitchAndFamily & 0xF0) {
PRUint8 family = aFont->logFont.lfPitchAndFamily & 0xF0;
PRUint8 pitch = aFont->logFont.lfPitchAndFamily & 0x0F;
// Japanese 'Mincho' fonts do not belong to FF_MODERN even if
// they are fixed pitch because they have variable stroke width.
if (family == FF_ROMAN && pitch & FIXED_PITCH) {
return !strcmp(aGeneric, "monospace");
}
// Japanese 'Gothic' fonts do not belong to FF_SWISS even if
// they are variable pitch because they have constant stroke width.
if (family == FF_MODERN && pitch & VARIABLE_PITCH) {
return !strcmp(aGeneric, "sans-serif");
}
// All other fonts will be grouped correctly using family...
switch (family) {
case FF_DONTCARE: return 1;
case FF_ROMAN: return !strcmp(aGeneric, "serif");
case FF_SWISS: return !strcmp(aGeneric, "sans-serif");