Reviewed by John.
authordarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 27 May 2005 00:03:03 +0000 (00:03 +0000)
committerdarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 27 May 2005 00:03:03 +0000 (00:03 +0000)
        - fix build failure from when I removed WebCoreUnicode

        * WebCoreSupport.subproj/WebTextRenderer.m: Removed import of WebUnicode.h that I missed.
        (-[WebTextRenderer _convertUnicodeCharacters:length:toGlyphs:]): Switch from our own macros
        to the ICU macros for surrogate pairs.
        (widthForNextCharacter): Ditto.

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

WebKit/ChangeLog
WebKit/WebCoreSupport.subproj/WebTextRenderer.m

index 4a82634e32b6ddb9600e278171d55f574380ff94..84e364d22879dbbc6164019f831c82cd44ece059 100644 (file)
@@ -1,3 +1,14 @@
+2005-05-26  Darin Adler  <darin@apple.com>
+
+        Reviewed by John.
+
+        - fix build failure from when I removed WebCoreUnicode
+
+        * WebCoreSupport.subproj/WebTextRenderer.m: Removed import of WebUnicode.h that I missed.
+        (-[WebTextRenderer _convertUnicodeCharacters:length:toGlyphs:]): Switch from our own macros
+        to the ICU macros for surrogate pairs.
+        (widthForNextCharacter): Ditto.
+
 2005-05-26  David Harrison  <harrison@apple.com>
 
         <rdar://problem/4120518> Mail: control-T in an empty message crashes mail
index a4ac161f147bfb78f600a63ebffe7ffd3471fff5..ec72b1688f4a1e73d171a700ddf261086803d720 100644 (file)
@@ -17,7 +17,6 @@
 #import <WebKit/WebKitLogging.h>
 #import <WebKit/WebNSObjectExtras.h>
 #import <WebKit/WebTextRendererFactory.h>
-#import <WebKit/WebUnicode.h>
 #import <WebKit/WebViewPrivate.h>
 
 #import <float.h>
@@ -842,10 +841,9 @@ static inline BOOL fontContainsString(NSFont *font, NSString *string)
     
     for (i = 0; i < numCharacters; i++) {
         UnicodeChar c = characters[i];
-        UniChar h = HighSurrogatePair(c);
-        UniChar l = LowSurrogatePair(c);
-        buffer[bufPos++] = h;
-        buffer[bufPos++] = l;
+        ASSERT(U16_LENGTH(c) == 2);
+        buffer[bufPos++] = U16_LEAD(c);
+        buffer[bufPos++] = U16_TRAIL(c);
     }
         
     OSStatus status = ATSUConvertCharToGlyphs(styleGroup, buffer, 0, numCharacters*2, 0, glyphs);
@@ -1998,21 +1996,21 @@ static float widthForNextCharacter(CharacterWidthIterator *iterator, ATSGlyphRef
     
     UnicodeChar c = *cp;
 
-    if (IsLowSurrogatePair(c))
+    if (U16_IS_TRAIL(c))
         return INVALID_WIDTH;
 
     // Do we have a surrogate pair?  If so, determine the full Unicode (32 bit)
     // code point before glyph lookup.
     unsigned clusterLength = 1;
-    if (IsHighSurrogatePair(c)) {
+    if (U16_IS_LEAD(c)) {
         // Make sure we have another character and it's a low surrogate.
         UniChar low;
-        if (currentCharacter + 1 >= run->length || !IsLowSurrogatePair((low = cp[1]))) {
+        if (currentCharacter + 1 >= run->length || !U16_IS_TRAIL((low = cp[1]))) {
             // Error!  The second component of the surrogate pair is missing.
             return INVALID_WIDTH;
         }
 
-        c = UnicodeValueForSurrogatePair(c, low);
+        c = U16_GET_SUPPLEMENTARY(c, low);
         clusterLength = 2;
     }
 
@@ -2102,8 +2100,8 @@ static float widthForNextCharacter(CharacterWidthIterator *iterator, ATSGlyphRef
             characterArray[0] = c;
             characterArrayLength = 1;
         } else {
-            characterArray[0] = HighSurrogatePair(c);
-            characterArray[1] = LowSurrogatePair(c);
+            characterArray[0] = U16_LEAD(c);
+            characterArray[1] = U16_TRAIL(c);
             characterArrayLength = 2;
         }