[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:58:55 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 4a65dc60e73d2ff7087d1f0d9d958ca00fe1f2d8
Author: rjw <rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Oct 1 00:47:11 2003 +0000

    	Attempt to find a reasonable font using a simple string matching heuristic if
    	none of the fonts actually specified are found.  In particular we will use
    	Geeza Pro if "arabic", "urdu", or "pashto" is contained (case-insensitive) in
    	any of the requested font family names.  Geeza Pro is a much better fallback
    	font for Arabic (and variant languages) than Helvetica.
    
            Reviewed by Chris.
    
            * WebCoreSupport.subproj/WebTextRendererFactory.m:
            (-[WebTextRendererFactory fontWithFamilies:traits:size:]):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@5098 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 0eaace8..55dfd95 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,16 @@
+2003-09-30  Richard Williamson   <rjw at apple.com>
+
+	Attempt to find a reasonable font using a simple string matching heuristic if 
+	none of the fonts actually specified are found.  In particular we will use
+	Geeza Pro if "arabic", "urdu", or "pashto" is contained (case-insensitive) in
+	any of the requested font family names.  Geeza Pro is a much better fallback
+	font for Arabic (and variant languages) than Helvetica.
+
+        Reviewed by Chris.
+
+        * WebCoreSupport.subproj/WebTextRendererFactory.m:
+        (-[WebTextRendererFactory fontWithFamilies:traits:size:]):
+
 2003-09-30  John Sullivan  <sullivan at apple.com>
 
         - fixed 3045617 -- Make Text Bigger/Smaller doesn't affect non-html documents.
diff --git a/WebKit/WebCoreSupport.subproj/WebTextRendererFactory.m b/WebKit/WebCoreSupport.subproj/WebTextRendererFactory.m
index ce43351..d65caac 100644
--- a/WebKit/WebCoreSupport.subproj/WebTextRendererFactory.m
+++ b/WebKit/WebCoreSupport.subproj/WebTextRendererFactory.m
@@ -294,6 +294,8 @@ fontsChanged( ATSFontNotificationInfoRef info, void *_factory)
     return font;
 }
 
+        
+
 - (NSFont *)fontWithFamilies:(NSString **)families traits:(NSFontTraitMask)traits size:(float)size
 {
     NSFont *font = nil;
@@ -305,8 +307,35 @@ fontsChanged( ATSFontNotificationInfoRef info, void *_factory)
         if ([family length] != 0)
             font = [self cachedFontFromFamily: family traits:traits size:size];
     }
-    if (font == nil)
-        font = [self fallbackFontWithTraits:traits size:size];
+    if (font == nil) {
+        // We didn't find a font.  Use a fallback font.
+        static int matchCount = 3;
+        static NSString *matchWords[] = { @"Arabic", @"Pashto", @"Urdu" };
+        static NSString *matchFamilies[] = { @"Geeza Pro", @"Geeza Pro", @"Geeza Pro" };
+        
+        // First we'll attempt to find an appropriate font using a match based on 
+        // the presence of keywords in the the requested names.  For example, we'll
+        // match any name that contains "Arabic" to Geeza Pro.
+        int j;
+        i = 0;
+        while (families && families[i] != 0 && font == nil) {
+            family = families[i++];
+            if ([family length] != 0) {
+                j = 0;
+                while (j < matchCount && font == nil) {
+                    if ([family rangeOfString:matchWords[j] options:NSCaseInsensitiveSearch].location != NSNotFound) {
+                        font = [self cachedFontFromFamily:matchFamilies[j] traits:traits size:size];
+                    }
+                    j++;
+                }
+            }
+        }
+        
+        // Still nothing found, use the final fallback.
+        if (font == nil) {
+            font = [self fallbackFontWithTraits:traits size:size];
+        }
+    }
 
     return font;
 }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list