[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

rjw rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 07:41:19 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 9e10c0c5f86dba0a10f293eebf80ce42d194db17
Author: rjw <rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri May 9 05:41:20 2003 +0000

    	Fixed 3146161.  Use the AppKit to render complex
            text in the simple string drawing method.
    
            Reviewed by John.
    
            * Misc.subproj/WebKitNSStringExtras.m:
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@4328 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 444b6bb..0047ad2 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,5 +1,14 @@
 2003-05-08  Richard Williamson  <rjw at apple.com>
 
+	Fixed 3146161.  Use the AppKit to render complex
+        text in the simple string drawing method.
+
+        Reviewed by John.
+
+        * Misc.subproj/WebKitNSStringExtras.m:
+
+2003-05-08  Richard Williamson  <rjw at apple.com>
+
         Make representations without intrinsic titles return nil.
         
         Reviewed by John.
diff --git a/WebKit/Misc.subproj/WebKitNSStringExtras.m b/WebKit/Misc.subproj/WebKitNSStringExtras.m
index 95c3318..3ce1a05 100644
--- a/WebKit/Misc.subproj/WebKitNSStringExtras.m
+++ b/WebKit/Misc.subproj/WebKitNSStringExtras.m
@@ -8,28 +8,50 @@
 #import <WebKit/WebTextRenderer.h>
 #import <WebKit/WebTextRendererFactory.h>
 
+#import <WebCore/WebCoreUnicode.h>
+
 @implementation NSString (WebKitExtras)
 
 - (void)_web_drawAtPoint:(NSPoint)point font:(NSFont *)font textColor:(NSColor *)textColor;
 {
-    WebTextRenderer *renderer = [[WebTextRendererFactory sharedFactory] rendererWithFont:font usingPrinterFont:NO];
-    unsigned length = [self length];
+    unsigned i, length = [self length];
     UniChar *buffer = (UniChar *)malloc(sizeof(UniChar) * length);
+    BOOL fastRender = YES;
 
     [self getCharacters:buffer];
-    [renderer drawCharacters:buffer
-                stringLength:length
-       fromCharacterPosition:0
-         toCharacterPosition:length
-                     atPoint:point
-                 withPadding:0
-               withTextColor:textColor
-             backgroundColor:nil
-                 rightToLeft:NO
-               letterSpacing:0
-                 wordSpacing:0
-                   smallCaps:false
-                 fontFamilies:0];
+    
+    // Check if this string only contains normal, and left-to-right characters.
+    // If not hand the string over to the appkit for slower but correct rendering.
+    for (i = 0; i < length; i++){
+        WebCoreUnicodeDirection direction = WebCoreUnicodeDirectionFunction (buffer[i]);
+        if (direction == DirectionR || direction > DirectionON){
+            fastRender = NO;
+            break;
+        }
+    }
+
+    if (fastRender){
+        WebTextRenderer *renderer = [[WebTextRendererFactory sharedFactory] rendererWithFont:font usingPrinterFont:NO];
+        [renderer drawCharacters:buffer
+                    stringLength:length
+        fromCharacterPosition:0
+            toCharacterPosition:length
+                        atPoint:point
+                    withPadding:0
+                withTextColor:textColor
+                backgroundColor:nil
+                    rightToLeft:NO
+                letterSpacing:0
+                    wordSpacing:0
+                    smallCaps:false
+                    fontFamilies:0];
+    }
+    else {
+        // WebTextRenderer assumes drawing from baseline.
+        point.y -= [font ascender];
+        [self drawAtPoint:point withAttributes:[NSDictionary dictionaryWithObjectsAndKeys:font, NSFontAttributeName, textColor, NSForegroundColorAttributeName, nil]];
+    }
+
     free(buffer);
 }
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list