[iOS] SVG fonts are garbled
authormmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 6 Mar 2015 15:37:07 +0000 (15:37 +0000)
committermmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 6 Mar 2015 15:37:07 +0000 (15:37 +0000)
https://bugs.webkit.org/show_bug.cgi?id=142377

Patch by Myles C. Maxfield <mmaxfield@apple.com> on 2015-03-06
Reviewed by Simon Fraser.

Source/JavaScriptCore:

* Configurations/FeatureDefines.xcconfig:

Source/WebCore:

The C++ spec says that casting a negative floating point number to
an unsigned integer is undefined. Instead, use clamping.

Covered by existing SVG font tests.

* Configurations/FeatureDefines.xcconfig:
* svg/SVGToOTFFontConversion.cpp:
(WebCore::writeCFFEncodedNumber):

Source/WebKit/mac:

* Configurations/FeatureDefines.xcconfig:

Source/WebKit2:

* Configurations/FeatureDefines.xcconfig:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@181155 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/Configurations/FeatureDefines.xcconfig
Source/WebCore/ChangeLog
Source/WebCore/Configurations/FeatureDefines.xcconfig
Source/WebCore/svg/SVGToOTFFontConversion.cpp
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/Configurations/FeatureDefines.xcconfig
Source/WebKit2/ChangeLog
Source/WebKit2/Configurations/FeatureDefines.xcconfig

index 56d0e3874291988770c4628dd86029e0cda43fc7..f30107c769fe752978e6f9c034c432fa53a8dea1 100644 (file)
@@ -1,3 +1,12 @@
+2015-03-06  Myles C. Maxfield  <mmaxfield@apple.com>
+
+        [iOS] SVG fonts are garbled
+        https://bugs.webkit.org/show_bug.cgi?id=142377
+
+        Reviewed by Simon Fraser.
+
+        * Configurations/FeatureDefines.xcconfig:
+
 2015-03-05  Joseph Pecoraro  <pecoraro@apple.com>
 
         ES6: Object Literal Extensions - Shorthand Properties (Identifiers)
index 8fc2487f6aee0f739cfd3c0a84abc791594a5ee3..ad0b8e8c4c6ff80e132c29aa8064000c3d6dd7a9 100644 (file)
@@ -155,8 +155,7 @@ ENABLE_SPEECH_SYNTHESIS = ENABLE_SPEECH_SYNTHESIS;
 ENABLE_STREAMS_API = ENABLE_STREAMS_API;
 ENABLE_SUBTLE_CRYPTO = ENABLE_SUBTLE_CRYPTO;
 ENABLE_SVG_FONTS = ENABLE_SVG_FONTS;
-ENABLE_SVG_OTF_CONVERTER[sdk=iphone*] = ;
-ENABLE_SVG_OTF_CONVERTER[sdk=macosx*] = ENABLE_SVG_OTF_CONVERTER;
+ENABLE_SVG_OTF_CONVERTER = ENABLE_SVG_OTF_CONVERTER;
 
 ENABLE_TELEPHONE_NUMBER_DETECTION[sdk=iphone*] = ENABLE_TELEPHONE_NUMBER_DETECTION;
 ENABLE_TELEPHONE_NUMBER_DETECTION[sdk=macosx*] = $(ENABLE_TELEPHONE_NUMBER_DETECTION_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR));
index 676ca764937b69c1620fd96b8d375abcd1d73137..dcd47b3d623a5e0553b7446ce50968ffb4ff3573 100644 (file)
@@ -1,3 +1,19 @@
+2015-03-06  Myles C. Maxfield  <mmaxfield@apple.com>
+
+        [iOS] SVG fonts are garbled
+        https://bugs.webkit.org/show_bug.cgi?id=142377
+
+        Reviewed by Simon Fraser.
+
+        The C++ spec says that casting a negative floating point number to
+        an unsigned integer is undefined. Instead, use clamping.
+
+        Covered by existing SVG font tests.
+
+        * Configurations/FeatureDefines.xcconfig:
+        * svg/SVGToOTFFontConversion.cpp:
+        (WebCore::writeCFFEncodedNumber):
+
 2015-03-06  Commit Queue  <commit-queue@webkit.org>
 
         Unreviewed, rolling out r181139.
index 8fc2487f6aee0f739cfd3c0a84abc791594a5ee3..ad0b8e8c4c6ff80e132c29aa8064000c3d6dd7a9 100644 (file)
@@ -155,8 +155,7 @@ ENABLE_SPEECH_SYNTHESIS = ENABLE_SPEECH_SYNTHESIS;
 ENABLE_STREAMS_API = ENABLE_STREAMS_API;
 ENABLE_SUBTLE_CRYPTO = ENABLE_SUBTLE_CRYPTO;
 ENABLE_SVG_FONTS = ENABLE_SVG_FONTS;
-ENABLE_SVG_OTF_CONVERTER[sdk=iphone*] = ;
-ENABLE_SVG_OTF_CONVERTER[sdk=macosx*] = ENABLE_SVG_OTF_CONVERTER;
+ENABLE_SVG_OTF_CONVERTER = ENABLE_SVG_OTF_CONVERTER;
 
 ENABLE_TELEPHONE_NUMBER_DETECTION[sdk=iphone*] = ENABLE_TELEPHONE_NUMBER_DETECTION;
 ENABLE_TELEPHONE_NUMBER_DETECTION[sdk=macosx*] = $(ENABLE_TELEPHONE_NUMBER_DETECTION_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR));
index b570f745330ebbdde8d44542ffe3c4b735e9d754..8a4d693f140deafae2614a991133a3a1cce7a669 100644 (file)
@@ -1036,7 +1036,8 @@ template <typename V>
 static void writeCFFEncodedNumber(V& vector, float number)
 {
     vector.append(0xFF);
-    append32(vector, number * 0x10000);
+    // Convert to 16.16 fixed-point
+    append32(vector, clampTo<int32_t>(number * 0x10000));
 }
 
 static const char rLineTo = 0x05;
index e94bf0af9cdfaa1102f9ebc6d1b798eb15f6cf1d..2d8f739d333abc23a53dd79b5257a15414bec908 100644 (file)
@@ -1,3 +1,12 @@
+2015-03-06  Myles C. Maxfield  <mmaxfield@apple.com>
+
+        [iOS] SVG fonts are garbled
+        https://bugs.webkit.org/show_bug.cgi?id=142377
+
+        Reviewed by Simon Fraser.
+
+        * Configurations/FeatureDefines.xcconfig:
+
 2015-03-04  Yusuke Suzuki  <utatane.tea@gmail.com>
 
         Hide Promise with runtime flags under Cocoa JSContext API
index 8fc2487f6aee0f739cfd3c0a84abc791594a5ee3..ad0b8e8c4c6ff80e132c29aa8064000c3d6dd7a9 100644 (file)
@@ -155,8 +155,7 @@ ENABLE_SPEECH_SYNTHESIS = ENABLE_SPEECH_SYNTHESIS;
 ENABLE_STREAMS_API = ENABLE_STREAMS_API;
 ENABLE_SUBTLE_CRYPTO = ENABLE_SUBTLE_CRYPTO;
 ENABLE_SVG_FONTS = ENABLE_SVG_FONTS;
-ENABLE_SVG_OTF_CONVERTER[sdk=iphone*] = ;
-ENABLE_SVG_OTF_CONVERTER[sdk=macosx*] = ENABLE_SVG_OTF_CONVERTER;
+ENABLE_SVG_OTF_CONVERTER = ENABLE_SVG_OTF_CONVERTER;
 
 ENABLE_TELEPHONE_NUMBER_DETECTION[sdk=iphone*] = ENABLE_TELEPHONE_NUMBER_DETECTION;
 ENABLE_TELEPHONE_NUMBER_DETECTION[sdk=macosx*] = $(ENABLE_TELEPHONE_NUMBER_DETECTION_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR));
index 745d4a62b21d1f4c261be61489a6eb3e23bb8884..fbd40d2a0262cd8e7c4feedb0194c88f5c94f235 100644 (file)
@@ -1,3 +1,12 @@
+2015-03-06  Myles C. Maxfield  <mmaxfield@apple.com>
+
+        [iOS] SVG fonts are garbled
+        https://bugs.webkit.org/show_bug.cgi?id=142377
+
+        Reviewed by Simon Fraser.
+
+        * Configurations/FeatureDefines.xcconfig:
+
 2015-03-06  Zan Dobersek  <zdobersek@igalia.com>
 
         Unguarded GTK-specific member and method usage in DrawingAreaImpl
index 8fc2487f6aee0f739cfd3c0a84abc791594a5ee3..ad0b8e8c4c6ff80e132c29aa8064000c3d6dd7a9 100644 (file)
@@ -155,8 +155,7 @@ ENABLE_SPEECH_SYNTHESIS = ENABLE_SPEECH_SYNTHESIS;
 ENABLE_STREAMS_API = ENABLE_STREAMS_API;
 ENABLE_SUBTLE_CRYPTO = ENABLE_SUBTLE_CRYPTO;
 ENABLE_SVG_FONTS = ENABLE_SVG_FONTS;
-ENABLE_SVG_OTF_CONVERTER[sdk=iphone*] = ;
-ENABLE_SVG_OTF_CONVERTER[sdk=macosx*] = ENABLE_SVG_OTF_CONVERTER;
+ENABLE_SVG_OTF_CONVERTER = ENABLE_SVG_OTF_CONVERTER;
 
 ENABLE_TELEPHONE_NUMBER_DETECTION[sdk=iphone*] = ENABLE_TELEPHONE_NUMBER_DETECTION;
 ENABLE_TELEPHONE_NUMBER_DETECTION[sdk=macosx*] = $(ENABLE_TELEPHONE_NUMBER_DETECTION_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR));