зеркало из https://github.com/mozilla/pjs.git
Bug 148690: For Xprint force use of outline scaleable fonts if possible. Author Roland.Mainz@informatik.med.uni-giessen.de, r=shanjian, sr=jst
This commit is contained in:
Родитель
106a6b8172
Коммит
8701307b55
|
@ -148,6 +148,7 @@ static void SetCharsetLangGroup(nsFontCharSetInfo* aCharSetInfo);
|
|||
|
||||
static int gFontMetricsGTKCount = 0;
|
||||
static int gInitialized = 0;
|
||||
static PRBool gForceOutlineScaledFonts = PR_FALSE;
|
||||
static PRBool gAllowDoubleByteSpecialChars = PR_TRUE;
|
||||
|
||||
// XXX many of these statics need to be freed at shutdown time
|
||||
|
@ -934,6 +935,12 @@ InitGlobals(void)
|
|||
SIZE_FONT_PRINTF(("gBitmapUndersize = %g", gBitmapUndersize));
|
||||
}
|
||||
|
||||
PRBool force_outline_scaled_fonts = gForceOutlineScaledFonts;
|
||||
rv = gPref->GetBoolPref("font.x11.force_outline_scaled_fonts", &force_outline_scaled_fonts);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
gForceOutlineScaledFonts = force_outline_scaled_fonts;
|
||||
}
|
||||
|
||||
PRBool enable_freetype2 = PR_TRUE;
|
||||
rv = gPref->GetBoolPref("font.FreeType2.enable", &enable_freetype2);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
|
@ -3696,7 +3703,7 @@ NodeAddSize(nsFontStretch* aStretch, int aSize, const char *aName,
|
|||
}
|
||||
|
||||
static void
|
||||
GetFontNames(const char* aPattern, PRBool aAnyFoundry, nsFontNodeArray* aNodes)
|
||||
GetFontNames(const char* aPattern, PRBool aAnyFoundry, PRBool aOnlyOutlineScaledFonts, nsFontNodeArray* aNodes)
|
||||
{
|
||||
#ifdef NS_FONT_DEBUG_CALL_TRACE
|
||||
if (gFontDebug & NS_FONT_DEBUG_CALL_TRACE) {
|
||||
|
@ -3867,6 +3874,10 @@ GetFontNames(const char* aPattern, PRBool aAnyFoundry, nsFontNodeArray* aNodes)
|
|||
if (!*charSetName) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (aOnlyOutlineScaledFonts && (outline_scaled == PR_FALSE)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_X_FONT_BANNING
|
||||
#define BOOL2STR(b) ((b)?("true"):("false"))
|
||||
|
@ -4043,7 +4054,7 @@ GetAllFontNames(void)
|
|||
}
|
||||
/* Using "-*" instead of the full-qualified "-*-*-*-*-*-*-*-*-*-*-*-*-*-*"
|
||||
* because it's faster and "smarter" - see bug 34242 for details. */
|
||||
GetFontNames("-*", PR_FALSE, gGlobalList);
|
||||
GetFontNames("-*", PR_FALSE, PR_FALSE, gGlobalList);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -4060,7 +4071,7 @@ FindFamily(nsCString* aName)
|
|||
char pattern[256];
|
||||
PR_snprintf(pattern, sizeof(pattern), "-*-%s-*-*-*-*-*-*-*-*-*-*-*-*",
|
||||
aName->get());
|
||||
GetFontNames(pattern, PR_TRUE, &family->mNodes);
|
||||
GetFontNames(pattern, PR_TRUE, gForceOutlineScaledFonts, &family->mNodes);
|
||||
gFamilies->Put(&key, family);
|
||||
}
|
||||
}
|
||||
|
@ -4154,7 +4165,7 @@ nsFontMetricsGTK::TryNodes(nsACString &aFFREName, PRUnichar aChar)
|
|||
nodes = new nsFontNodeArray;
|
||||
if (!nodes)
|
||||
return nsnull;
|
||||
GetFontNames(pattern.get(), anyFoundry, nodes);
|
||||
GetFontNames(pattern.get(), anyFoundry, gForceOutlineScaledFonts, nodes);
|
||||
gCachedFFRESearches->Put(&key, nodes);
|
||||
}
|
||||
int i, cnt = nodes->Count();
|
||||
|
@ -4183,7 +4194,7 @@ nsFontMetricsGTK::TryNode(nsCString* aName, PRUnichar aChar)
|
|||
nsCAutoString pattern;
|
||||
FFREToXLFDPattern(*aName, pattern);
|
||||
nsFontNodeArray nodes;
|
||||
GetFontNames(pattern.get(), PR_FALSE, &nodes);
|
||||
GetFontNames(pattern.get(), PR_FALSE, gForceOutlineScaledFonts, &nodes);
|
||||
// no need to call gFFRENodes->Put() since GetFontNames already did
|
||||
if (nodes.Count() > 0) {
|
||||
// This assertion is not spurious; when searching for an FFRE
|
||||
|
|
|
@ -167,6 +167,7 @@ static void SetCharsetLangGroup(nsFontCharSetInfoXlib* aCharSetInfo);
|
|||
|
||||
static int gFontMetricsXlibCount = 0;
|
||||
static PRBool gInitialized = PR_FALSE;
|
||||
static PRBool gForceOutlineScaledFonts = PR_FALSE;
|
||||
static XlibRgbHandle *gXlibRgbHandle = nsnull;
|
||||
static PRBool gAllowDoubleByteSpecialChars = PR_TRUE;
|
||||
|
||||
|
@ -972,6 +973,27 @@ nsFontMetricsXlib::InitGlobals(nsIDeviceContext *aDevice)
|
|||
SIZE_FONT_PRINTF(("gBitmapUndersize = %g", gBitmapUndersize));
|
||||
}
|
||||
|
||||
#ifdef USE_XPRINT
|
||||
if (nsFontMetricsXlib::mPrinterMode) {
|
||||
gForceOutlineScaledFonts = PR_TRUE;
|
||||
}
|
||||
#endif /* USE_XPRINT */
|
||||
|
||||
PRBool force_outline_scaled_fonts = gForceOutlineScaledFonts;
|
||||
#ifdef USE_XPRINT
|
||||
if (nsFontMetricsXlib::mPrinterMode) {
|
||||
rv = gPref->GetBoolPref("print.xprint.font.force_outline_scaled_fonts", &force_outline_scaled_fonts);
|
||||
}
|
||||
if (!nsFontMetricsXlib::mPrinterMode || NS_FAILED(rv)) {
|
||||
#endif /* USE_XPRINT */
|
||||
rv = gPref->GetBoolPref("font.x11.force_outline_scaled_fonts", &force_outline_scaled_fonts);
|
||||
#ifdef USE_XPRINT
|
||||
}
|
||||
#endif /* USE_XPRINT */
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
gForceOutlineScaledFonts = force_outline_scaled_fonts;
|
||||
}
|
||||
|
||||
#ifdef USE_FREETYPE
|
||||
PRBool enable_freetype2 = PR_TRUE;
|
||||
rv = gPref->GetBoolPref("font.FreeType2.enable", &enable_freetype2);
|
||||
|
@ -3962,7 +3984,7 @@ NodeAddSize(nsFontStretchXlib* aStretch, int aSize, const char *aName,
|
|||
}
|
||||
|
||||
static void
|
||||
GetFontNames(const char* aPattern, PRBool aAnyFoundry, nsFontNodeArrayXlib* aNodes)
|
||||
GetFontNames(const char* aPattern, PRBool aAnyFoundry, PRBool aOnlyOutlineScaledFonts, nsFontNodeArrayXlib* aNodes)
|
||||
{
|
||||
Display *dpy = xxlib_rgb_get_display(gXlibRgbHandle);
|
||||
Screen *scr = xxlib_rgb_get_screen (gXlibRgbHandle);
|
||||
|
@ -4209,6 +4231,10 @@ GetFontNames(const char* aPattern, PRBool aAnyFoundry, nsFontNodeArrayXlib* aNod
|
|||
if (!*charSetName) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (aOnlyOutlineScaledFonts && (outline_scaled == PR_FALSE)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_X_FONT_BANNING
|
||||
#define BOOL2STR(b) ((b)?("true"):("false"))
|
||||
|
@ -4391,7 +4417,7 @@ GetAllFontNames(void)
|
|||
}
|
||||
/* Using "-*" instead of the full-qualified "-*-*-*-*-*-*-*-*-*-*-*-*-*-*"
|
||||
* because it's faster and "smarter" - see bug 34242 for details. */
|
||||
GetFontNames("-*", PR_FALSE, gGlobalList);
|
||||
GetFontNames("-*", PR_FALSE, PR_FALSE, gGlobalList);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -4408,7 +4434,7 @@ FindFamily(nsCString* aName)
|
|||
char pattern[256];
|
||||
PR_snprintf(pattern, sizeof(pattern), "-*-%s-*-*-*-*-*-*-*-*-*-*-*-*",
|
||||
aName->get());
|
||||
GetFontNames(pattern, PR_TRUE, &family->mNodes);
|
||||
GetFontNames(pattern, PR_TRUE, gForceOutlineScaledFonts, &family->mNodes);
|
||||
gFamilies->Put(&key, family);
|
||||
}
|
||||
}
|
||||
|
@ -4501,7 +4527,7 @@ nsFontMetricsXlib::TryNodes(nsACString &aFFREName, PRUnichar aChar)
|
|||
nodes = new nsFontNodeArrayXlib;
|
||||
if (!nodes)
|
||||
return nsnull;
|
||||
GetFontNames(pattern.get(), anyFoundry, nodes);
|
||||
GetFontNames(pattern.get(), anyFoundry, gForceOutlineScaledFonts, nodes);
|
||||
gCachedFFRESearches->Put(&key, nodes);
|
||||
}
|
||||
int i, cnt = nodes->Count();
|
||||
|
@ -4530,7 +4556,7 @@ nsFontMetricsXlib::TryNode(nsCString* aName, PRUnichar aChar)
|
|||
nsCAutoString pattern;
|
||||
FFREToXLFDPattern(*aName, pattern);
|
||||
nsFontNodeArrayXlib nodes;
|
||||
GetFontNames(pattern.get(), PR_FALSE, &nodes);
|
||||
GetFontNames(pattern.get(), PR_FALSE, gForceOutlineScaledFonts, &nodes);
|
||||
// no need to call gFFRENodes->Put() since GetFontNames already did
|
||||
if (nodes.Count() > 0) {
|
||||
// This assertion is not spurious; when searching for an FFRE
|
||||
|
|
|
@ -413,8 +413,12 @@ nsDeviceContextXp::GetPrintContext(nsXPrintContext*& aContext)
|
|||
/* Enable hack "fix" for bug 88554/116158 ("Xprint module should avoid using
|
||||
* GFX fonts unless there is no other option...") until bug 93771 ("Mozilla
|
||||
* uses low-resolution bitmap fonts on high resolution X11 displays") gets
|
||||
* fixed. */
|
||||
#define XPRINT_FONT_HACK 1
|
||||
* fixed.
|
||||
*
|
||||
* Obsoleted with patch from bug 148690 ("RFE: Force use of outline
|
||||
* scaleable fonts if possible") ; code will be removed in a later step
|
||||
*/
|
||||
// #define XPRINT_FONT_HACK 1
|
||||
|
||||
class nsFontCacheXp : public nsFontCache
|
||||
{
|
||||
|
|
|
@ -328,11 +328,14 @@ pref("font.min-size.fixed.zh-TW", 10);
|
|||
//pref("print.xprint.font.rejectfontpattern",
|
||||
// "fname=-urw.*;scalable=false;outline_scaled=false;xdisplay=.*;xdpy=.*;ydpy=.*;xdevice=.*");
|
||||
|
||||
/* Xprint print module prefs */
|
||||
pref("print.xprint.font.force_outline_scaled_fonts", true);
|
||||
|
||||
/* PostScript print module prefs */
|
||||
pref("print.postscript.paper_size", "letter");
|
||||
pref("print.postscript.orientation", "portrait");
|
||||
pref("print.postscript.print_command", "lpr ${MOZ_PRINTER_NAME:+'-P'}${MOZ_PRINTER_NAME}");
|
||||
''
|
||||
|
||||
/* PostScript print module font config
|
||||
* this list is used by the postscript font
|
||||
* to enumerate the list of langGroups
|
||||
|
|
Загрузка…
Ссылка в новой задаче