Support wider range of TT fonts
Warren_Baird at cimmetry.com
Warren_Baird at cimmetry.com
Thu Feb 6 08:50:16 CST 2003
ChangeLog:
WineEngCreateFontInstance now support more truetype fonts.
Description:
The problem was related to the font 'fsCsb[0]' flags.
Those flags tell which charsets are supported by the font.
For many (old) fonts, those flags are not set (all zeros)...
So we should treat 'fsCsb[0] == 0' as a "wildcard" (accept all charsets).
Moreover, only truetype fonts having a 'ft_encoding_unicode' encoding were
working. All others 'charmap' were left NULL after calling OpenFontFile.
Now, if 'charmap' is still null, we try to use the 'ft_encoding_symbol'
and in the last resort, 'ft_encoding_apple_roman'.
Warren Baird : Warren_Baird at cimmetry.com
Louis Thibault
diff -ur clean/wine/dlls/gdi/freetype.c wine/dlls/gdi/freetype.c
--- clean/wine/dlls/gdi/freetype.c 24 Jan 2003 15:12:16 -0000 1.1.1.3
+++ wine/dlls/gdi/freetype.c 28 Jan 2003 21:02:10 -0000
@@ -737,13 +737,16 @@
int acp = GetACP(), i;
DWORD fs0;
+ /* If face->fsCsb[0] == 0, do as if the font support all charsets.
+ (csi.fs.fsCsb[0] is never 0) */
+
if(TranslateCharsetInfo((DWORD*)acp, &csi, TCI_SRCCODEPAGE))
- if(csi.fs.fsCsb[0] & face->fsCsb[0])
- return csi.ciCharset;
+ if((face->fsCsb[0] & csi.fs.fsCsb[0]) || !face->fsCsb[0])
+ return csi.ciCharset;
for(i = 0; i < 32; i++) {
fs0 = 1L << i;
- if(face->fsCsb[0] & fs0) {
+ if((face->fsCsb[0] & fs0) || !face->fsCsb[0]) {[0])AGE))rsets.'.re
if(TranslateCharsetInfo(&fs0, &csi, TCI_SRCFONTSIG))
return csi.ciCharset;
else
@@ -1001,10 +1004,11 @@
we fixup the returned charset later in get_nearest_charset
where we'll either use the charset of the current ansi codepage
or if that's unavailable the first charset that the font supports.
+ If fsCsb[0] == 0, do as if the font support all charsets.
*/
for(family = FontList; family; family = family->next) {
if(!strcmpiW(family->FamilyName, lf.lfFaceName))
- if((csi.fs.fsCsb[0] & family->FirstFace->fsCsb[0]) ||
!csi.fs.fsCsb[0])
+ if((csi.fs.fsCsb[0] & family->FirstFace->fsCsb[0]) ||
!csi.fs.fsCsb[0] || !family->FirstFace->fsCsb[0])
break;
}
@@ -1038,12 +1042,12 @@
} else
lf.lfCharSet = csi.ciCharset;
}
- if(lf.lfPitchAndFamily & FIXED_PITCH ||
- lf.lfPitchAndFamily & FF_MODERN)
+ if(((lf.lfPitchAndFamily & FIXED_PITCH) == FIXED_PITCH) ||
+ ((lf.lfPitchAndFamily & FF_MODERN) == FF_MODERN))
strcpyW(lf.lfFaceName, defFixed);
- else if(lf.lfPitchAndFamily & FF_ROMAN)
+ else if((lf.lfPitchAndFamily & FF_ROMAN) == FF_ROMAN)
strcpyW(lf.lfFaceName, defSerif);
- else if(lf.lfPitchAndFamily & FF_SWISS)
+ else if((lf.lfPitchAndFamily & FF_SWISS) == FF_SWISS)
strcpyW(lf.lfFaceName, defSans);
else
strcpyW(lf.lfFaceName, defSans);
@@ -1098,8 +1102,15 @@
return 0;
}
- if(ret->charset == SYMBOL_CHARSET)
- pFT_Select_Charmap(ret->ft_face, ft_encoding_symbol);
+ // In some cases, the font doesn't support ret->charset, don't trust it.
+ // If no charmap was selected by OpenFontFile (i.e. no unicode encoding),
+ // select symbol charset (if the font support it), or ansi charset.
+ if(!ret->ft_face->charmap && !pFT_Select_Charmap(ret->ft_face,
ft_encoding_symbol)) {
+ ret->charset = SYMBOL_CHARSET;
+ } else if(!ret->ft_face->charmap && !pFT_Select_Charmap(ret->ft_face,
ft_encoding_apple_roman)) {
+ ret->charset = ANSI_CHARSET;
+ }
+
ret->orientation = lf.lfOrientation;
ret->name = strdupW(family->FamilyName);
More information about the wine-patches
mailing list