зеркало из https://github.com/mozilla/pjs.git
[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:
Родитель
cd28ebba21
Коммит
989f651581
|
@ -205,5 +205,13 @@ milestone release.
|
|||
editor, EPM, and applications running in VIO windows) cannot paste more
|
||||
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
|
||||
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);
|
||||
#endif
|
||||
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
|
||||
mFontFace = cairo_ft_font_face_create_for_pattern(fcMatch);
|
||||
FcPatternDestroy(fcMatch);
|
||||
|
@ -390,6 +395,13 @@ gfxOS2FontGroup::gfxOS2FontGroup(const nsAString& aFamilies,
|
|||
(unsigned)aStyle);
|
||||
#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;
|
||||
mFontCache.Init(15);
|
||||
ForEachFont(FontCallback, &familyArray);
|
||||
|
@ -405,10 +417,11 @@ gfxOS2FontGroup::gfxOS2FontGroup(const nsAString& aFamilies,
|
|||
gfxPlatform::GetPlatform()->GetPrefFonts("x-user-def", fontString, PR_FALSE);
|
||||
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) {
|
||||
// Should append default GUI font if there are no available fonts.
|
||||
// We use WarpSans as in the default case in nsSystemFontsOS2.
|
||||
familyArray.AppendString(NS_LITERAL_STRING("WarpSans"));
|
||||
familyArray.AppendString(NS_LITERAL_STRING("Helv"));
|
||||
}
|
||||
|
||||
for (int i = 0; i < familyArray.Count(); i++) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче