Changeset 191456 in webkit
- Timestamp:
- Oct 22, 2015 10:17:56 AM (8 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r191455 r191456 1 2015-10-22 Frederic Wang <fred.wang@free.fr> 2 3 [Mac] Add support for the USE_TYPO_METRICS flag 4 https://bugs.webkit.org/show_bug.cgi?id=150394 5 6 Reviewed by Myles C. Maxfield. 7 8 Update font, reference and Mac expectation for fonts/use-typo-metrics-1.html 9 10 * fonts/lineheight5000-typolineheight2300.woff: Add a MATH table. 11 * platform/mac-mavericks/mathml/opentype/opentype-stretchy-horizontal-expected.txt: Updated. 12 * platform/mac/TestExpectations: Remove Mac failure expectation. 13 * platform/mac/mathml/opentype/opentype-stretchy-expected.txt: Updated. 14 * platform/mac/mathml/opentype/opentype-stretchy-horizontal-expected.txt: Updated. 15 1 16 2015-10-22 Michael Saboff <msaboff@apple.com> 2 17 -
trunk/LayoutTests/platform/mac-mavericks/mathml/opentype/opentype-stretchy-horizontal-expected.txt
r191444 r191456 11 11 RenderMathMLBlock (anonymous, flex) at (2,0) size 11x4 12 12 RenderBlock (anonymous) at (0,0) size 2x4 13 RenderText at (0,-3) size 2x 1013 RenderText at (0,-3) size 2x0 14 14 text run at (0,-3) width 2: "\x{219C}" 15 15 RenderMathMLSpace {mspace} at (4,0) size 8x1 … … 22 22 RenderMathMLBlock (anonymous, flex) at (2,0) size 22x4 23 23 RenderBlock (anonymous) at (0,0) size 2x4 24 RenderText at (0,-3) size 2x 1024 RenderText at (0,-3) size 2x0 25 25 text run at (0,-3) width 2: "\x{219C}" 26 26 RenderMathMLSpace {mspace} at (5,0) size 16x1 … … 33 33 RenderMathMLBlock (anonymous, flex) at (2,0) size 151x4 34 34 RenderBlock (anonymous) at (0,0) size 2x4 35 RenderText at (0,-3) size 2x 1035 RenderText at (0,-3) size 2x0 36 36 text run at (0,-3) width 2: "\x{219C}" 37 37 RenderMathMLSpace {mspace} at (2,0) size 151x1 -
trunk/LayoutTests/platform/mac/TestExpectations
r191444 r191456 1349 1349 # Imported Blink tests which have not been investigated. 1350 1350 imported/blink/compositing/video/video-controls-layer-creation-squashing.html [ Pass ImageOnlyFailure ] 1351 1352 # USE_TYPO_METRICS is not implemented on mac.1353 webkit.org/b/131839 fonts/use-typo-metrics-1.html [ ImageOnlyFailure ] -
trunk/LayoutTests/platform/mac/mathml/opentype/opentype-stretchy-expected.txt
r191444 r191456 10 10 RenderMathMLBlock (anonymous, flex) at (2,0) size 42x3 11 11 RenderBlock (anonymous) at (0,0) size 3x3 12 RenderText at (0,-3) size 3x 1012 RenderText at (0,-3) size 3x0 13 13 text run at (0,-3) width 3: "\x{219F}" 14 14 RenderText {#text} at (48,16) size 5x18 … … 19 19 RenderMathMLBlock (anonymous, flex) at (2,0) size 42x3 20 20 RenderBlock (anonymous) at (0,0) size 3x3 21 RenderText at (0,-3) size 3x 1021 RenderText at (0,-3) size 3x0 22 22 text run at (0,-3) width 3: "\x{219F}" 23 23 RenderText {#text} at (100,16) size 5x18 … … 28 28 RenderMathMLBlock (anonymous, flex) at (2,0) size 42x3 29 29 RenderBlock (anonymous) at (0,0) size 3x3 30 RenderText at (0,-3) size 3x 1030 RenderText at (0,-3) size 3x0 31 31 text run at (0,-3) width 3: "\x{219F}" 32 32 RenderText {#text} at (0,0) size 0x0 … … 37 37 RenderMathMLBlock (anonymous, flex) at (2,0) size 42x3 38 38 RenderBlock (anonymous) at (0,0) size 3x3 39 RenderText at (0,-3) size 3x 1039 RenderText at (0,-3) size 3x0 40 40 text run at (0,-3) width 3: "\x{219F}" 41 41 RenderText {#text} at (0,0) size 0x0 … … 46 46 RenderMathMLBlock (anonymous, flex) at (0,0) size 83x12 47 47 RenderBlock (anonymous) at (0,0) size 11x12 48 RenderText at (0,6) size 11x 1048 RenderText at (0,6) size 11x0 49 49 text run at (0,6) width 11: "\x{2A1B}" 50 50 RenderText {#text} at (0,0) size 0x0 -
trunk/LayoutTests/platform/mac/mathml/opentype/opentype-stretchy-horizontal-expected.txt
r191444 r191456 11 11 RenderMathMLBlock (anonymous, flex) at (2,0) size 11x4 12 12 RenderBlock (anonymous) at (0,0) size 2x4 13 RenderText at (0,-3) size 2x 1013 RenderText at (0,-3) size 2x0 14 14 text run at (0,-3) width 2: "\x{219C}" 15 15 RenderMathMLSpace {mspace} at (4,0) size 8x1 … … 22 22 RenderMathMLBlock (anonymous, flex) at (2,0) size 22x4 23 23 RenderBlock (anonymous) at (0,0) size 2x4 24 RenderText at (0,-3) size 2x 1024 RenderText at (0,-3) size 2x0 25 25 text run at (0,-3) width 2: "\x{219C}" 26 26 RenderMathMLSpace {mspace} at (5,0) size 16x1 … … 33 33 RenderMathMLBlock (anonymous, flex) at (2,0) size 151x4 34 34 RenderBlock (anonymous) at (0,0) size 2x4 35 RenderText at (0,-3) size 2x 1035 RenderText at (0,-3) size 2x0 36 36 text run at (0,-3) width 2: "\x{219C}" 37 37 RenderMathMLSpace {mspace} at (2,0) size 151x1 -
trunk/Source/WebCore/ChangeLog
r191452 r191456 1 2015-10-22 Frederic Wang <fred.wang@free.fr> 2 3 [Mac] Add support for the USE_TYPO_METRICS flag 4 https://bugs.webkit.org/show_bug.cgi?id=150394 5 6 Reviewed by Myles C. Maxfield. 7 8 Make the Cocoa backend use the typo metrics for fonts with a MATH table when the OS/2 USE_TYPO_METRICS flag is set. 9 10 No new tests because this is already tested by fonts/use-typo-metrics-1.html 11 12 * platform/graphics/cocoa/FontCocoa.mm: 13 (WebCore::fontHasMathTable): Add a function to verify whether a font has a MATH table. 14 (WebCore::Font::platformInit): Verify whether the OS/2 USE_TYPO_METRICS flag is set and use the typo metrics if that is the case. 15 1 16 2015-10-22 Wenson Hsieh <wenson_hsieh@apple.com> 2 17 -
trunk/Source/WebCore/platform/graphics/cocoa/FontCocoa.mm
r191444 r191456 58 58 #endif 59 59 60 #if USE(APPKIT) 61 #include "OpenTypeTypes.h" 62 #endif 63 60 64 namespace WebCore { 61 65 … … 74 78 75 79 #if USE(APPKIT) 80 static bool fontHasMathTable(CTFontRef ctFont) 81 { 82 RetainPtr<CFArrayRef> tableTags = adoptCF(CTFontCopyAvailableTables(ctFont, kCTFontTableOptionNoOptions)); 83 CFIndex numTables = CFArrayGetCount(tableTags.get()); 84 for (CFIndex index = 0; index < numTables; ++index) { 85 CTFontTableTag tag = (CTFontTableTag)(uintptr_t)CFArrayGetValueAtIndex(tableTags.get(), index); 86 if (tag == 'MATH') 87 return true; 88 } 89 return false; 90 } 91 76 92 static NSString *webFallbackFontFamily(void) 77 93 { … … 171 187 float lineGap = scaleEmToUnits(CGFontGetLeading(m_platformData.cgFont()), unitsPerEm) * pointSize; 172 188 189 // The Open Font Format describes the OS/2 USE_TYPO_METRICS flag as follows: 190 // "If set, it is strongly recommended to use OS/2.sTypoAscender - OS/2.sTypoDescender+ OS/2.sTypoLineGap as a value for default line spacing for this font." 191 // We only apply this rule in the important case of fonts with a MATH table. 192 if (fontHasMathTable(m_platformData.ctFont())) { 193 if (CFDataRef os2Table = CGFontCopyTableForTag(m_platformData.cgFont(), kCTFontTableOS2)) { 194 // For the structure of the OS/2 table, see 195 // https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6OS2.html 196 const CFIndex fsSelectionOffset = 16 * 2 + 10 + 4 * 4 + 4 * 1; 197 const CFIndex sTypoAscenderOffset = fsSelectionOffset + 3 * 2; 198 const CFIndex sTypoDescenderOffset = sTypoAscenderOffset + 2; 199 const CFIndex sTypoLineGapOffset = sTypoDescenderOffset + 2; 200 if (CFDataGetLength(os2Table) >= sTypoLineGapOffset + 2) { 201 const UInt8* os2Data = CFDataGetBytePtr(os2Table); 202 const unsigned short useTypoMetricsMask = 1 << 7; 203 if (*(reinterpret_cast<const OpenType::UInt16*>(os2Data + fsSelectionOffset)) & useTypoMetricsMask) { 204 ascent = scaleEmToUnits(*(reinterpret_cast<const OpenType::Int16*>(os2Data + sTypoAscenderOffset)), unitsPerEm) * pointSize; 205 descent = -scaleEmToUnits(*(reinterpret_cast<const OpenType::Int16*>(os2Data + sTypoDescenderOffset)), unitsPerEm) * pointSize; 206 lineGap = scaleEmToUnits(*(reinterpret_cast<const OpenType::Int16*>(os2Data + sTypoLineGapOffset)), unitsPerEm) * pointSize; 207 } 208 } 209 CFRelease(os2Table); 210 } 211 } 212 173 213 // We need to adjust Times, Helvetica, and Courier to closely match the 174 214 // vertical metrics of their Microsoft counterparts that are the de facto
Note: See TracChangeset
for help on using the changeset viewer.