Bug 1430446 - Prefer hinted glyph widths from FreeType, except when hinting is disabled or the font includes variations. r=lsalzman

This commit is contained in:
Jonathan Kew 2018-01-23 18:16:42 +00:00
Родитель 235e231532
Коммит 7ff4c1c33d
7 изменённых файлов: 19 добавлений и 12 удалений

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

@ -516,10 +516,10 @@ gfxFT2FontBase::GetFTGlyphAdvance(uint16_t aGID)
// Failed to get the FT_Face? Give up already.
return 0;
}
bool hinting = gfxPlatform::GetPlatform()->FontHintingEnabled();
int32_t flags =
gfxPlatform::GetPlatform()->FontHintingEnabled()
? FT_LOAD_ADVANCE_ONLY
: FT_LOAD_ADVANCE_ONLY | FT_LOAD_NO_AUTOHINT | FT_LOAD_NO_HINTING;
hinting ? FT_LOAD_ADVANCE_ONLY
: FT_LOAD_ADVANCE_ONLY | FT_LOAD_NO_AUTOHINT | FT_LOAD_NO_HINTING;
FT_Error ftError = FT_Load_Glyph(face.get(), aGID, flags);
MOZ_ASSERT(!ftError);
if (ftError != FT_Err_Ok) {
@ -527,7 +527,11 @@ gfxFT2FontBase::GetFTGlyphAdvance(uint16_t aGID)
return 0;
}
FT_Fixed advance = 0;
if (face.get()->face_flags & FT_FACE_FLAG_SCALABLE) {
// Due to freetype bug 52683 we MUST use the linearHoriAdvance field when
// dealing with a variation font; also use it for scalable fonts when not
// applying hinting. Otherwise, prefer hinted width from glyph->advance.x.
if ((face.get()->face_flags & FT_FACE_FLAG_SCALABLE) &&
(!hinting || (face.get()->face_flags & FT_FACE_FLAG_MULTIPLE_MASTERS))) {
advance = face.get()->glyph->linearHoriAdvance;
} else {
advance = face.get()->glyph->advance.x << 10; // convert 26.6 to 16.16

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

@ -16,7 +16,7 @@
== placeholder-3.html placeholder-overridden-ref.html
== placeholder-4.html placeholder-overridden-ref.html
== placeholder-5.html placeholder-visible-ref.html
fuzzy-if(winWidget,160,10) fuzzy-if(Android,1,1) fuzzy-if(asyncPan&&!layersGPUAccelerated,146,317) fuzzy-if(OSX==1010&&browserIsRemote,1,8) == placeholder-6.html placeholder-overflow-ref.html
fuzzy-if(winWidget,160,10) fuzzy-if(Android,1,1) fuzzy-if(asyncPan&&!layersGPUAccelerated,146,317) fuzzy-if(OSX==1010&&browserIsRemote,1,8) fails-if(webrender) == placeholder-6.html placeholder-overflow-ref.html
skip-if(Android&&asyncPan) == placeholder-6-textarea.html placeholder-overflow-textarea-ref.html
# needs-focus == placeholder-7.html placeholder-focus-ref.html
# needs-focus == placeholder-8.html placeholder-focus-ref.html

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

@ -196,10 +196,10 @@ needs-focus == deselectAll.svg deselectAll-ref.svg
fuzzy-if(skiaContent,1,250) needs-focus == selectSubString.svg selectSubString-ref.svg
fuzzy-if(skiaContent,1,600) needs-focus == selectSubString-2.svg selectSubString-2-ref.svg
fuzzy-if(skiaContent,1,250) needs-focus == selectSubString-3.svg selectSubString-3-ref.svg
fuzzy-if(webrender,1-1,294-294) needs-focus == simple-selection.svg simple-selection-ref.html
fuzzy-if(skiaContent,1,100) fuzzy-if(webrender,1-1,594-594) needs-focus == simple-bidi-selection.svg simple-bidi-selection-ref.html
fuzzy-if(skiaContent,1,50) fuzzy-if(webrender,1-1,294-294) needs-focus == simple-fill-color-selection.svg simple-fill-color-selection-ref.html
fuzzy-if(skiaContent,1,150) fuzzy-if(webrender,1-1,276-276) needs-focus == simple-underline-selection.svg simple-underline-selection-ref.html
fuzzy-if(skiaContent,1,300) fuzzy-if(webrender,1-1,1010-1010) needs-focus == multiple-text-selection.svg multiple-text-selection-ref.html
fuzzy-if(webrender,1-1,237-237) needs-focus == simple-selection.svg simple-selection-ref.html
fuzzy-if(skiaContent,1,100) fuzzy-if(webrender,1-1,575-575) needs-focus == simple-bidi-selection.svg simple-bidi-selection-ref.html
fuzzy-if(skiaContent,1,50) fuzzy-if(webrender,1-1,237-237) needs-focus == simple-fill-color-selection.svg simple-fill-color-selection-ref.html
fuzzy-if(skiaContent,1,150) fuzzy-if(webrender,1-1,222-222) needs-focus == simple-underline-selection.svg simple-underline-selection-ref.html
fuzzy-if(skiaContent,1,300) fuzzy-if(webrender,1-1,934-934) needs-focus == multiple-text-selection.svg multiple-text-selection-ref.html
needs-focus == multiple-chunks-selection.svg multiple-chunks-selection-ref.svg
fuzzy-if(skiaContent,1,200) needs-focus == textpath-selection.svg textpath-selection-ref.svg

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

@ -1,3 +1,4 @@
[background-root-002.xht]
expected:
if os == "win": FAIL
if os == "linux": FAIL

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

@ -0,0 +1,2 @@
[vertical-align-baseline-004a.xht]
expected: FAIL

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

@ -0,0 +1,2 @@
[vertical-align-baseline-005a.xht]
expected: FAIL

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

@ -1,2 +0,0 @@
[white-space-collapsing-preserve-breaks-001.xht]
expected: FAIL