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


The following commit has been merged in the debian/unstable branch:
commit a310c37bba46e19a480684661e3e8657e77cdca1
Author: rjw <rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Nov 22 02:58:50 2002 +0000

            A different fix to 3078065 that doesn't depend on the appkit's idea of
            fixed pitch font.
    
            The fix is to adjust the width of all characters that have the same width
            as the space character to match the adjustment of the space character.
            This has the slight downside that non-monospace fonts that contain glyphs
            with the same width as the space character will have an extra adjustment.
            In practice this is not noticeable as the adjustment is always sub-pixel.
            Nor of course does this cause any mislayout, as it's done at the lowest
            level for both measurement and drawing.
    
            Until we move kthml internals to floats this will be just fine.
    
            * WebCoreSupport.subproj/WebTextRenderer.h:
            * WebCoreSupport.subproj/WebTextRenderer.m:
            (widthForGlyph):
            (-[WebTextRenderer initWithFont:]):
            (-[WebTextRenderer _floatWidthForCharacters:stringLength:fromCharacterPosition:numberOfCharacters:withPadding:applyRounding:attemptFontSubstitution:widths:fonts:glyphs:numGlyphs:letterSpacing:wordSpacing:]):
    tAfterNavigationPolicy:request:]):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@2819 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 50556ee..8b20958 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,25 @@
+2002-11-21  Richard Williamson   <rjw at apple.com>
+
+        A different fix to 3078065 that doesn't depend on the appkit's idea of
+        fixed pitch font.
+        
+        The fix is to adjust the width of all characters that have the same width
+        as the space character to match the adjustment of the space character.
+        This has the slight downside that non-monospace fonts that contain glyphs
+        with the same width as the space character will have an extra adjustment.
+        In practice this is not noticeable as the adjustment is always sub-pixel.
+        Nor of course does this cause any mislayout, as it's done at the lowest
+        level for both measurement and drawing.
+        
+        Until we move kthml internals to floats this will be just fine.
+        
+        * WebCoreSupport.subproj/WebTextRenderer.h:
+        * WebCoreSupport.subproj/WebTextRenderer.m:
+        (widthForGlyph):
+        (-[WebTextRenderer initWithFont:]):
+        (-[WebTextRenderer _floatWidthForCharacters:stringLength:fromCharacterPosition:numberOfCharacters:withPadding:applyRounding:attemptFontSubstitution:widths:fonts:glyphs:numGlyphs:letterSpacing:wordSpacing:]):
+tAfterNavigationPolicy:request:]):
+
 2002-11-21  Maciej Stachowiak  <mjs at apple.com>
 
         * Makefile.am: Pass symroots for this tree to pbxbuild.
diff --git a/WebKit/ChangeLog-2002-12-03 b/WebKit/ChangeLog-2002-12-03
index 50556ee..8b20958 100644
--- a/WebKit/ChangeLog-2002-12-03
+++ b/WebKit/ChangeLog-2002-12-03
@@ -1,3 +1,25 @@
+2002-11-21  Richard Williamson   <rjw at apple.com>
+
+        A different fix to 3078065 that doesn't depend on the appkit's idea of
+        fixed pitch font.
+        
+        The fix is to adjust the width of all characters that have the same width
+        as the space character to match the adjustment of the space character.
+        This has the slight downside that non-monospace fonts that contain glyphs
+        with the same width as the space character will have an extra adjustment.
+        In practice this is not noticeable as the adjustment is always sub-pixel.
+        Nor of course does this cause any mislayout, as it's done at the lowest
+        level for both measurement and drawing.
+        
+        Until we move kthml internals to floats this will be just fine.
+        
+        * WebCoreSupport.subproj/WebTextRenderer.h:
+        * WebCoreSupport.subproj/WebTextRenderer.m:
+        (widthForGlyph):
+        (-[WebTextRenderer initWithFont:]):
+        (-[WebTextRenderer _floatWidthForCharacters:stringLength:fromCharacterPosition:numberOfCharacters:withPadding:applyRounding:attemptFontSubstitution:widths:fonts:glyphs:numGlyphs:letterSpacing:wordSpacing:]):
+tAfterNavigationPolicy:request:]):
+
 2002-11-21  Maciej Stachowiak  <mjs at apple.com>
 
         * Makefile.am: Pass symroots for this tree to pbxbuild.
diff --git a/WebKit/WebCoreSupport.subproj/WebTextRenderer.h b/WebKit/WebCoreSupport.subproj/WebTextRenderer.h
index 1c80af3..2e75763 100644
--- a/WebKit/WebCoreSupport.subproj/WebTextRenderer.h
+++ b/WebKit/WebCoreSupport.subproj/WebTextRenderer.h
@@ -21,8 +21,8 @@ typedef struct GlyphMap GlyphMap;
     NSFont *font;
     GlyphMap *characterToGlyphMap;
     WidthMap *glyphToWidthMap;
-    float fixedWidth;
-    BOOL isFixedPitch;
+    float spaceWidth;
+    float adjustedSpaceWidth;
 }
 
 + (BOOL)shouldBufferTextDrawing;
diff --git a/WebKit/WebCoreSupport.subproj/WebTextRenderer.m b/WebKit/WebCoreSupport.subproj/WebTextRenderer.m
index fe5f303..f15818e 100644
--- a/WebKit/WebCoreSupport.subproj/WebTextRenderer.m
+++ b/WebKit/WebCoreSupport.subproj/WebTextRenderer.m
@@ -176,8 +176,16 @@ static inline WebGlyphWidth widthForGlyph (WebTextRenderer *renderer, WidthMap *
     if (width == UNINITIALIZED_GLYPH_WIDTH)
         width = widthForGlyph (renderer, map->next, glyph);
     
-    if (renderer->isFixedPitch && width != 0)
-        return renderer->fixedWidth;
+    // Hack to ensure that characters that match the width of the space character
+    // have the same integer width as the space character.  This is necessary so
+    // glyphs in fixed pitch fonts all have the same integer width.  We can't depend
+    // on the fixed pitch property of NSFont because that isn't set for all
+    // monospaced fonts, in particular Courier!  This has the downside of inappropriately
+    // adjusting the widths of characters in non-monospaced fonts that are coincidentally
+    // the same width as a space in that font.  In practice this is not an issue as the
+    // adjustment is always as the sub-pixel level.
+    if (width == renderer->spaceWidth)
+        return renderer->adjustedSpaceWidth;
 
     return width;
 }
@@ -356,12 +364,11 @@ static BOOL bufferTextDrawing = NO;
     
     ATSUDisposeStyle(style);
 
-    spaceGlyph = nonGlyphID;
-
-    isFixedPitch = [font isFixedPitch];
-    if (isFixedPitch)
-        fixedWidth = CEIL_TO_INT([font widthOfString: @"X"]);
-        
+    UniChar c = ' ';
+    spaceGlyph = [self extendCharacterToGlyphMapToInclude: c];
+    spaceWidth = widthForGlyph(self, glyphToWidthMap, spaceGlyph);
+    adjustedSpaceWidth = (float)ceil(spaceWidth);
+    
     return self;
 }
 
@@ -738,6 +745,7 @@ static const char *joiningNames[] = {
     }
 
     for (i = 0; i < stringLength; i++) {
+
         UniChar c = characters[i];
         
         // Skip control characters.
@@ -819,7 +827,7 @@ static const char *joiningNames[] = {
                     if (widthBuffer)
                         widthBuffer[numGlyphs - 1] += delta;
                 }   
-                lastWidth = CEIL_TO_INT(widthForGlyph(self, glyphToWidthMap, glyphID));
+                lastWidth = adjustedSpaceWidth;
                 if (padding > 0){
                     // Only use left over padding if note evenly divisible by 
                     // number of spaces.

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list