[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 06:21:29 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit f7f3eb17b213cea21bf70e18a50e0e96de1b36e5
Author: rjw <rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Jun 26 17:53:53 2002 +0000

            Fixed recursion problems.  +[NSFont findFontLike:forString:withRange:inLanguage:]
            will alternate between suggested fonts with bogus answers.  The work
            around involves adding an explicit flag indicating whether or not
            font substitution should be attempted.
    
            * Misc.subproj/IFStringTruncator.m:
            (+[IFStringTruncator centerTruncateString:toWidth:withFont:]):
            * WebCoreSupport.subproj/IFTextRenderer.h:
            * WebCoreSupport.subproj/IFTextRenderer.m:
            (-[IFTextRenderer slowDrawCharacters:length:atPoint:withColor:attemptFontSubstitution:]):
            (-[IFTextRenderer drawCharacters:length:atPoint:withColor:]):
            (-[IFTextRenderer floatWidthForCharacters:length:applyRounding:attemptFontSubstitution:]):
            (-[IFTextRenderer widthForCharacters:length:]):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@1439 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 989ec9c..1a7138b 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,19 @@
+2002-06-26  Richard Williamson  <rjw at apple.com>
+
+        Fixed recursion problems.  +[NSFont findFontLike:forString:withRange:inLanguage:]
+        will alternate between suggested fonts with bogus answers.  The work
+        around involves adding an explicit flag indicating whether or not
+        font substitution should be attempted.
+        
+        * Misc.subproj/IFStringTruncator.m:
+        (+[IFStringTruncator centerTruncateString:toWidth:withFont:]):
+        * WebCoreSupport.subproj/IFTextRenderer.h:
+        * WebCoreSupport.subproj/IFTextRenderer.m:
+        (-[IFTextRenderer slowDrawCharacters:length:atPoint:withColor:attemptFontSubstitution:]):
+        (-[IFTextRenderer drawCharacters:length:atPoint:withColor:]):
+        (-[IFTextRenderer floatWidthForCharacters:length:applyRounding:attemptFontSubstitution:]):
+        (-[IFTextRenderer widthForCharacters:length:]):
+
 2002-06-26  Darin Adler  <darin at apple.com>
 
         * WebView.subproj/IFHTMLView.mm:
diff --git a/WebKit/ChangeLog-2002-12-03 b/WebKit/ChangeLog-2002-12-03
index 989ec9c..1a7138b 100644
--- a/WebKit/ChangeLog-2002-12-03
+++ b/WebKit/ChangeLog-2002-12-03
@@ -1,3 +1,19 @@
+2002-06-26  Richard Williamson  <rjw at apple.com>
+
+        Fixed recursion problems.  +[NSFont findFontLike:forString:withRange:inLanguage:]
+        will alternate between suggested fonts with bogus answers.  The work
+        around involves adding an explicit flag indicating whether or not
+        font substitution should be attempted.
+        
+        * Misc.subproj/IFStringTruncator.m:
+        (+[IFStringTruncator centerTruncateString:toWidth:withFont:]):
+        * WebCoreSupport.subproj/IFTextRenderer.h:
+        * WebCoreSupport.subproj/IFTextRenderer.m:
+        (-[IFTextRenderer slowDrawCharacters:length:atPoint:withColor:attemptFontSubstitution:]):
+        (-[IFTextRenderer drawCharacters:length:atPoint:withColor:]):
+        (-[IFTextRenderer floatWidthForCharacters:length:applyRounding:attemptFontSubstitution:]):
+        (-[IFTextRenderer widthForCharacters:length:]):
+
 2002-06-26  Darin Adler  <darin at apple.com>
 
         * WebView.subproj/IFHTMLView.mm:
diff --git a/WebKit/Misc.subproj/IFStringTruncator.m b/WebKit/Misc.subproj/IFStringTruncator.m
index c776e21..a083e88 100644
--- a/WebKit/Misc.subproj/IFStringTruncator.m
+++ b/WebKit/Misc.subproj/IFStringTruncator.m
@@ -77,7 +77,7 @@ static float currentEllipsisWidth;
         [IFTextRendererFactory createSharedFactory];
         currentRenderer = [[[IFTextRendererFactory sharedFactory] rendererWithFont:font] retain];
         ellipsis = ELLIPSIS_CHARACTER;
-        currentEllipsisWidth = [currentRenderer floatWidthForCharacters:&ellipsis length:1 applyRounding: NO];
+        currentEllipsisWidth = [currentRenderer floatWidthForCharacters:&ellipsis length:1 applyRounding: NO attemptFontSubstitution: YES];
     }
     
     WEBKIT_ASSERT(currentRenderer);
@@ -96,7 +96,7 @@ static float currentEllipsisWidth;
     }
 
     width = [currentRenderer floatWidthForCharacters:stringBuffer
-                                              length:truncatedLength applyRounding: NO];
+                                              length:truncatedLength applyRounding: NO attemptFontSubstitution: YES];
     if (width <= maxWidth) {
         return string;
     }
@@ -136,7 +136,7 @@ static float currentEllipsisWidth;
                                            keepCount:keepCount
                                             toBuffer:stringBuffer];
         
-        width = [currentRenderer floatWidthForCharacters:stringBuffer length:truncatedLength applyRounding: NO];
+        width = [currentRenderer floatWidthForCharacters:stringBuffer length:truncatedLength applyRounding: NO attemptFontSubstitution: YES];
         if (width <= maxWidth) {
             keepCountForLargestKnownToFit = keepCount;
             widthForLargestKnownToFit = width;
diff --git a/WebKit/Misc.subproj/WebStringTruncator.m b/WebKit/Misc.subproj/WebStringTruncator.m
index c776e21..a083e88 100644
--- a/WebKit/Misc.subproj/WebStringTruncator.m
+++ b/WebKit/Misc.subproj/WebStringTruncator.m
@@ -77,7 +77,7 @@ static float currentEllipsisWidth;
         [IFTextRendererFactory createSharedFactory];
         currentRenderer = [[[IFTextRendererFactory sharedFactory] rendererWithFont:font] retain];
         ellipsis = ELLIPSIS_CHARACTER;
-        currentEllipsisWidth = [currentRenderer floatWidthForCharacters:&ellipsis length:1 applyRounding: NO];
+        currentEllipsisWidth = [currentRenderer floatWidthForCharacters:&ellipsis length:1 applyRounding: NO attemptFontSubstitution: YES];
     }
     
     WEBKIT_ASSERT(currentRenderer);
@@ -96,7 +96,7 @@ static float currentEllipsisWidth;
     }
 
     width = [currentRenderer floatWidthForCharacters:stringBuffer
-                                              length:truncatedLength applyRounding: NO];
+                                              length:truncatedLength applyRounding: NO attemptFontSubstitution: YES];
     if (width <= maxWidth) {
         return string;
     }
@@ -136,7 +136,7 @@ static float currentEllipsisWidth;
                                            keepCount:keepCount
                                             toBuffer:stringBuffer];
         
-        width = [currentRenderer floatWidthForCharacters:stringBuffer length:truncatedLength applyRounding: NO];
+        width = [currentRenderer floatWidthForCharacters:stringBuffer length:truncatedLength applyRounding: NO attemptFontSubstitution: YES];
         if (width <= maxWidth) {
             keepCountForLargestKnownToFit = keepCount;
             widthForLargestKnownToFit = width;
diff --git a/WebKit/WebCoreSupport.subproj/IFTextRenderer.h b/WebKit/WebCoreSupport.subproj/IFTextRenderer.h
index 27c3ce6..deeac07 100644
--- a/WebKit/WebCoreSupport.subproj/IFTextRenderer.h
+++ b/WebKit/WebCoreSupport.subproj/IFTextRenderer.h
@@ -29,6 +29,6 @@ typedef struct GlyphMap GlyphMap;
 - initWithFont:(NSFont *)font;
 
 // Set applyRounding = NO to get an Cocoa equivalent width.
-- (float)floatWidthForCharacters:(const unichar *)characters length:(unsigned)length applyRounding: (BOOL)applyRounding;
+- (float)floatWidthForCharacters:(const unichar *)characters length:(unsigned)length applyRounding: (BOOL)applyRounding attemptFontSubstitution: (BOOL)attemptFontSubstitution;
 
 @end
diff --git a/WebKit/WebCoreSupport.subproj/IFTextRenderer.m b/WebKit/WebCoreSupport.subproj/IFTextRenderer.m
index 96e6325..dac273a 100644
--- a/WebKit/WebCoreSupport.subproj/IFTextRenderer.m
+++ b/WebKit/WebCoreSupport.subproj/IFTextRenderer.m
@@ -470,7 +470,7 @@ static unsigned int findLengthOfCharacterCluster(const UniChar *characters, unsi
 
 // Useful page for testing http://home.att.net/~jameskass
 
-- (NSPoint)slowDrawCharacters:(const UniChar *)characters length: (unsigned int)length atPoint:(NSPoint)point withColor:(NSColor *)color
+- (NSPoint)slowDrawCharacters:(const UniChar *)characters length: (unsigned int)length atPoint:(NSPoint)point withColor:(NSColor *)color attemptFontSubstitution: (BOOL)attemptFontSubstitution
 {
     unsigned int charPos = 0, lastDrawnGlyph = 0;
     unsigned int clusterLength, i, numGlyphs, fragmentLength;
@@ -486,7 +486,7 @@ static unsigned int findLengthOfCharacterCluster(const UniChar *characters, unsi
 
         clusterLength = findLengthOfCharacterCluster (&characters[charPos], length - charPos);
         
-        if (glyphID == 0){
+        if (glyphID == 0 && attemptFontSubstitution){
             // Draw everthing up to this point.
             fragmentLength = i - lastDrawnGlyph;
             if (fragmentLength > 0)
@@ -495,7 +495,7 @@ static unsigned int findLengthOfCharacterCluster(const UniChar *characters, unsi
             // Draw the character in the alternate font.
             substituteFont = [self substituteFontForCharacters: &characters[charPos] length: clusterLength];
             if (substituteFont)
-                point = [[[IFTextRendererFactory sharedFactory] rendererWithFont: substituteFont] slowDrawCharacters: &characters[charPos] length: clusterLength atPoint: point withColor: color];
+                point = [[[IFTextRendererFactory sharedFactory] rendererWithFont: substituteFont] slowDrawCharacters: &characters[charPos] length: clusterLength atPoint: point withColor: color attemptFontSubstitution: NO];
             else
                 point = [self drawGlyphs: &glyphs[i] numGlyphs: 1 atPoint: point withColor: color];
                 
@@ -602,10 +602,10 @@ cleanup:
             reason = [[[IFTextRendererFactory sharedFactory] rendererWithFont: substituteFont] _drawCharacters: characters length: length atPoint: point withColor: color];
          
          if (!substituteFont || reason != _IFDrawSucceeded)
-            [self slowDrawCharacters: characters length: length atPoint: point withColor: color];
+            [self slowDrawCharacters: characters length: length atPoint: point withColor: color attemptFontSubstitution: YES];
     }
     else if (reason == _IFNonBaseCharacter) {
-        [self slowDrawCharacters: characters length: length atPoint: point withColor: color];
+        [self slowDrawCharacters: characters length: length atPoint: point withColor: color attemptFontSubstitution: YES];
     }
 }
 
@@ -677,7 +677,7 @@ cleanup:
 }
 
 
-- (float)floatWidthForCharacters:(const UniChar *)characters length:(unsigned)length applyRounding: (BOOL)applyRounding
+- (float)floatWidthForCharacters:(const UniChar *)characters length:(unsigned)length applyRounding: (BOOL)applyRounding attemptFontSubstitution: (BOOL)attemptSubstitution
 {
     float totalWidth = 0;
     unsigned int i, clusterLength;
@@ -703,13 +703,13 @@ cleanup:
         }
         
         // Try to find a substitute font if this font didn't have a glyph for a character in the
-        // string.  If one isn't found we end up drawing and measuring a box.
-        if (glyphID == 0) {
+        // string.  If one isn't found we end up drawing and measuring the 0 glyph, usually a box.
+        if (glyphID == 0 && attemptSubstitution) {
             clusterLength = findLengthOfCharacterCluster (&characters[i], length - i);
             substituteFont = [self substituteFontForCharacters: &characters[i] length: clusterLength];
             if (substituteFont) {
                 //WEBKITDEBUGLEVEL (WEBKIT_LOG_FONTCACHE, "substituting %s for %s, missing 0x%04x\n", DEBUG_OBJECT(substituteFont), DEBUG_OBJECT([font displayName]), c);
-                lastWidth = [[[IFTextRendererFactory sharedFactory] rendererWithFont: substituteFont] floatWidthForCharacters: &characters[i] length: clusterLength applyRounding: YES];
+                lastWidth = [[[IFTextRendererFactory sharedFactory] rendererWithFont: substituteFont] floatWidthForCharacters: &characters[i] length: clusterLength applyRounding: YES attemptFontSubstitution: NO];
             }
         }
         
@@ -733,7 +733,7 @@ cleanup:
 
 - (int)widthForCharacters:(const UniChar *)characters length:(unsigned)length
 {
-    return ROUND_TO_INT([self floatWidthForCharacters:characters length:length applyRounding:YES]);
+    return ROUND_TO_INT([self floatWidthForCharacters:characters length:length applyRounding:YES attemptFontSubstitution: YES]);
 }
 
 
diff --git a/WebKit/WebCoreSupport.subproj/WebTextRenderer.h b/WebKit/WebCoreSupport.subproj/WebTextRenderer.h
index 27c3ce6..deeac07 100644
--- a/WebKit/WebCoreSupport.subproj/WebTextRenderer.h
+++ b/WebKit/WebCoreSupport.subproj/WebTextRenderer.h
@@ -29,6 +29,6 @@ typedef struct GlyphMap GlyphMap;
 - initWithFont:(NSFont *)font;
 
 // Set applyRounding = NO to get an Cocoa equivalent width.
-- (float)floatWidthForCharacters:(const unichar *)characters length:(unsigned)length applyRounding: (BOOL)applyRounding;
+- (float)floatWidthForCharacters:(const unichar *)characters length:(unsigned)length applyRounding: (BOOL)applyRounding attemptFontSubstitution: (BOOL)attemptFontSubstitution;
 
 @end
diff --git a/WebKit/WebCoreSupport.subproj/WebTextRenderer.m b/WebKit/WebCoreSupport.subproj/WebTextRenderer.m
index 96e6325..dac273a 100644
--- a/WebKit/WebCoreSupport.subproj/WebTextRenderer.m
+++ b/WebKit/WebCoreSupport.subproj/WebTextRenderer.m
@@ -470,7 +470,7 @@ static unsigned int findLengthOfCharacterCluster(const UniChar *characters, unsi
 
 // Useful page for testing http://home.att.net/~jameskass
 
-- (NSPoint)slowDrawCharacters:(const UniChar *)characters length: (unsigned int)length atPoint:(NSPoint)point withColor:(NSColor *)color
+- (NSPoint)slowDrawCharacters:(const UniChar *)characters length: (unsigned int)length atPoint:(NSPoint)point withColor:(NSColor *)color attemptFontSubstitution: (BOOL)attemptFontSubstitution
 {
     unsigned int charPos = 0, lastDrawnGlyph = 0;
     unsigned int clusterLength, i, numGlyphs, fragmentLength;
@@ -486,7 +486,7 @@ static unsigned int findLengthOfCharacterCluster(const UniChar *characters, unsi
 
         clusterLength = findLengthOfCharacterCluster (&characters[charPos], length - charPos);
         
-        if (glyphID == 0){
+        if (glyphID == 0 && attemptFontSubstitution){
             // Draw everthing up to this point.
             fragmentLength = i - lastDrawnGlyph;
             if (fragmentLength > 0)
@@ -495,7 +495,7 @@ static unsigned int findLengthOfCharacterCluster(const UniChar *characters, unsi
             // Draw the character in the alternate font.
             substituteFont = [self substituteFontForCharacters: &characters[charPos] length: clusterLength];
             if (substituteFont)
-                point = [[[IFTextRendererFactory sharedFactory] rendererWithFont: substituteFont] slowDrawCharacters: &characters[charPos] length: clusterLength atPoint: point withColor: color];
+                point = [[[IFTextRendererFactory sharedFactory] rendererWithFont: substituteFont] slowDrawCharacters: &characters[charPos] length: clusterLength atPoint: point withColor: color attemptFontSubstitution: NO];
             else
                 point = [self drawGlyphs: &glyphs[i] numGlyphs: 1 atPoint: point withColor: color];
                 
@@ -602,10 +602,10 @@ cleanup:
             reason = [[[IFTextRendererFactory sharedFactory] rendererWithFont: substituteFont] _drawCharacters: characters length: length atPoint: point withColor: color];
          
          if (!substituteFont || reason != _IFDrawSucceeded)
-            [self slowDrawCharacters: characters length: length atPoint: point withColor: color];
+            [self slowDrawCharacters: characters length: length atPoint: point withColor: color attemptFontSubstitution: YES];
     }
     else if (reason == _IFNonBaseCharacter) {
-        [self slowDrawCharacters: characters length: length atPoint: point withColor: color];
+        [self slowDrawCharacters: characters length: length atPoint: point withColor: color attemptFontSubstitution: YES];
     }
 }
 
@@ -677,7 +677,7 @@ cleanup:
 }
 
 
-- (float)floatWidthForCharacters:(const UniChar *)characters length:(unsigned)length applyRounding: (BOOL)applyRounding
+- (float)floatWidthForCharacters:(const UniChar *)characters length:(unsigned)length applyRounding: (BOOL)applyRounding attemptFontSubstitution: (BOOL)attemptSubstitution
 {
     float totalWidth = 0;
     unsigned int i, clusterLength;
@@ -703,13 +703,13 @@ cleanup:
         }
         
         // Try to find a substitute font if this font didn't have a glyph for a character in the
-        // string.  If one isn't found we end up drawing and measuring a box.
-        if (glyphID == 0) {
+        // string.  If one isn't found we end up drawing and measuring the 0 glyph, usually a box.
+        if (glyphID == 0 && attemptSubstitution) {
             clusterLength = findLengthOfCharacterCluster (&characters[i], length - i);
             substituteFont = [self substituteFontForCharacters: &characters[i] length: clusterLength];
             if (substituteFont) {
                 //WEBKITDEBUGLEVEL (WEBKIT_LOG_FONTCACHE, "substituting %s for %s, missing 0x%04x\n", DEBUG_OBJECT(substituteFont), DEBUG_OBJECT([font displayName]), c);
-                lastWidth = [[[IFTextRendererFactory sharedFactory] rendererWithFont: substituteFont] floatWidthForCharacters: &characters[i] length: clusterLength applyRounding: YES];
+                lastWidth = [[[IFTextRendererFactory sharedFactory] rendererWithFont: substituteFont] floatWidthForCharacters: &characters[i] length: clusterLength applyRounding: YES attemptFontSubstitution: NO];
             }
         }
         
@@ -733,7 +733,7 @@ cleanup:
 
 - (int)widthForCharacters:(const UniChar *)characters length:(unsigned)length
 {
-    return ROUND_TO_INT([self floatWidthForCharacters:characters length:length applyRounding:YES]);
+    return ROUND_TO_INT([self floatWidthForCharacters:characters length:length applyRounding:YES attemptFontSubstitution: YES]);
 }
 
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list