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


The following commit has been merged in the debian/unstable branch:
commit 0680f130e057203b885934bec8688b09a8747c46
Author: rjw <rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Jun 25 18:56:00 2002 +0000

           Extended our text measurement rounding work-around for integer-float
           mismatch to round on word boundaries as well as spaces.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@1431 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index ad0ccce..072697b 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,13 @@
+2002-06-25  Richard Williamson  <rjw at apple.com>
+
+       Extended our text measurement rounding work-around for integer-float 
+       mismatch to round on word boundaries as well as spaces.
+
+        * WebCoreSupport.subproj/IFTextRenderer.m:
+        (-[IFTextRenderer drawGlyphs:numGlyphs:atPoint:withColor:]):
+        (-[IFTextRenderer slowFloatWidthForCharacters:length:applyRounding:]):
+        (-[IFTextRenderer floatWidthForCharacters:length:applyRounding:]):
+
 2002-06-25  Darin Adler  <darin at apple.com>
 
         * WebCoreSupport.subproj/IFResourceURLHandleClient.m:
diff --git a/WebKit/ChangeLog-2002-12-03 b/WebKit/ChangeLog-2002-12-03
index ad0ccce..072697b 100644
--- a/WebKit/ChangeLog-2002-12-03
+++ b/WebKit/ChangeLog-2002-12-03
@@ -1,3 +1,13 @@
+2002-06-25  Richard Williamson  <rjw at apple.com>
+
+       Extended our text measurement rounding work-around for integer-float 
+       mismatch to round on word boundaries as well as spaces.
+
+        * WebCoreSupport.subproj/IFTextRenderer.m:
+        (-[IFTextRenderer drawGlyphs:numGlyphs:atPoint:withColor:]):
+        (-[IFTextRenderer slowFloatWidthForCharacters:length:applyRounding:]):
+        (-[IFTextRenderer floatWidthForCharacters:length:applyRounding:]):
+
 2002-06-25  Darin Adler  <darin at apple.com>
 
         * WebCoreSupport.subproj/IFResourceURLHandleClient.m:
diff --git a/WebKit/WebCoreSupport.subproj/IFTextRenderer.m b/WebKit/WebCoreSupport.subproj/IFTextRenderer.m
index 55a2348..96e6325 100644
--- a/WebKit/WebCoreSupport.subproj/IFTextRenderer.m
+++ b/WebKit/WebCoreSupport.subproj/IFTextRenderer.m
@@ -441,8 +441,12 @@ static unsigned int findLengthOfCharacterCluster(const UniChar *characters, unsi
 
     for (i = 0; i < numGlyphs; i++) {
         advances[i].width = widthForGlyph(self, glyphToWidthMap, glyphs[i]);
-        if (glyphs[i] == spaceGlyph)
+        if (glyphs[i] == spaceGlyph){
+            if (i > 0){
+                advances[i-1].width = ROUND_TO_INT (advances[i-1].width);
+            }
             advances[i].width = ROUND_TO_INT(advances[i].width);
+        }
         advances[i].height = 0;
         advancePoint.x += advances[i].width;
     }
@@ -647,7 +651,7 @@ cleanup:
     IFGlyphWidth glyphWidth;
     ATSLayoutRecord *glyphRecord;
     ATSGlyphRef glyphID;
-    
+    float lastWidth = 0;
     
     ATSInitializeGlyphVector(length, 0, &glyphVector);
     [self convertCharacters: characters length: length toGlyphs: &glyphVector];
@@ -657,9 +661,15 @@ cleanup:
         glyphID = glyphRecord->glyphID;
         glyphRecord = (ATSLayoutRecord *)((char *)glyphRecord + glyphVector.recordSize);
         glyphWidth = widthForGlyph(self, glyphToWidthMap, glyphID);
-        if (glyphID == spaceGlyph && applyRounding)
+        if (glyphID == spaceGlyph && applyRounding){
+            if (lastWidth > 0){
+                totalWidth -= lastWidth;
+                totalWidth += ROUND_TO_INT(lastWidth);
+            }
             glyphWidth = ROUND_TO_INT(glyphWidth);
-        totalWidth += glyphWidth;
+        }
+        lastWidth = glyphWidth;
+        totalWidth += lastWidth;
     }
     ATSClearGlyphVector(&glyphVector);
     
@@ -673,6 +683,7 @@ cleanup:
     unsigned int i, clusterLength;
     NSFont *substituteFont;
     ATSGlyphRef glyphID;
+    float lastWidth = 0;
     
     //printf("width: font %s, size %.1f, text \"%s\"\n", [[font fontName] cString], [font pointSize], [[NSString stringWithCharacters:characters length:length] UTF8String]);
     
@@ -698,16 +709,22 @@ cleanup:
             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);
-                totalWidth += [[[IFTextRendererFactory sharedFactory] rendererWithFont: substituteFont] floatWidthForCharacters: &characters[i] length: clusterLength applyRounding: YES];
+                lastWidth = [[[IFTextRendererFactory sharedFactory] rendererWithFont: substituteFont] floatWidthForCharacters: &characters[i] length: clusterLength applyRounding: YES];
             }
         }
         
         if (glyphID > 0 || ((glyphID == 0) && substituteFont == nil)) {
-            if (glyphID == spaceGlyph && applyRounding)
-                totalWidth += ROUND_TO_INT(widthForGlyph(self, glyphToWidthMap, glyphID));
+            if (glyphID == spaceGlyph && applyRounding) {
+                if (lastWidth > 0){
+                    totalWidth -= lastWidth;
+                    totalWidth += ROUND_TO_INT(lastWidth);
+                }   
+                lastWidth = ROUND_TO_INT(widthForGlyph(self, glyphToWidthMap, glyphID));
+            }
             else
-                totalWidth += widthForGlyph(self, glyphToWidthMap, glyphID);
-        }                    
+                lastWidth = widthForGlyph(self, glyphToWidthMap, glyphID);
+        }
+        totalWidth += lastWidth;                
     }
 
     return totalWidth;
diff --git a/WebKit/WebCoreSupport.subproj/WebTextRenderer.m b/WebKit/WebCoreSupport.subproj/WebTextRenderer.m
index 55a2348..96e6325 100644
--- a/WebKit/WebCoreSupport.subproj/WebTextRenderer.m
+++ b/WebKit/WebCoreSupport.subproj/WebTextRenderer.m
@@ -441,8 +441,12 @@ static unsigned int findLengthOfCharacterCluster(const UniChar *characters, unsi
 
     for (i = 0; i < numGlyphs; i++) {
         advances[i].width = widthForGlyph(self, glyphToWidthMap, glyphs[i]);
-        if (glyphs[i] == spaceGlyph)
+        if (glyphs[i] == spaceGlyph){
+            if (i > 0){
+                advances[i-1].width = ROUND_TO_INT (advances[i-1].width);
+            }
             advances[i].width = ROUND_TO_INT(advances[i].width);
+        }
         advances[i].height = 0;
         advancePoint.x += advances[i].width;
     }
@@ -647,7 +651,7 @@ cleanup:
     IFGlyphWidth glyphWidth;
     ATSLayoutRecord *glyphRecord;
     ATSGlyphRef glyphID;
-    
+    float lastWidth = 0;
     
     ATSInitializeGlyphVector(length, 0, &glyphVector);
     [self convertCharacters: characters length: length toGlyphs: &glyphVector];
@@ -657,9 +661,15 @@ cleanup:
         glyphID = glyphRecord->glyphID;
         glyphRecord = (ATSLayoutRecord *)((char *)glyphRecord + glyphVector.recordSize);
         glyphWidth = widthForGlyph(self, glyphToWidthMap, glyphID);
-        if (glyphID == spaceGlyph && applyRounding)
+        if (glyphID == spaceGlyph && applyRounding){
+            if (lastWidth > 0){
+                totalWidth -= lastWidth;
+                totalWidth += ROUND_TO_INT(lastWidth);
+            }
             glyphWidth = ROUND_TO_INT(glyphWidth);
-        totalWidth += glyphWidth;
+        }
+        lastWidth = glyphWidth;
+        totalWidth += lastWidth;
     }
     ATSClearGlyphVector(&glyphVector);
     
@@ -673,6 +683,7 @@ cleanup:
     unsigned int i, clusterLength;
     NSFont *substituteFont;
     ATSGlyphRef glyphID;
+    float lastWidth = 0;
     
     //printf("width: font %s, size %.1f, text \"%s\"\n", [[font fontName] cString], [font pointSize], [[NSString stringWithCharacters:characters length:length] UTF8String]);
     
@@ -698,16 +709,22 @@ cleanup:
             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);
-                totalWidth += [[[IFTextRendererFactory sharedFactory] rendererWithFont: substituteFont] floatWidthForCharacters: &characters[i] length: clusterLength applyRounding: YES];
+                lastWidth = [[[IFTextRendererFactory sharedFactory] rendererWithFont: substituteFont] floatWidthForCharacters: &characters[i] length: clusterLength applyRounding: YES];
             }
         }
         
         if (glyphID > 0 || ((glyphID == 0) && substituteFont == nil)) {
-            if (glyphID == spaceGlyph && applyRounding)
-                totalWidth += ROUND_TO_INT(widthForGlyph(self, glyphToWidthMap, glyphID));
+            if (glyphID == spaceGlyph && applyRounding) {
+                if (lastWidth > 0){
+                    totalWidth -= lastWidth;
+                    totalWidth += ROUND_TO_INT(lastWidth);
+                }   
+                lastWidth = ROUND_TO_INT(widthForGlyph(self, glyphToWidthMap, glyphID));
+            }
             else
-                totalWidth += widthForGlyph(self, glyphToWidthMap, glyphID);
-        }                    
+                lastWidth = widthForGlyph(self, glyphToWidthMap, glyphID);
+        }
+        totalWidth += lastWidth;                
     }
 
     return totalWidth;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list