mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-16 14:55:47 +00:00
Bug 1462231 - Implement support for font-size-adjust in the Android (FT2) font backend. r=lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D110019
This commit is contained in:
parent
e462ef4867
commit
ac8c50dc3d
@ -37,7 +37,7 @@ gfxFT2FontBase::gfxFT2FontBase(
|
||||
mFTLoadFlags(aLoadFlags | FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH |
|
||||
FT_LOAD_COLOR),
|
||||
mEmbolden(aEmbolden),
|
||||
mFTSize(1.0) {}
|
||||
mFTSize(0.0) {}
|
||||
|
||||
gfxFT2FontBase::~gfxFT2FontBase() { mFTFace->ForgetLockOwner(this); }
|
||||
|
||||
@ -219,6 +219,22 @@ void gfxFT2FontBase::InitMetrics() {
|
||||
return;
|
||||
}
|
||||
|
||||
if (GetStyle()->sizeAdjust > 0.0 && mFTSize == 0.0) {
|
||||
// If font-size-adjust is in effect, we need to get metrics in order to
|
||||
// determine the aspect ratio, then compute the final adjusted size and
|
||||
// re-initialize metrics.
|
||||
// This will clamp mFTSize to a minimum of 1.0, and therefore prevent
|
||||
// further recursion when calling InitMetrics here.
|
||||
mFTSize = FindClosestSize(mFTFace->GetFace(), GetAdjustedSize());
|
||||
InitMetrics();
|
||||
// Now do the font-size-adjust calculation and set the final size.
|
||||
gfxFloat aspect = mMetrics.xHeight / mMetrics.emHeight;
|
||||
mAdjustedSize = GetStyle()->GetAdjustedSize(aspect);
|
||||
// Ensure the FT_Face will be reconfigured for the new size next time we
|
||||
// need to use it.
|
||||
mFTFace->ForgetLockOwner(this);
|
||||
}
|
||||
|
||||
// Cairo metrics are normalized to em-space, so that whatever fixed size
|
||||
// might actually be chosen is factored out. They are then later scaled by
|
||||
// the font matrix to the target adjusted size. Stash the chosen closest
|
||||
|
@ -6,7 +6,7 @@ fails-if(Android) == fallback-01.xhtml fallback-01-ref.xhtml
|
||||
== font-selection-by-lang-01.html font-selection-by-lang-01-ref.html
|
||||
== font-selection-fallback-1.html font-selection-fallback-1-ref.html
|
||||
== font-selection-generic-1.html font-selection-generic-1-ref.html
|
||||
fails-if(Android) != font-size-adjust-01.html font-size-adjust-01-ref.html
|
||||
!= font-size-adjust-01.html font-size-adjust-01-ref.html
|
||||
# The following test passes consistently only on Mac OS X;
|
||||
# both Windows and Linux give results that vary depending on the font size/zoom factor used,
|
||||
# because hinting affects the metrics used to compute the font size adjustment. See bug 429605.
|
||||
|
@ -1,4 +0,0 @@
|
||||
[font-size-adjust-002.html]
|
||||
expected:
|
||||
if (os == "android") and not e10s: FAIL
|
||||
if (os == "android") and e10s: FAIL
|
Loading…
Reference in New Issue
Block a user