зеркало из https://github.com/mozilla/gecko-dev.git
bug 829523 - disable font hinting on b2g, but retain pixel-snapped metrics except in the browser app. r=cjones
This commit is contained in:
Родитель
1ecfd9cba4
Коммит
d8a1d9e121
|
@ -247,20 +247,53 @@ gfxAndroidPlatform::FontHintingEnabled()
|
|||
{
|
||||
// In "mobile" builds, we sometimes use non-reflow-zoom, so we
|
||||
// might not want hinting. Let's see.
|
||||
|
||||
#ifdef MOZ_USING_ANDROID_JAVA_WIDGETS
|
||||
// On android-java, we currently only use gecko to render web
|
||||
// content that can always be be non-reflow-zoomed. So turn off
|
||||
// hinting.
|
||||
//
|
||||
// XXX when gecko-android-java is used as an "app runtime", we'll
|
||||
// want to re-enable hinting.
|
||||
// XXX when gecko-android-java is used as an "app runtime", we may
|
||||
// want to re-enable hinting for non-browser processes there.
|
||||
return false;
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_B2G
|
||||
// On B2G, the UX preference is currently to keep hinting disabled
|
||||
// for all text (see bug 829523).
|
||||
return false;
|
||||
#else
|
||||
// Otherwise, enable hinting unless we're in a content process
|
||||
// that might be used for non-reflowing zoom.
|
||||
return XRE_GetProcessType() != GeckoProcessType_Content ||
|
||||
!ContentChild::GetSingleton()->IsForBrowser();
|
||||
#endif // MOZ_USING_ANDROID_JAVA_WIDGETS
|
||||
|
||||
// Currently, we don't have any other targets, but if/when we do,
|
||||
// decide how to handle them here.
|
||||
|
||||
NS_NOTREACHED("oops, what platform is this?");
|
||||
return gfxPlatform::FontHintingEnabled();
|
||||
}
|
||||
|
||||
bool
|
||||
gfxAndroidPlatform::RequiresLinearZoom()
|
||||
{
|
||||
#ifdef MOZ_USING_ANDROID_JAVA_WIDGETS
|
||||
// On android-java, we currently only use gecko to render web
|
||||
// content that can always be be non-reflow-zoomed.
|
||||
//
|
||||
// XXX when gecko-android-java is used as an "app runtime", we may
|
||||
// want to treat it like B2G and use linear zoom only for the web
|
||||
// browser process, not other apps.
|
||||
return true;
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_B2G
|
||||
// On B2G, we need linear zoom for the browser, but otherwise prefer
|
||||
// the improved glyph spacing that results from respecting the device
|
||||
// pixel resolution for glyph layout (see bug 816614).
|
||||
return XRE_GetProcessType() == GeckoProcessType_Content &&
|
||||
ContentChild::GetSingleton()->IsForBrowser();
|
||||
#endif
|
||||
|
||||
NS_NOTREACHED("oops, what platform is this?");
|
||||
return gfxPlatform::RequiresLinearZoom();
|
||||
}
|
||||
|
||||
int
|
||||
|
|
|
@ -65,6 +65,7 @@ public:
|
|||
gfxUserFontSet* aUserFontSet);
|
||||
|
||||
virtual bool FontHintingEnabled() MOZ_OVERRIDE;
|
||||
virtual bool RequiresLinearZoom() MOZ_OVERRIDE;
|
||||
|
||||
FT_Library GetFTLibrary();
|
||||
|
||||
|
|
|
@ -128,7 +128,7 @@ FT2FontEntry::CreateScaledFont(const gfxFontStyle *aStyle)
|
|||
|
||||
cairo_font_options_t *fontOptions = cairo_font_options_create();
|
||||
|
||||
if (!gfxPlatform::GetPlatform()->FontHintingEnabled()) {
|
||||
if (gfxPlatform::GetPlatform()->RequiresLinearZoom()) {
|
||||
cairo_font_options_set_hint_metrics(fontOptions, CAIRO_HINT_METRICS_OFF);
|
||||
}
|
||||
|
||||
|
|
|
@ -329,6 +329,22 @@ public:
|
|||
*/
|
||||
virtual bool FontHintingEnabled() { return true; }
|
||||
|
||||
/**
|
||||
* True when zooming should not require reflow, so glyph metrics and
|
||||
* positioning should not be adjusted for device pixels.
|
||||
* If this is TRUE, then FontHintingEnabled() should be FALSE,
|
||||
* but the converse is not necessarily required; in particular,
|
||||
* B2G always has FontHintingEnabled FALSE, but RequiresLinearZoom
|
||||
* is only true for the browser process, not Gaia or other apps.
|
||||
*
|
||||
* Like FontHintingEnabled (above), this setting shouldn't
|
||||
* change per gecko process, while the process is live. If so the
|
||||
* results are not defined.
|
||||
*
|
||||
* NB: this bit is only honored by the FT2 backend, currently.
|
||||
*/
|
||||
virtual bool RequiresLinearZoom() { return false; }
|
||||
|
||||
bool UsesSubpixelAATextRendering() {
|
||||
#ifdef MOZ_GFX_OPTIMIZE_MOBILE
|
||||
return false;
|
||||
|
|
|
@ -10,7 +10,7 @@ test-pref(layout.css.flexbox.enabled,true) == flexbox-pref-1.xhtml flexbox-pref-
|
|||
fails == flexbox-align-self-baseline-horiz-2.xhtml flexbox-align-self-baseline-horiz-2-ref.xhtml # bug 793456, and possibly others
|
||||
# This one fails on windows R (but not Ru, strangely). On Windows R, the
|
||||
# single-line <label> flex item has a different background size in test vs. ref
|
||||
random-if(winWidget) == flexbox-align-self-baseline-horiz-3.xhtml flexbox-align-self-baseline-horiz-3-ref.xhtml # XXXdholbert investigate
|
||||
fuzzy-if(B2G,10,3) random-if(winWidget) == flexbox-align-self-baseline-horiz-3.xhtml flexbox-align-self-baseline-horiz-3-ref.xhtml # XXXdholbert investigate
|
||||
== flexbox-align-self-baseline-horiz-4.xhtml flexbox-align-self-baseline-horiz-4-ref.xhtml
|
||||
|
||||
== flexbox-align-self-horiz-1-block.xhtml flexbox-align-self-horiz-1-ref.xhtml
|
||||
|
|
Загрузка…
Ссылка в новой задаче