[OS/2] Bug 381330: improve handling of system fonts, automatically replace WarpSans by Workplace Sans if available. OK from wuno for code via testing and stevew for the documentation part.

This commit is contained in:
mozilla@weilbacher.org 2007-11-28 13:46:10 -08:00
Родитель cd28ebba21
Коммит 989f651581
2 изменённых файлов: 24 добавлений и 3 удалений

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

@ -205,5 +205,13 @@ milestone release.
editor, EPM, and applications running in VIO windows) cannot paste more editor, EPM, and applications running in VIO windows) cannot paste more
than this. than this.
- Firefox cannot make use of OS/2 fonts like WarpSans and others which
are not available in Type1 or TrueType format. It is therefore
recommended to install the "Workplace Sans" font from
http://www.cs-club.org/~alex/creative/fonts/
or
http://hobbes.nmsu.edu/cgi-bin/h-search?key=wpsu_ttf
which Firefox will use as a replacement of WarpSans.
Other known problems can be found by following the link "Current Open Warpzilla Other known problems can be found by following the link "Current Open Warpzilla
Bugs" on the OS/2 Mozilla page <http://www.mozilla.org/ports/os2/>. Bugs" on the OS/2 Mozilla page <http://www.mozilla.org/ports/os2/>.

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

@ -312,6 +312,11 @@ cairo_font_face_t *gfxOS2Font::CairoFontFace()
(char *)str2, w2, i2, s2); (char *)str2, w2, i2, s2);
#endif #endif
FcPatternDestroy(fcPattern); FcPatternDestroy(fcPattern);
if (mName == NS_LITERAL_STRING("Workplace Sans") && fcW >= FC_WEIGHT_DEMIBOLD) {
// if we are dealing with Workplace Sans and want a bold font, we
// need to artificially embolden it (no bold counterpart yet)
FcPatternAddBool(fcMatch, FC_EMBOLDEN, FcTrue);
}
// and ask cairo to return a font face for this // and ask cairo to return a font face for this
mFontFace = cairo_ft_font_face_create_for_pattern(fcMatch); mFontFace = cairo_ft_font_face_create_for_pattern(fcMatch);
FcPatternDestroy(fcMatch); FcPatternDestroy(fcMatch);
@ -390,6 +395,13 @@ gfxOS2FontGroup::gfxOS2FontGroup(const nsAString& aFamilies,
(unsigned)aStyle); (unsigned)aStyle);
#endif #endif
// check for WarpSans and as we cannot display that (yet), replace
// it with Workplace Sans
int pos = 0;
if ((pos = mFamilies.Find("WarpSans", PR_FALSE, 0, -1)) > -1) {
mFamilies.Replace(pos, 8, NS_LITERAL_STRING("Workplace Sans"));
}
nsStringArray familyArray; nsStringArray familyArray;
mFontCache.Init(15); mFontCache.Init(15);
ForEachFont(FontCallback, &familyArray); ForEachFont(FontCallback, &familyArray);
@ -405,10 +417,11 @@ gfxOS2FontGroup::gfxOS2FontGroup(const nsAString& aFamilies,
gfxPlatform::GetPlatform()->GetPrefFonts("x-user-def", fontString, PR_FALSE); gfxPlatform::GetPlatform()->GetPrefFonts("x-user-def", fontString, PR_FALSE);
ForEachFont(fontString, NS_LITERAL_CSTRING("x-user-def"), FontCallback, &familyArray); ForEachFont(fontString, NS_LITERAL_CSTRING("x-user-def"), FontCallback, &familyArray);
// Should append some default font if there are no available fonts.
// Let's use Helv which should be available on any OS/2 system; if
// it's not there, Fontconfig replaces it with something else...
if (familyArray.Count() == 0) { if (familyArray.Count() == 0) {
// Should append default GUI font if there are no available fonts. familyArray.AppendString(NS_LITERAL_STRING("Helv"));
// We use WarpSans as in the default case in nsSystemFontsOS2.
familyArray.AppendString(NS_LITERAL_STRING("WarpSans"));
} }
for (int i = 0; i < familyArray.Count(); i++) { for (int i = 0; i < familyArray.Count(); i++) {