<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[192017] trunk/Source/WebCore</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/192017">192017</a></dd>
<dt>Author</dt> <dd>fred.wang@free.fr</dd>
<dt>Date</dt> <dd>2015-11-04 00:50:31 -0800 (Wed, 04 Nov 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Add support for the USE_TYPO_METRICS flag on iOS
https://bugs.webkit.org/show_bug.cgi?id=131839

Reviewed by Darin Adler.

Make the iOS Font service use the typo metrics for fonts with a MATH table when the OS/2 USE_TYPO_METRICS flag is set.
The code shared by iOS, OS X and AppleWin is moved into a separate OpenTypeCG module.

No new tests because this is already tested by fonts/use-typo-metrics-1.html

* PlatformAppleWin.cmake: Add OpenTypeCG files.
* PlatformMac.cmake: ditto.
* WebCore.vcxproj/WebCore.vcxproj: ditto.
* WebCore.vcxproj/WebCore.vcxproj.filters: ditto.
* WebCore.xcodeproj/project.pbxproj: ditto.
* platform/graphics/cocoa/FontCocoa.mm:
(WebCore::Font::platformInit): Use functions from OpenTypeCG.
(WebCore::fontHasMathTable): Deleted.
* platform/graphics/ios/FontServicesIOS.mm:
(WebCore::FontServicesIOS::FontServicesIOS): Use the typo metrics for fonts with a MATH table when the OS/2 USE_TYPO_METRICS flag is set.
* platform/graphics/opentype/OpenTypeCG.h: Added.
* platform/graphics/opentype/OpenTypeCG.cpp: Added.
(WebCore::OpenType::fontHasMathTable): Move this code from FontCocoa.mm.
(WebCore::OpenType::readShortFromTable): Inline function to read a 16-bit big endian integer from the OS/2 table and to cast it into a short integer.
(WebCore::OpenType::tryGetTypoMetrics): Move this code from FontCocoa.mm.
* platform/graphics/opentype/OpenTypeTypes.h: Add missing Glyph.h header needed by TableWithCoverage::getCoverageIndex.
* platform/graphics/win/SimpleFontDataCGWin.cpp:
(WebCore::Font::platformInit): Use functions from OpenTypeCG.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorePlatformAppleWincmake">trunk/Source/WebCore/PlatformAppleWin.cmake</a></li>
<li><a href="#trunkSourceWebCorePlatformMaccmake">trunk/Source/WebCore/PlatformMac.cmake</a></li>
<li><a href="#trunkSourceWebCoreWebCorevcxprojWebCorevcxproj">trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj</a></li>
<li><a href="#trunkSourceWebCoreWebCorevcxprojWebCorevcxprojfilters">trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscocoaFontCocoamm">trunk/Source/WebCore/platform/graphics/cocoa/FontCocoa.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsiosFontServicesIOSmm">trunk/Source/WebCore/platform/graphics/ios/FontServicesIOS.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsopentypeOpenTypeTypesh">trunk/Source/WebCore/platform/graphics/opentype/OpenTypeTypes.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicswinSimpleFontDataCGWincpp">trunk/Source/WebCore/platform/graphics/win/SimpleFontDataCGWin.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreplatformgraphicsopentypeOpenTypeCGcpp">trunk/Source/WebCore/platform/graphics/opentype/OpenTypeCG.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsopentypeOpenTypeCGh">trunk/Source/WebCore/platform/graphics/opentype/OpenTypeCG.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (192016 => 192017)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-11-04 08:10:09 UTC (rev 192016)
+++ trunk/Source/WebCore/ChangeLog        2015-11-04 08:50:31 UTC (rev 192017)
</span><span class="lines">@@ -1,3 +1,34 @@
</span><ins>+2015-11-04  Frederic Wang  &lt;fred.wang@free.fr&gt;
+
+        Add support for the USE_TYPO_METRICS flag on iOS
+        https://bugs.webkit.org/show_bug.cgi?id=131839
+
+        Reviewed by Darin Adler.
+
+        Make the iOS Font service use the typo metrics for fonts with a MATH table when the OS/2 USE_TYPO_METRICS flag is set.
+        The code shared by iOS, OS X and AppleWin is moved into a separate OpenTypeCG module.
+
+        No new tests because this is already tested by fonts/use-typo-metrics-1.html
+
+        * PlatformAppleWin.cmake: Add OpenTypeCG files.
+        * PlatformMac.cmake: ditto.
+        * WebCore.vcxproj/WebCore.vcxproj: ditto.
+        * WebCore.vcxproj/WebCore.vcxproj.filters: ditto.
+        * WebCore.xcodeproj/project.pbxproj: ditto.
+        * platform/graphics/cocoa/FontCocoa.mm:
+        (WebCore::Font::platformInit): Use functions from OpenTypeCG.
+        (WebCore::fontHasMathTable): Deleted.
+        * platform/graphics/ios/FontServicesIOS.mm:
+        (WebCore::FontServicesIOS::FontServicesIOS): Use the typo metrics for fonts with a MATH table when the OS/2 USE_TYPO_METRICS flag is set.
+        * platform/graphics/opentype/OpenTypeCG.h: Added.
+        * platform/graphics/opentype/OpenTypeCG.cpp: Added.
+        (WebCore::OpenType::fontHasMathTable): Move this code from FontCocoa.mm.
+        (WebCore::OpenType::readShortFromTable): Inline function to read a 16-bit big endian integer from the OS/2 table and to cast it into a short integer.
+        (WebCore::OpenType::tryGetTypoMetrics): Move this code from FontCocoa.mm.
+        * platform/graphics/opentype/OpenTypeTypes.h: Add missing Glyph.h header needed by TableWithCoverage::getCoverageIndex.
+        * platform/graphics/win/SimpleFontDataCGWin.cpp:
+        (WebCore::Font::platformInit): Use functions from OpenTypeCG.
+
</ins><span class="cx"> 2015-11-04  Chris Dumez  &lt;cdumez@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Regression(r191652): Colloquy doesn’t render any chat content
</span></span></pre></div>
<a id="trunkSourceWebCorePlatformAppleWincmake"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/PlatformAppleWin.cmake (192016 => 192017)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/PlatformAppleWin.cmake        2015-11-04 08:10:09 UTC (rev 192016)
+++ trunk/Source/WebCore/PlatformAppleWin.cmake        2015-11-04 08:50:31 UTC (rev 192017)
</span><span class="lines">@@ -82,6 +82,8 @@
</span><span class="cx">     platform/graphics/cg/SubimageCacheWithTimer.cpp
</span><span class="cx">     platform/graphics/cg/TransformationMatrixCG.cpp
</span><span class="cx"> 
</span><ins>+    platform/graphics/opentype/OpenTypeCG.cpp
+
</ins><span class="cx">     platform/graphics/win/FontCGWin.cpp
</span><span class="cx">     platform/graphics/win/FontCustomPlatformData.cpp
</span><span class="cx">     platform/graphics/win/FontPlatformDataCGWin.cpp
</span></span></pre></div>
<a id="trunkSourceWebCorePlatformMaccmake"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/PlatformMac.cmake (192016 => 192017)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/PlatformMac.cmake        2015-11-04 08:10:09 UTC (rev 192016)
+++ trunk/Source/WebCore/PlatformMac.cmake        2015-11-04 08:50:31 UTC (rev 192017)
</span><span class="lines">@@ -442,6 +442,7 @@
</span><span class="cx">     platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp
</span><span class="cx">     platform/graphics/opengl/TemporaryOpenGLSetting.cpp
</span><span class="cx"> 
</span><ins>+    platform/graphics/opentype/OpenTypeCG.cpp
</ins><span class="cx">     platform/graphics/opentype/OpenTypeMathData.cpp
</span><span class="cx"> 
</span><span class="cx">     platform/mac/BlockExceptions.mm
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorevcxprojWebCorevcxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj (192016 => 192017)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj        2015-11-04 08:10:09 UTC (rev 192016)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj        2015-11-04 08:50:31 UTC (rev 192017)
</span><span class="lines">@@ -8462,6 +8462,12 @@
</span><span class="cx">     &lt;ClCompile Include=&quot;..\platform\graphics\win\IntRectWin.cpp&quot; /&gt;
</span><span class="cx">     &lt;ClCompile Include=&quot;..\platform\graphics\win\IntSizeWin.cpp&quot; /&gt;
</span><span class="cx">     &lt;ClCompile Include=&quot;..\platform\graphics\win\MediaPlayerPrivateFullscreenWindow.cpp&quot; /&gt;
</span><ins>+    &lt;ClCompile Include=&quot;..\platform\graphics\opentype\OpenTypeCG.cpp&quot;&gt;
+      &lt;ExcludedFromBuild Condition=&quot;'$(Configuration)|$(Platform)'=='Debug_WinCairo|Win32'&quot;&gt;true&lt;/ExcludedFromBuild&gt;
+      &lt;ExcludedFromBuild Condition=&quot;'$(Configuration)|$(Platform)'=='Debug_WinCairo|x64'&quot;&gt;true&lt;/ExcludedFromBuild&gt;
+      &lt;ExcludedFromBuild Condition=&quot;'$(Configuration)|$(Platform)'=='Release_WinCairo|Win32'&quot;&gt;true&lt;/ExcludedFromBuild&gt;
+      &lt;ExcludedFromBuild Condition=&quot;'$(Configuration)|$(Platform)'=='Release_WinCairo|x64'&quot;&gt;true&lt;/ExcludedFromBuild&gt;
+    &lt;/ClCompile&gt;
</ins><span class="cx">     &lt;ClCompile Include=&quot;..\platform\graphics\opentype\OpenTypeMathData.cpp&quot; /&gt;
</span><span class="cx">     &lt;ClCompile Include=&quot;..\platform\graphics\opentype\OpenTypeUtilities.cpp&quot; /&gt;
</span><span class="cx">     &lt;ClCompile Include=&quot;..\platform\graphics\opentype\OpenTypeVerticalData.cpp&quot; /&gt;
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorevcxprojWebCorevcxprojfilters"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters (192016 => 192017)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters        2015-11-04 08:10:09 UTC (rev 192016)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters        2015-11-04 08:50:31 UTC (rev 192017)
</span><span class="lines">@@ -7128,6 +7128,9 @@
</span><span class="cx">     &lt;ClCompile Include=&quot;$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\WebCore\DerivedSources\JSWebGLRenderingContextBase.cpp&quot;&gt;
</span><span class="cx">       &lt;Filter&gt;DerivedSources&lt;/Filter&gt;
</span><span class="cx">     &lt;/ClCompile&gt;
</span><ins>+    &lt;ClCompile Include=&quot;..\platform\graphics\opentype\OpenTypeCG.cpp&quot;&gt;
+      &lt;Filter&gt;platform\graphics\opentype&lt;/Filter&gt;
+    &lt;/ClCompile&gt;
</ins><span class="cx">     &lt;ClCompile Include=&quot;..\platform\graphics\opentype\OpenTypeMathData.cpp&quot;&gt;
</span><span class="cx">       &lt;Filter&gt;platform\graphics\opentype&lt;/Filter&gt;
</span><span class="cx">     &lt;/ClCompile&gt;
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (192016 => 192017)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2015-11-04 08:10:09 UTC (rev 192016)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2015-11-04 08:50:31 UTC (rev 192017)
</span><span class="lines">@@ -4995,6 +4995,8 @@
</span><span class="cx">                 B2C3DA6B0D006CD600EF6F26 /* FontSelector.h in Headers */ = {isa = PBXBuildFile; fileRef = B2C3DA5A0D006CD600EF6F26 /* FontSelector.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 B2C3DA6C0D006CD600EF6F26 /* GlyphBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = B2C3DA5B0D006CD600EF6F26 /* GlyphBuffer.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 B2C96D8D0B3AF2B7005E80EC /* JSSVGPathSegCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2C96D8C0B3AF2B7005E80EC /* JSSVGPathSegCustom.cpp */; };
</span><ins>+                B2D3DA640D006CD600EF6F3A /* OpenTypeCG.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2D3DA530D006CD600EF6F3A /* OpenTypeCG.cpp */; };
+                B2D3DA650D006CD600EF6F3A /* OpenTypeCG.h in Headers */ = {isa = PBXBuildFile; fileRef = B2D3DA540D006CD600EF6F3A /* OpenTypeCG.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 B2D3DA640D006CD600EF6F27 /* OpenTypeMathData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2D3DA530D006CD600EF6F27 /* OpenTypeMathData.cpp */; };
</span><span class="cx">                 B2D3DA650D006CD600EF6F27 /* OpenTypeMathData.h in Headers */ = {isa = PBXBuildFile; fileRef = B2D3DA540D006CD600EF6F27 /* OpenTypeMathData.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 B2D3EA650D006CD600EF6F28 /* OpenTypeTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = B2D3EA540D006CD600EF6F28 /* OpenTypeTypes.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="lines">@@ -12729,6 +12731,8 @@
</span><span class="cx">                 B2C3DA5A0D006CD600EF6F26 /* FontSelector.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = FontSelector.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 B2C3DA5B0D006CD600EF6F26 /* GlyphBuffer.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = GlyphBuffer.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 B2C96D8C0B3AF2B7005E80EC /* JSSVGPathSegCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSSVGPathSegCustom.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                B2D3DA530D006CD600EF6F3A /* OpenTypeCG.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = OpenTypeCG.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                B2D3DA540D006CD600EF6F3A /* OpenTypeCG.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = OpenTypeCG.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 B2D3DA530D006CD600EF6F27 /* OpenTypeMathData.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = OpenTypeMathData.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 B2D3DA540D006CD600EF6F27 /* OpenTypeMathData.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = OpenTypeMathData.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 B2D3EA540D006CD600EF6F28 /* OpenTypeTypes.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = OpenTypeTypes.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -16286,6 +16290,8 @@
</span><span class="cx">                 3721493318F0B6D600156EDC /* opentype */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><ins>+                                B2D3DA530D006CD600EF6F3A /* OpenTypeCG.cpp */,
+                                B2D3DA540D006CD600EF6F3A /* OpenTypeCG.h */,
</ins><span class="cx">                                 B2D3DA530D006CD600EF6F27 /* OpenTypeMathData.cpp */,
</span><span class="cx">                                 B2D3DA540D006CD600EF6F27 /* OpenTypeMathData.h */,
</span><span class="cx">                                 B2D3EA540D006CD600EF6F28 /* OpenTypeTypes.h */,
</span><span class="lines">@@ -26761,6 +26767,7 @@
</span><span class="cx">                                 FDA3E95A134A49EF008D4B5A /* OfflineAudioCompletionEvent.h in Headers */,
</span><span class="cx">                                 FDA9325E16703B2A008982DC /* OfflineAudioContext.h in Headers */,
</span><span class="cx">                                 FDA3E95C134A49EF008D4B5A /* OfflineAudioDestinationNode.h in Headers */,
</span><ins>+                                B2D3DA650D006CD600EF6F3A /* OpenTypeCG.h in Headers */,
</ins><span class="cx">                                 B2D3DA650D006CD600EF6F27 /* OpenTypeMathData.h in Headers */,
</span><span class="cx">                                 B2D3EA650D006CD600EF6F28 /* OpenTypeTypes.h in Headers */,
</span><span class="cx">                                 CDE7FC45181904B1002BBB77 /* OrderIterator.h in Headers */,
</span><span class="lines">@@ -30401,6 +30408,7 @@
</span><span class="cx">                                 FDA3E959134A49EF008D4B5A /* OfflineAudioCompletionEvent.cpp in Sources */,
</span><span class="cx">                                 FDA9325D16703B2A008982DC /* OfflineAudioContext.cpp in Sources */,
</span><span class="cx">                                 FDA3E95B134A49EF008D4B5A /* OfflineAudioDestinationNode.cpp in Sources */,
</span><ins>+                                B2D3DA640D006CD600EF6F3A /* OpenTypeCG.cpp in Sources */,
</ins><span class="cx">                                 B2D3DA640D006CD600EF6F27 /* OpenTypeMathData.cpp in Sources */,
</span><span class="cx">                                 CDE7FC44181904B1002BBB77 /* OrderIterator.cpp in Sources */,
</span><span class="cx">                                 0014628A103CD1DE000B20DB /* OriginAccessEntry.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscocoaFontCocoamm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/cocoa/FontCocoa.mm (192016 => 192017)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/cocoa/FontCocoa.mm        2015-11-04 08:10:09 UTC (rev 192016)
+++ trunk/Source/WebCore/platform/graphics/cocoa/FontCocoa.mm        2015-11-04 08:50:31 UTC (rev 192017)
</span><span class="lines">@@ -58,7 +58,7 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if USE(APPKIT)
</span><del>-#include &quot;OpenTypeTypes.h&quot;
</del><ins>+#import &quot;OpenTypeCG.h&quot;
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -77,18 +77,6 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if USE(APPKIT)
</span><del>-static bool fontHasMathTable(CTFontRef ctFont)
-{
-    RetainPtr&lt;CFArrayRef&gt; tableTags = adoptCF(CTFontCopyAvailableTables(ctFont, kCTFontTableOptionNoOptions));
-    CFIndex numTables = CFArrayGetCount(tableTags.get());
-    for (CFIndex index = 0; index &lt; numTables; ++index) {
-        CTFontTableTag tag = (CTFontTableTag)(uintptr_t)CFArrayGetValueAtIndex(tableTags.get(), index);
-        if (tag == 'MATH')
-            return true;
-    }
-    return false;
-}
-
</del><span class="cx"> static NSString *webFallbackFontFamily(void)
</span><span class="cx"> {
</span><span class="cx">     static NSString *webFallbackFontFamily = [[[NSFont systemFontOfSize:16.0f] familyName] retain];
</span><span class="lines">@@ -188,25 +176,13 @@
</span><span class="cx"> 
</span><span class="cx">     // The Open Font Format describes the OS/2 USE_TYPO_METRICS flag as follows:
</span><span class="cx">     // &quot;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.&quot;
</span><del>-    // We only apply this rule in the important case of fonts with a MATH table.
-    if (fontHasMathTable(m_platformData.ctFont())) {
-        if (CFDataRef os2Table = CGFontCopyTableForTag(m_platformData.cgFont(), kCTFontTableOS2)) {
-            // For the structure of the OS/2 table, see
-            // https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6OS2.html
-            const CFIndex fsSelectionOffset = 16 * 2 + 10 + 4 * 4 + 4 * 1;
-            const CFIndex sTypoAscenderOffset = fsSelectionOffset + 3 * 2;
-            const CFIndex sTypoDescenderOffset = sTypoAscenderOffset + 2;
-            const CFIndex sTypoLineGapOffset = sTypoDescenderOffset + 2;
-            if (CFDataGetLength(os2Table) &gt;= sTypoLineGapOffset + 2) {
-                const UInt8* os2Data = CFDataGetBytePtr(os2Table);
-                const unsigned short useTypoMetricsMask = 1 &lt;&lt; 7;
-                if (*(reinterpret_cast&lt;const OpenType::UInt16*&gt;(os2Data + fsSelectionOffset)) &amp; useTypoMetricsMask) {
-                    ascent = scaleEmToUnits(*(reinterpret_cast&lt;const OpenType::Int16*&gt;(os2Data + sTypoAscenderOffset)), unitsPerEm) * pointSize;
-                    descent = -scaleEmToUnits(*(reinterpret_cast&lt;const OpenType::Int16*&gt;(os2Data + sTypoDescenderOffset)), unitsPerEm) * pointSize;
-                    lineGap = scaleEmToUnits(*(reinterpret_cast&lt;const OpenType::Int16*&gt;(os2Data + sTypoLineGapOffset)), unitsPerEm) * pointSize;
-                }
-            }
-            CFRelease(os2Table);
</del><ins>+    // On OS X, we only apply this rule in the important case of fonts with a MATH table.
+    if (OpenType::fontHasMathTable(m_platformData.ctFont())) {
+        short typoAscent, typoDescent, typoLineGap;
+        if (OpenType::tryGetTypoMetrics(m_platformData.cgFont(), typoAscent, typoDescent, typoLineGap)) {
+            ascent = scaleEmToUnits(typoAscent, unitsPerEm) * pointSize;
+            descent = -scaleEmToUnits(typoDescent, unitsPerEm) * pointSize;
+            lineGap = scaleEmToUnits(typoLineGap, unitsPerEm) * pointSize;
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsiosFontServicesIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/ios/FontServicesIOS.mm (192016 => 192017)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/ios/FontServicesIOS.mm        2015-11-04 08:10:09 UTC (rev 192016)
+++ trunk/Source/WebCore/platform/graphics/ios/FontServicesIOS.mm        2015-11-04 08:50:31 UTC (rev 192017)
</span><span class="lines">@@ -28,6 +28,7 @@
</span><span class="cx"> #import &quot;CoreGraphicsSPI.h&quot;
</span><span class="cx"> #import &quot;DynamicLinkerSPI.h&quot;
</span><span class="cx"> #import &quot;FontMetrics.h&quot;
</span><ins>+#import &quot;OpenTypeCG.h&quot;
</ins><span class="cx"> #import &lt;wtf/RetainPtr.h&gt;
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -95,6 +96,19 @@
</span><span class="cx">             descent = (scaleEmToUnits(615, 2048) * pointSize);
</span><span class="cx">         }
</span><span class="cx">     }
</span><ins>+    // The Open Font Format describes the OS/2 USE_TYPO_METRICS flag as follows:
+    // &quot;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.&quot;
+    // On iOS, we only apply this rule in the important case of fonts with a MATH table.
+    if (OpenType::fontHasMathTable(font)) {
+        short typoAscent, typoDescent, typoLineGap;
+        if (OpenType::tryGetTypoMetrics(cgFont.get(), typoAscent, typoDescent, typoLineGap)) {
+            unsigned unitsPerEm = CGFontGetUnitsPerEm(cgFont.get());
+            float pointSize = CTFontGetSize(font);
+            ascent = scaleEmToUnits(typoAscent, unitsPerEm) * pointSize;
+            descent = -scaleEmToUnits(typoDescent, unitsPerEm) * pointSize;
+            lineGap = scaleEmToUnits(typoLineGap, unitsPerEm) * pointSize;
+        }
+    }
</ins><span class="cx">     CGFloat adjustment = (shouldUseAdjustment(font, isiOS7OrLater)) ? ceil((ascent + descent) * kLineHeightAdjustment) : 0;
</span><span class="cx"> 
</span><span class="cx">     m_ascent = ascent + adjustment;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsopentypeOpenTypeCGcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/platform/graphics/opentype/OpenTypeCG.cpp (0 => 192017)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/opentype/OpenTypeCG.cpp                                (rev 0)
+++ trunk/Source/WebCore/platform/graphics/opentype/OpenTypeCG.cpp        2015-11-04 08:50:31 UTC (rev 192017)
</span><span class="lines">@@ -0,0 +1,84 @@
</span><ins>+/*
+ * Copyright (C) 2015 Frederic Wang (fred.wang@free.fr). All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * &quot;AS IS&quot; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include &quot;config.h&quot;
+#include &quot;OpenTypeCG.h&quot;
+
+#include &quot;OpenTypeTypes.h&quot;
+
+namespace WebCore {
+namespace OpenType {
+
+#if PLATFORM(WIN)
+static const unsigned long kCTFontTableOS2 = 'OS/2';
+#endif
+
+#if PLATFORM(COCOA)
+bool fontHasMathTable(CTFontRef ctFont)
+{
+    RetainPtr&lt;CFArrayRef&gt; tableTags = adoptCF(CTFontCopyAvailableTables(ctFont, kCTFontTableOptionNoOptions));
+    CFIndex numTables = CFArrayGetCount(tableTags.get());
+    for (CFIndex index = 0; index &lt; numTables; ++index) {
+        CTFontTableTag tag = (CTFontTableTag)(uintptr_t)CFArrayGetValueAtIndex(tableTags.get(), index);
+        if (tag == 'MATH')
+            return true;
+    }
+    return false;
+}
+#endif
+
+static inline short readShortFromTable(const UInt8* os2Data, CFIndex offset)
+{
+    return *(reinterpret_cast&lt;const OpenType::Int16*&gt;(os2Data + offset));
+}
+
+bool tryGetTypoMetrics(CGFontRef cgFont, short&amp; ascent, short&amp; descent, short&amp; lineGap)
+{
+    bool result = false;
+    if (CFDataRef os2Table = CGFontCopyTableForTag(cgFont, kCTFontTableOS2)) {
+        // For the structure of the OS/2 table, see
+        // https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6OS2.html
+        const CFIndex fsSelectionOffset = 16 * 2 + 10 + 4 * 4 + 4 * 1;
+        const CFIndex sTypoAscenderOffset = fsSelectionOffset + 3 * 2;
+        const CFIndex sTypoDescenderOffset = sTypoAscenderOffset + 2;
+        const CFIndex sTypoLineGapOffset = sTypoDescenderOffset + 2;
+        if (CFDataGetLength(os2Table) &gt;= sTypoLineGapOffset + 2) {
+            const UInt8* os2Data = CFDataGetBytePtr(os2Table);
+            // We test the use typo bit on the least significant byte of fsSelection.
+            const UInt8 useTypoMetricsMask = 1 &lt;&lt; 7;
+            if (*(os2Data + fsSelectionOffset + 1) &amp; useTypoMetricsMask) {
+                ascent = readShortFromTable(os2Data, sTypoAscenderOffset);
+                descent = readShortFromTable(os2Data, sTypoDescenderOffset);
+                lineGap = readShortFromTable(os2Data, sTypoLineGapOffset);
+                result = true;
+            }
+        }
+        CFRelease(os2Table);
+    }
+    return result;
+}
+
+} // namespace OpenType
+} // namespace WebCore
</ins><span class="cx">Property changes on: trunk/Source/WebCore/platform/graphics/opentype/OpenTypeCG.cpp
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="trunkSourceWebCoreplatformgraphicsopentypeOpenTypeCGh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/platform/graphics/opentype/OpenTypeCG.h (0 => 192017)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/opentype/OpenTypeCG.h                                (rev 0)
+++ trunk/Source/WebCore/platform/graphics/opentype/OpenTypeCG.h        2015-11-04 08:50:31 UTC (rev 192017)
</span><span class="lines">@@ -0,0 +1,44 @@
</span><ins>+/*
+ * Copyright (C) 2015 Frederic Wang (fred.wang@free.fr). All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * &quot;AS IS&quot; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef OpenTypeCG_h
+#define OpenTypeCG_h
+
+#include &lt;CoreGraphics/CoreGraphics.h&gt;
+#if PLATFORM(COCOA)
+#include &lt;CoreText/CoreText.h&gt;
+#endif
+
+namespace WebCore {
+namespace OpenType {
+
+#if PLATFORM(COCOA)
+bool fontHasMathTable(CTFontRef);
+#endif
+bool tryGetTypoMetrics(CGFontRef, short&amp; ascent, short&amp; descent, short&amp; lineGap);
+
+} // namespace OpenType
+} // namespace WebCore
+#endif // OpenTypeCG_h
</ins><span class="cx">Property changes on: trunk/Source/WebCore/platform/graphics/opentype/OpenTypeCG.h
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="trunkSourceWebCoreplatformgraphicsopentypeOpenTypeTypesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/opentype/OpenTypeTypes.h (192016 => 192017)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/opentype/OpenTypeTypes.h        2015-11-04 08:10:09 UTC (rev 192016)
+++ trunk/Source/WebCore/platform/graphics/opentype/OpenTypeTypes.h        2015-11-04 08:50:31 UTC (rev 192017)
</span><span class="lines">@@ -25,6 +25,10 @@
</span><span class="cx"> #ifndef OpenTypeTypes_h
</span><span class="cx"> #define OpenTypeTypes_h
</span><span class="cx"> 
</span><ins>+#if ENABLE(OPENTYPE_MATH)
+#include &quot;Glyph.h&quot;
+#endif
+
</ins><span class="cx"> #include &quot;SharedBuffer.h&quot;
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicswinSimpleFontDataCGWincpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/win/SimpleFontDataCGWin.cpp (192016 => 192017)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/win/SimpleFontDataCGWin.cpp        2015-11-04 08:10:09 UTC (rev 192016)
+++ trunk/Source/WebCore/platform/graphics/win/SimpleFontDataCGWin.cpp        2015-11-04 08:50:31 UTC (rev 192017)
</span><span class="lines">@@ -34,7 +34,7 @@
</span><span class="cx"> #include &quot;FontDescription.h&quot;
</span><span class="cx"> #include &quot;GlyphPage.h&quot;
</span><span class="cx"> #include &quot;HWndDC.h&quot;
</span><del>-#include &quot;OpenTypeTypes.h&quot;
</del><ins>+#include &quot;OpenTypeCG.h&quot;
</ins><span class="cx"> #include &lt;ApplicationServices/ApplicationServices.h&gt;
</span><span class="cx"> #include &lt;WebKitSystemInterface/WebKitSystemInterface.h&gt;
</span><span class="cx"> #include &lt;mlang.h&gt;
</span><span class="lines">@@ -67,23 +67,11 @@
</span><span class="cx"> 
</span><span class="cx">     // The Open Font Format describes the OS/2 USE_TYPO_METRICS flag as follows:
</span><span class="cx">     // &quot;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.&quot;
</span><del>-    if (CFDataRef os2Table = CGFontCopyTableForTag(m_platformData.cgFont(), 'OS/2')) {
-        // For the structure of the OS/2 table, see
-        // https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6OS2.html
-        const CFIndex fsSelectionOffset = 16 * 2 + 10 + 4 * 4 + 4 * 1;
-        const CFIndex sTypoAscenderOffset = fsSelectionOffset + 3 * 2;
-        const CFIndex sTypoDescenderOffset = sTypoAscenderOffset + 2;
-        const CFIndex sTypoLineGapOffset = sTypoDescenderOffset + 2;
-        if (CFDataGetLength(os2Table) &gt;= sTypoLineGapOffset + 2) {
-            const UInt8* os2Data = CFDataGetBytePtr(os2Table);
-            const unsigned short useTypoMetricsMask = 1 &lt;&lt; 7;
-            if (*(reinterpret_cast&lt;const OpenType::UInt16*&gt;(os2Data + fsSelectionOffset)) &amp; useTypoMetricsMask) {
-                iAscent = *(reinterpret_cast&lt;const OpenType::Int16*&gt;(os2Data + sTypoAscenderOffset));
-                iDescent = *(reinterpret_cast&lt;const OpenType::Int16*&gt;(os2Data + sTypoDescenderOffset));
-                iLineGap = *(reinterpret_cast&lt;const OpenType::Int16*&gt;(os2Data + sTypoLineGapOffset));
-            }
-        }
-        CFRelease(os2Table);
</del><ins>+    short typoAscent, typoDescent, typoLineGap;
+    if (OpenType::tryGetTypoMetrics(m_platformData.cgFont(), typoAscent, typoDescent, typoLineGap)) {
+        iAscent = typoAscent;
+        iDescent = typoDescent;
+        iLineGap = typoLineGap;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     unsigned unitsPerEm = CGFontGetUnitsPerEm(font);
</span></span></pre>
</div>
</div>

</body>
</html>