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


The following commit has been merged in the debian/unstable branch:
commit aa2ab0122d9b70a2ddb20836264f03c545a383f6
Author: rjw <rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Mar 22 17:06:33 2002 +0000

            Fixed subtle measurement problems.  These were most evident of pages
            that had lots of rounding deviation.  My assumptions about being able to
            round glyph advances was incorrect.  We must pay the expense of a float addition,
            instead of integer addition.  This slows down our inner loop.  Oh well,
            we're still very fast.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@802 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2002-12-03 b/WebCore/ChangeLog-2002-12-03
index 2354edc..93f3b13 100644
--- a/WebCore/ChangeLog-2002-12-03
+++ b/WebCore/ChangeLog-2002-12-03
@@ -1,3 +1,18 @@
+2002-03-22  Richard Williamson  <rjw at apple.com>
+
+        Fixed subtle measurement problems.  These were most evident of pages
+        that had lots of rounding deviation.  My assumptions about being able to
+        round glyph advances was incorrect.  We must pay the expense of a float addition,
+        instead of integer addition.  This slows down our inner loop.  Oh well,
+        we're still very fast.
+        
+	* src/kwq/KWQFontMetrics.mm: (-[KWQLayoutInfo
+	drawString:atPoint:withFont:color:]), (-[KWQLayoutInfo
+	drawUnderlineForString:atPoint:withFont:color:]), (-[KWQLayoutInfo
+	_initializeCaches]), (_rectForString), (QFontMetrics::width),
+	(QFontMetrics::size):
+	* src/kwq/KWQMetrics.h:
+
 2002-03-22  Maciej Stachowiak  <mjs at apple.com>
 
 	Fixed the following post-merge crashers:
diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index 2354edc..93f3b13 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,18 @@
+2002-03-22  Richard Williamson  <rjw at apple.com>
+
+        Fixed subtle measurement problems.  These were most evident of pages
+        that had lots of rounding deviation.  My assumptions about being able to
+        round glyph advances was incorrect.  We must pay the expense of a float addition,
+        instead of integer addition.  This slows down our inner loop.  Oh well,
+        we're still very fast.
+        
+	* src/kwq/KWQFontMetrics.mm: (-[KWQLayoutInfo
+	drawString:atPoint:withFont:color:]), (-[KWQLayoutInfo
+	drawUnderlineForString:atPoint:withFont:color:]), (-[KWQLayoutInfo
+	_initializeCaches]), (_rectForString), (QFontMetrics::width),
+	(QFontMetrics::size):
+	* src/kwq/KWQMetrics.h:
+
 2002-03-22  Maciej Stachowiak  <mjs at apple.com>
 
 	Fixed the following post-merge crashers:
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 2354edc..93f3b13 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,18 @@
+2002-03-22  Richard Williamson  <rjw at apple.com>
+
+        Fixed subtle measurement problems.  These were most evident of pages
+        that had lots of rounding deviation.  My assumptions about being able to
+        round glyph advances was incorrect.  We must pay the expense of a float addition,
+        instead of integer addition.  This slows down our inner loop.  Oh well,
+        we're still very fast.
+        
+	* src/kwq/KWQFontMetrics.mm: (-[KWQLayoutInfo
+	drawString:atPoint:withFont:color:]), (-[KWQLayoutInfo
+	drawUnderlineForString:atPoint:withFont:color:]), (-[KWQLayoutInfo
+	_initializeCaches]), (_rectForString), (QFontMetrics::width),
+	(QFontMetrics::size):
+	* src/kwq/KWQMetrics.h:
+
 2002-03-22  Maciej Stachowiak  <mjs at apple.com>
 
 	Fixed the following post-merge crashers:
diff --git a/WebCore/kwq/KWQFontMetrics.mm b/WebCore/kwq/KWQFontMetrics.mm
index 342f578..b91dc2c 100644
--- a/WebCore/kwq/KWQFontMetrics.mm
+++ b/WebCore/kwq/KWQFontMetrics.mm
@@ -259,7 +259,7 @@ static void __IFFillStyleWithAttributes(ATSUStyle style, NSFont *theFont) {
         cgContext = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
         CGContextSetCharacterSpacing(cgContext, 0.0);
         //CGContextShowGlyphsAtPoint (cgContext, p.x, p.y + [frag boundingRect].size.height + (int)[font descender] - 1, (const short unsigned int *)usedGlyphBuf, numGlyphs);
-        CGContextShowGlyphsAtPoint (cgContext, p.x, p.y + lineHeight - 1, (const short unsigned int *)usedGlyphBuf, numGlyphs);
+        CGContextShowGlyphsAtPoint (cgContext, p.x, p.y + lineHeight - 1 - (int)[font descender], (const short unsigned int *)usedGlyphBuf, numGlyphs);
         
         if (glyphBuf)
             free (glyphBuf);
@@ -306,8 +306,8 @@ static void __IFFillStyleWithAttributes(ATSUStyle style, NSFont *theFont) {
         lineWidth = size.width;
     }
     CGContextSetLineWidth(cgContext, lineWidth);
-    CGContextMoveToPoint(cgContext, p.x, p.y + lineHeight + 0.5);
-    CGContextAddLineToPoint(cgContext, p.x + rect.size.width, p.y + lineHeight + 0.5);
+    CGContextMoveToPoint(cgContext, p.x, p.y + lineHeight + 0.5 - (int)[font descender]);
+    CGContextAddLineToPoint(cgContext, p.x + rect.size.width, p.y + lineHeight + 0.5 - (int)[font descender]);
     CGContextStrokePath(cgContext);
 
     [graphicsContext setShouldAntialias: flag];
@@ -486,13 +486,13 @@ static void __IFFillStyleWithAttributes(ATSUStyle style, NSFont *theFont) {
         widthCache[i] = UNITIALIZED_GLYPH_WIDTH;
     }
     
-    float *tempWidthCache = malloc (glyphsToCache * sizeof(float));
-    errorResult = CGFontGetGlyphScaledAdvances ([font _backingCGSFont], &sequentialGlyphs[0], glyphsToCache, tempWidthCache, [font pointSize]);
+    CGContextRef cgContext;
+
+    cgContext = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
+    CGContextSetCharacterSpacing(cgContext, 0.0);
+    errorResult = CGFontGetGlyphScaledAdvances ([font _backingCGSFont], &sequentialGlyphs[0], glyphsToCache, widthCache, [font pointSize]);
     if (errorResult == 0)
         [NSException raise:NSInternalInconsistencyException format:@"Optimization assumption violation:  unable to cache glyph advances - for %@ %f", self, [font displayName], [font pointSize]];
-    for (i = 0; i < glyphsToCache; i++)
-        widthCache[i] = (_IFGlyphWidth)(ROUND_TO_UINT(tempWidthCache[i]));
-    free (tempWidthCache);
 
     unsigned int latinCount = LAST_CACHE_CHARACTER - FIRST_CACHE_CHARACTER + 1;
     short unsigned int latinBuffer[LAST_CACHE_CHARACTER+1];
@@ -526,7 +526,7 @@ static void __IFFillStyleWithAttributes(ATSUStyle style, NSFont *theFont) {
 
 static NSRect _rectForString (KWQLayoutInfo *self, const UniChar *internalBuffer, unsigned int stringLength)
 {
-    int totalWidth = 0;
+    float totalWidth = 0;
     unsigned int i, index;
     int glyphID;
     ATSLayoutRecord *glyphRecords;
@@ -597,7 +597,6 @@ static NSRect _rectForString (KWQLayoutInfo *self, const UniChar *internalBuffer
                 short unsigned int sequentialGlyphs[INCREMENTAL_GLYPH_CACHE_BLOCK];
                 unsigned int blockStart, blockEnd, blockID;
                 int errorResult;
-                float tempWidthCache[INCREMENTAL_GLYPH_CACHE_BLOCK];
                 
                 blockStart = (glyphID / INCREMENTAL_GLYPH_CACHE_BLOCK) * INCREMENTAL_GLYPH_CACHE_BLOCK;
                 blockEnd = blockStart + INCREMENTAL_GLYPH_CACHE_BLOCK;
@@ -607,11 +606,9 @@ static NSRect _rectForString (KWQLayoutInfo *self, const UniChar *internalBuffer
                 for (blockID = blockStart; blockID < blockEnd; blockID++)
                     sequentialGlyphs[blockID-blockStart] = blockID;
 
-                errorResult = CGFontGetGlyphScaledAdvances ([font _backingCGSFont], &sequentialGlyphs[0], blockEnd-blockStart, &tempWidthCache[0], [font pointSize]);
+                errorResult = CGFontGetGlyphScaledAdvances ([font _backingCGSFont], &sequentialGlyphs[0], blockEnd-blockStart, &widthCache[blockID], [font pointSize]);
                 if (errorResult == 0)
                     [NSException raise:NSInternalInconsistencyException format:@"Optimization assumption violation:  unable to cache glyph widths - for %@ %f", self, [font displayName], [font pointSize]];
-                for (blockID = blockStart; blockID < blockEnd; blockID++)
-                	widthCache[blockID] = (_IFGlyphWidth)(ROUND_TO_UINT(tempWidthCache[blockID-blockStart]));
             }
         }
 
@@ -642,7 +639,7 @@ static NSRect _rectForString (KWQLayoutInfo *self, const UniChar *internalBuffer
         }
     }
     
-    return NSMakeRect (0,0,(float)totalWidth, (float)self->lineHeight);
+    return NSMakeRect (0,0,totalWidth, (float)self->lineHeight);
 }
 #endif
 
@@ -797,6 +794,7 @@ int QFontMetrics::height() const
 int QFontMetrics::width(QChar qc) const
 {
     unichar c = qc.unicode();
+#ifdef NOT_THERE
     switch (c) {
         // cheesy, we use the char version of width to do the work here,
         // and since it doesn't have the optimization, we don't get an
@@ -810,6 +808,7 @@ int QFontMetrics::width(QChar qc) const
                 data->xWidth = width('x');
             return data->xWidth;
     }
+#endif
     return ROUND_TO_INT(_rectForString(data->getInfo(), &c, 1).size.width);
 }
 
@@ -881,7 +880,6 @@ QSize QFontMetrics::size(int, const QString &qstring, int len, int tabstops,
         KWQDEBUGLEVEL(KWQ_LOG_ERROR, "ERROR:  QFontMetrics::size() tabs not supported.\n");
     }
     
-    KWQDEBUG1("string = %s\n", DEBUG_OBJECT(QSTRING_TO_NSSTRING(qstring)));
     NSString *string;
 
     if (len != -1)
diff --git a/WebCore/kwq/KWQMetrics.h b/WebCore/kwq/KWQMetrics.h
index 85f32d4..028a877 100644
--- a/WebCore/kwq/KWQMetrics.h
+++ b/WebCore/kwq/KWQMetrics.h
@@ -72,7 +72,8 @@ CG_EXTERN size_t CGFontGetNumberOfGlyphs(CGFontRef font);
 
 }
 
-typedef unsigned short _IFGlyphWidth;
+//typedef unsigned short _IFGlyphWidth;
+typedef float _IFGlyphWidth;
 
 #endif
 
diff --git a/WebCore/src/kwq/KWQFontMetrics.mm b/WebCore/src/kwq/KWQFontMetrics.mm
index 342f578..b91dc2c 100644
--- a/WebCore/src/kwq/KWQFontMetrics.mm
+++ b/WebCore/src/kwq/KWQFontMetrics.mm
@@ -259,7 +259,7 @@ static void __IFFillStyleWithAttributes(ATSUStyle style, NSFont *theFont) {
         cgContext = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
         CGContextSetCharacterSpacing(cgContext, 0.0);
         //CGContextShowGlyphsAtPoint (cgContext, p.x, p.y + [frag boundingRect].size.height + (int)[font descender] - 1, (const short unsigned int *)usedGlyphBuf, numGlyphs);
-        CGContextShowGlyphsAtPoint (cgContext, p.x, p.y + lineHeight - 1, (const short unsigned int *)usedGlyphBuf, numGlyphs);
+        CGContextShowGlyphsAtPoint (cgContext, p.x, p.y + lineHeight - 1 - (int)[font descender], (const short unsigned int *)usedGlyphBuf, numGlyphs);
         
         if (glyphBuf)
             free (glyphBuf);
@@ -306,8 +306,8 @@ static void __IFFillStyleWithAttributes(ATSUStyle style, NSFont *theFont) {
         lineWidth = size.width;
     }
     CGContextSetLineWidth(cgContext, lineWidth);
-    CGContextMoveToPoint(cgContext, p.x, p.y + lineHeight + 0.5);
-    CGContextAddLineToPoint(cgContext, p.x + rect.size.width, p.y + lineHeight + 0.5);
+    CGContextMoveToPoint(cgContext, p.x, p.y + lineHeight + 0.5 - (int)[font descender]);
+    CGContextAddLineToPoint(cgContext, p.x + rect.size.width, p.y + lineHeight + 0.5 - (int)[font descender]);
     CGContextStrokePath(cgContext);
 
     [graphicsContext setShouldAntialias: flag];
@@ -486,13 +486,13 @@ static void __IFFillStyleWithAttributes(ATSUStyle style, NSFont *theFont) {
         widthCache[i] = UNITIALIZED_GLYPH_WIDTH;
     }
     
-    float *tempWidthCache = malloc (glyphsToCache * sizeof(float));
-    errorResult = CGFontGetGlyphScaledAdvances ([font _backingCGSFont], &sequentialGlyphs[0], glyphsToCache, tempWidthCache, [font pointSize]);
+    CGContextRef cgContext;
+
+    cgContext = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
+    CGContextSetCharacterSpacing(cgContext, 0.0);
+    errorResult = CGFontGetGlyphScaledAdvances ([font _backingCGSFont], &sequentialGlyphs[0], glyphsToCache, widthCache, [font pointSize]);
     if (errorResult == 0)
         [NSException raise:NSInternalInconsistencyException format:@"Optimization assumption violation:  unable to cache glyph advances - for %@ %f", self, [font displayName], [font pointSize]];
-    for (i = 0; i < glyphsToCache; i++)
-        widthCache[i] = (_IFGlyphWidth)(ROUND_TO_UINT(tempWidthCache[i]));
-    free (tempWidthCache);
 
     unsigned int latinCount = LAST_CACHE_CHARACTER - FIRST_CACHE_CHARACTER + 1;
     short unsigned int latinBuffer[LAST_CACHE_CHARACTER+1];
@@ -526,7 +526,7 @@ static void __IFFillStyleWithAttributes(ATSUStyle style, NSFont *theFont) {
 
 static NSRect _rectForString (KWQLayoutInfo *self, const UniChar *internalBuffer, unsigned int stringLength)
 {
-    int totalWidth = 0;
+    float totalWidth = 0;
     unsigned int i, index;
     int glyphID;
     ATSLayoutRecord *glyphRecords;
@@ -597,7 +597,6 @@ static NSRect _rectForString (KWQLayoutInfo *self, const UniChar *internalBuffer
                 short unsigned int sequentialGlyphs[INCREMENTAL_GLYPH_CACHE_BLOCK];
                 unsigned int blockStart, blockEnd, blockID;
                 int errorResult;
-                float tempWidthCache[INCREMENTAL_GLYPH_CACHE_BLOCK];
                 
                 blockStart = (glyphID / INCREMENTAL_GLYPH_CACHE_BLOCK) * INCREMENTAL_GLYPH_CACHE_BLOCK;
                 blockEnd = blockStart + INCREMENTAL_GLYPH_CACHE_BLOCK;
@@ -607,11 +606,9 @@ static NSRect _rectForString (KWQLayoutInfo *self, const UniChar *internalBuffer
                 for (blockID = blockStart; blockID < blockEnd; blockID++)
                     sequentialGlyphs[blockID-blockStart] = blockID;
 
-                errorResult = CGFontGetGlyphScaledAdvances ([font _backingCGSFont], &sequentialGlyphs[0], blockEnd-blockStart, &tempWidthCache[0], [font pointSize]);
+                errorResult = CGFontGetGlyphScaledAdvances ([font _backingCGSFont], &sequentialGlyphs[0], blockEnd-blockStart, &widthCache[blockID], [font pointSize]);
                 if (errorResult == 0)
                     [NSException raise:NSInternalInconsistencyException format:@"Optimization assumption violation:  unable to cache glyph widths - for %@ %f", self, [font displayName], [font pointSize]];
-                for (blockID = blockStart; blockID < blockEnd; blockID++)
-                	widthCache[blockID] = (_IFGlyphWidth)(ROUND_TO_UINT(tempWidthCache[blockID-blockStart]));
             }
         }
 
@@ -642,7 +639,7 @@ static NSRect _rectForString (KWQLayoutInfo *self, const UniChar *internalBuffer
         }
     }
     
-    return NSMakeRect (0,0,(float)totalWidth, (float)self->lineHeight);
+    return NSMakeRect (0,0,totalWidth, (float)self->lineHeight);
 }
 #endif
 
@@ -797,6 +794,7 @@ int QFontMetrics::height() const
 int QFontMetrics::width(QChar qc) const
 {
     unichar c = qc.unicode();
+#ifdef NOT_THERE
     switch (c) {
         // cheesy, we use the char version of width to do the work here,
         // and since it doesn't have the optimization, we don't get an
@@ -810,6 +808,7 @@ int QFontMetrics::width(QChar qc) const
                 data->xWidth = width('x');
             return data->xWidth;
     }
+#endif
     return ROUND_TO_INT(_rectForString(data->getInfo(), &c, 1).size.width);
 }
 
@@ -881,7 +880,6 @@ QSize QFontMetrics::size(int, const QString &qstring, int len, int tabstops,
         KWQDEBUGLEVEL(KWQ_LOG_ERROR, "ERROR:  QFontMetrics::size() tabs not supported.\n");
     }
     
-    KWQDEBUG1("string = %s\n", DEBUG_OBJECT(QSTRING_TO_NSSTRING(qstring)));
     NSString *string;
 
     if (len != -1)
diff --git a/WebCore/src/kwq/KWQMetrics.h b/WebCore/src/kwq/KWQMetrics.h
index 85f32d4..028a877 100644
--- a/WebCore/src/kwq/KWQMetrics.h
+++ b/WebCore/src/kwq/KWQMetrics.h
@@ -72,7 +72,8 @@ CG_EXTERN size_t CGFontGetNumberOfGlyphs(CGFontRef font);
 
 }
 
-typedef unsigned short _IFGlyphWidth;
+//typedef unsigned short _IFGlyphWidth;
+typedef float _IFGlyphWidth;
 
 #endif
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list