[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:17:54 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit 385434280a75f5b06e47f866624646e918af32bf
Author: rjw <rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Mon Jun 10 20:09:02 2002 +0000
i Tweaks to new rounding code.
Added Cocoa-exact width measurement emulation flag to support IFStringTruncator.
Remove code that was already conditionally excluded calls to support
non-specified advance drawing (we now depend on tweaked advances).
* Misc.subproj/IFStringTruncator.m:
(+[IFStringTruncator centerTruncateString:toWidth:withFont:]):
* WebCoreSupport.subproj/IFTextRenderer.h:
* WebCoreSupport.subproj/IFTextRenderer.m:
(-[IFTextRenderer initWithFont:]):
(-[IFTextRenderer drawCharacters:length:atPoint:withColor:]):
(-[IFTextRenderer slowFloatWidthForCharacters:length:applyRounding:]):
(-[IFTextRenderer slowFloatWidthForCharacters:length:]):
(-[IFTextRenderer floatWidthForCharacters:length:applyRounding:]):
(-[IFTextRenderer floatWidthForCharacters:length:]):
(-[IFTextRenderer extendCharacterToGlyphMapToInclude:]):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@1329 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index c6ea300..6aa53f3 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,24 @@
+2002-06-10 Richard Williamson <rjw at apple.com>
+
+ Tweaks to rounding code.
+
+ Added Cocoa-exact width measurement emulation flag to support IFStringTruncator.
+
+ Remove code that was already conditionally excluded calls to support
+ non-specified advance drawing (we now depend on tweaked advances).
+
+ * Misc.subproj/IFStringTruncator.m:
+ (+[IFStringTruncator centerTruncateString:toWidth:withFont:]):
+ * WebCoreSupport.subproj/IFTextRenderer.h:
+ * WebCoreSupport.subproj/IFTextRenderer.m:
+ (-[IFTextRenderer initWithFont:]):
+ (-[IFTextRenderer drawCharacters:length:atPoint:withColor:]):
+ (-[IFTextRenderer slowFloatWidthForCharacters:length:applyRounding:]):
+ (-[IFTextRenderer slowFloatWidthForCharacters:length:]):
+ (-[IFTextRenderer floatWidthForCharacters:length:applyRounding:]):
+ (-[IFTextRenderer floatWidthForCharacters:length:]):
+ (-[IFTextRenderer extendCharacterToGlyphMapToInclude:]):
+
2002-06-10 Darin Adler <darin at apple.com>
* WebCoreSupport.subproj/IFCachedTextRenderer.m: Removed.
diff --git a/WebKit/ChangeLog-2002-12-03 b/WebKit/ChangeLog-2002-12-03
index c6ea300..6aa53f3 100644
--- a/WebKit/ChangeLog-2002-12-03
+++ b/WebKit/ChangeLog-2002-12-03
@@ -1,3 +1,24 @@
+2002-06-10 Richard Williamson <rjw at apple.com>
+
+ Tweaks to rounding code.
+
+ Added Cocoa-exact width measurement emulation flag to support IFStringTruncator.
+
+ Remove code that was already conditionally excluded calls to support
+ non-specified advance drawing (we now depend on tweaked advances).
+
+ * Misc.subproj/IFStringTruncator.m:
+ (+[IFStringTruncator centerTruncateString:toWidth:withFont:]):
+ * WebCoreSupport.subproj/IFTextRenderer.h:
+ * WebCoreSupport.subproj/IFTextRenderer.m:
+ (-[IFTextRenderer initWithFont:]):
+ (-[IFTextRenderer drawCharacters:length:atPoint:withColor:]):
+ (-[IFTextRenderer slowFloatWidthForCharacters:length:applyRounding:]):
+ (-[IFTextRenderer slowFloatWidthForCharacters:length:]):
+ (-[IFTextRenderer floatWidthForCharacters:length:applyRounding:]):
+ (-[IFTextRenderer floatWidthForCharacters:length:]):
+ (-[IFTextRenderer extendCharacterToGlyphMapToInclude:]):
+
2002-06-10 Darin Adler <darin at apple.com>
* WebCoreSupport.subproj/IFCachedTextRenderer.m: Removed.
diff --git a/WebKit/Misc.subproj/IFStringTruncator.m b/WebKit/Misc.subproj/IFStringTruncator.m
index 48927b6..c776e21 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];
+ currentEllipsisWidth = [currentRenderer floatWidthForCharacters:&ellipsis length:1 applyRounding: NO];
}
WEBKIT_ASSERT(currentRenderer);
@@ -96,7 +96,7 @@ static float currentEllipsisWidth;
}
width = [currentRenderer floatWidthForCharacters:stringBuffer
- length:truncatedLength];
+ length:truncatedLength applyRounding: NO];
if (width <= maxWidth) {
return string;
}
@@ -136,7 +136,7 @@ static float currentEllipsisWidth;
keepCount:keepCount
toBuffer:stringBuffer];
- width = [currentRenderer floatWidthForCharacters:stringBuffer length:truncatedLength];
+ width = [currentRenderer floatWidthForCharacters:stringBuffer length:truncatedLength applyRounding: NO];
if (width <= maxWidth) {
keepCountForLargestKnownToFit = keepCount;
widthForLargestKnownToFit = width;
diff --git a/WebKit/Misc.subproj/WebStringTruncator.m b/WebKit/Misc.subproj/WebStringTruncator.m
index 48927b6..c776e21 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];
+ currentEllipsisWidth = [currentRenderer floatWidthForCharacters:&ellipsis length:1 applyRounding: NO];
}
WEBKIT_ASSERT(currentRenderer);
@@ -96,7 +96,7 @@ static float currentEllipsisWidth;
}
width = [currentRenderer floatWidthForCharacters:stringBuffer
- length:truncatedLength];
+ length:truncatedLength applyRounding: NO];
if (width <= maxWidth) {
return string;
}
@@ -136,7 +136,7 @@ static float currentEllipsisWidth;
keepCount:keepCount
toBuffer:stringBuffer];
- width = [currentRenderer floatWidthForCharacters:stringBuffer length:truncatedLength];
+ width = [currentRenderer floatWidthForCharacters:stringBuffer length:truncatedLength applyRounding: NO];
if (width <= maxWidth) {
keepCountForLargestKnownToFit = keepCount;
widthForLargestKnownToFit = width;
diff --git a/WebKit/WebCoreSupport.subproj/IFTextRenderer.h b/WebKit/WebCoreSupport.subproj/IFTextRenderer.h
index 6c04c6c..4e535c8 100644
--- a/WebKit/WebCoreSupport.subproj/IFTextRenderer.h
+++ b/WebKit/WebCoreSupport.subproj/IFTextRenderer.h
@@ -16,6 +16,7 @@ typedef struct GlyphMap GlyphMap;
int ascent;
int descent;
int lineSpacing;
+ ATSGlyphRef spaceGlyph;
struct AttributeGroup *styleGroup;
@@ -27,6 +28,12 @@ typedef struct GlyphMap GlyphMap;
- initWithFont:(NSFont *)font;
+
+// Will not return a Cocoa equivalent width. If you need that use
+// floatWidthForCharacters:length:applyRounding: with applyRounding == NO.
- (float)floatWidthForCharacters:(const unichar *)characters length:(unsigned)length;
+// Set applyRounding = NO to get an Cocoa equivalent width.
+- (float)floatWidthForCharacters:(const unichar *)characters length:(unsigned)length applyRounding: (BOOL)applyRounding;
+
@end
diff --git a/WebKit/WebCoreSupport.subproj/IFTextRenderer.m b/WebKit/WebCoreSupport.subproj/IFTextRenderer.m
index 02d4853..70a2d66 100644
--- a/WebKit/WebCoreSupport.subproj/IFTextRenderer.m
+++ b/WebKit/WebCoreSupport.subproj/IFTextRenderer.m
@@ -302,6 +302,8 @@ static bool hasMissingGlyphs(ATSGlyphVector *glyphs)
ATSUDisposeStyle(style);
+ spaceGlyph = nonGlyphID;
+
return self;
}
@@ -425,7 +427,7 @@ static bool hasMissingGlyphs(ATSGlyphVector *glyphs)
- (void)drawCharacters:(const UniChar *)characters length: (unsigned int)length atPoint:(NSPoint)point withColor:(NSColor *)color
{
uint i, numGlyphs;
- CGGlyph *glyphs, spaceGlyph = -1, localGlyphBuffer[LOCAL_GLYPH_BUFFER_SIZE];
+ CGGlyph *glyphs, localGlyphBuffer[LOCAL_GLYPH_BUFFER_SIZE];
#ifndef DRAW_WITHOUT_ADVANCES
CGSize *advances, localAdvanceBuffer[LOCAL_GLYPH_BUFFER_SIZE];
#endif
@@ -494,9 +496,6 @@ static bool hasMissingGlyphs(ATSGlyphVector *glyphs)
}
}
- if (c == SPACE)
- spaceGlyph = glyphID;
-
glyphs[i] = glyphID;
}
@@ -537,8 +536,8 @@ static bool hasMissingGlyphs(ATSGlyphVector *glyphs)
CGContextShowGlyphsAtPoint (cgContext, point.x, point.y + [font defaultLineHeightForFont] - [self descent] + 1, glyphs, numGlyphs);
#else
CGContextSetTextPosition (cgContext, point.x, point.y - [self descent] + 1);
- //CGContextShowGlyphsWithAdvances (cgContext, glyphs, advances, numGlyphs);
- CGContextShowGlyphsWithDeviceAdvances (cgContext, glyphs, advances, numGlyphs);
+ CGContextShowGlyphsWithAdvances (cgContext, glyphs, advances, numGlyphs);
+ //CGContextShowGlyphsWithDeviceAdvances (cgContext, glyphs, advances, numGlyphs);
if (advances != localAdvanceBuffer) {
free(advances);
@@ -585,7 +584,7 @@ cleanup:
}
-- (float)slowFloatWidthForCharacters: (const UniChar *)characters length: (unsigned)length
+- (float)slowFloatWidthForCharacters: (const UniChar *)characters length: (unsigned)length applyRounding: (BOOL)applyRounding
{
float totalWidth = 0;
unsigned int i, numGlyphs;
@@ -602,7 +601,10 @@ cleanup:
for (i = 0; i < numGlyphs; i++){
glyphID = glyphRecord->glyphID;
glyphRecord = (ATSLayoutRecord *)((char *)glyphRecord + glyphVector.recordSize);
- glyphWidth = widthForGlyph(self, glyphToWidthMap, glyphID);
+ if (glyphID == spaceGlyph && applyRounding)
+ glyphWidth = ROUND_TO_INT(widthForGlyph(self, glyphToWidthMap, glyphID));
+ else
+ glyphWidth = widthForGlyph(self, glyphToWidthMap, glyphID);
totalWidth += glyphWidth;
}
ATSClearGlyphVector(&glyphVector);
@@ -610,8 +612,13 @@ cleanup:
return totalWidth;
}
+- (float)slowFloatWidthForCharacters: (const UniChar *)characters length: (unsigned)length
+{
+ return [self floatWidthForCharacters: characters length: length applyRounding: YES];
+}
-- (float)floatWidthForCharacters:(const UniChar *)characters length:(unsigned)length
+
+- (float)floatWidthForCharacters:(const UniChar *)characters length:(unsigned)length applyRounding: (BOOL)applyRounding
{
float totalWidth = 0;
unsigned int i;
@@ -649,7 +656,7 @@ cleanup:
}
}
- if (c == SPACE)
+ if (glyphID == spaceGlyph && applyRounding)
totalWidth += ROUND_TO_INT(widthForGlyph(self, glyphToWidthMap, glyphID));
else
totalWidth += widthForGlyph(self, glyphToWidthMap, glyphID);
@@ -658,6 +665,12 @@ cleanup:
return totalWidth;
}
+- (float)floatWidthForCharacters:(const UniChar *)characters length:(unsigned)length
+{
+ return [self floatWidthForCharacters: characters length: length applyRounding: YES];
+}
+
+
- (int)widthForCharacters:(const UniChar *)characters length:(unsigned)length
{
return ROUND_TO_INT([self floatWidthForCharacters:characters length:length]);
@@ -727,6 +740,9 @@ cleanup:
lastMap->next = map;
}
+ if (spaceGlyph == nonGlyphID)
+ spaceGlyph = glyphForCharacter (characterToGlyphMap, SPACE);
+
return map->glyphs[c - start];
}
diff --git a/WebKit/WebCoreSupport.subproj/WebTextRenderer.h b/WebKit/WebCoreSupport.subproj/WebTextRenderer.h
index 6c04c6c..4e535c8 100644
--- a/WebKit/WebCoreSupport.subproj/WebTextRenderer.h
+++ b/WebKit/WebCoreSupport.subproj/WebTextRenderer.h
@@ -16,6 +16,7 @@ typedef struct GlyphMap GlyphMap;
int ascent;
int descent;
int lineSpacing;
+ ATSGlyphRef spaceGlyph;
struct AttributeGroup *styleGroup;
@@ -27,6 +28,12 @@ typedef struct GlyphMap GlyphMap;
- initWithFont:(NSFont *)font;
+
+// Will not return a Cocoa equivalent width. If you need that use
+// floatWidthForCharacters:length:applyRounding: with applyRounding == NO.
- (float)floatWidthForCharacters:(const unichar *)characters length:(unsigned)length;
+// Set applyRounding = NO to get an Cocoa equivalent width.
+- (float)floatWidthForCharacters:(const unichar *)characters length:(unsigned)length applyRounding: (BOOL)applyRounding;
+
@end
diff --git a/WebKit/WebCoreSupport.subproj/WebTextRenderer.m b/WebKit/WebCoreSupport.subproj/WebTextRenderer.m
index 02d4853..70a2d66 100644
--- a/WebKit/WebCoreSupport.subproj/WebTextRenderer.m
+++ b/WebKit/WebCoreSupport.subproj/WebTextRenderer.m
@@ -302,6 +302,8 @@ static bool hasMissingGlyphs(ATSGlyphVector *glyphs)
ATSUDisposeStyle(style);
+ spaceGlyph = nonGlyphID;
+
return self;
}
@@ -425,7 +427,7 @@ static bool hasMissingGlyphs(ATSGlyphVector *glyphs)
- (void)drawCharacters:(const UniChar *)characters length: (unsigned int)length atPoint:(NSPoint)point withColor:(NSColor *)color
{
uint i, numGlyphs;
- CGGlyph *glyphs, spaceGlyph = -1, localGlyphBuffer[LOCAL_GLYPH_BUFFER_SIZE];
+ CGGlyph *glyphs, localGlyphBuffer[LOCAL_GLYPH_BUFFER_SIZE];
#ifndef DRAW_WITHOUT_ADVANCES
CGSize *advances, localAdvanceBuffer[LOCAL_GLYPH_BUFFER_SIZE];
#endif
@@ -494,9 +496,6 @@ static bool hasMissingGlyphs(ATSGlyphVector *glyphs)
}
}
- if (c == SPACE)
- spaceGlyph = glyphID;
-
glyphs[i] = glyphID;
}
@@ -537,8 +536,8 @@ static bool hasMissingGlyphs(ATSGlyphVector *glyphs)
CGContextShowGlyphsAtPoint (cgContext, point.x, point.y + [font defaultLineHeightForFont] - [self descent] + 1, glyphs, numGlyphs);
#else
CGContextSetTextPosition (cgContext, point.x, point.y - [self descent] + 1);
- //CGContextShowGlyphsWithAdvances (cgContext, glyphs, advances, numGlyphs);
- CGContextShowGlyphsWithDeviceAdvances (cgContext, glyphs, advances, numGlyphs);
+ CGContextShowGlyphsWithAdvances (cgContext, glyphs, advances, numGlyphs);
+ //CGContextShowGlyphsWithDeviceAdvances (cgContext, glyphs, advances, numGlyphs);
if (advances != localAdvanceBuffer) {
free(advances);
@@ -585,7 +584,7 @@ cleanup:
}
-- (float)slowFloatWidthForCharacters: (const UniChar *)characters length: (unsigned)length
+- (float)slowFloatWidthForCharacters: (const UniChar *)characters length: (unsigned)length applyRounding: (BOOL)applyRounding
{
float totalWidth = 0;
unsigned int i, numGlyphs;
@@ -602,7 +601,10 @@ cleanup:
for (i = 0; i < numGlyphs; i++){
glyphID = glyphRecord->glyphID;
glyphRecord = (ATSLayoutRecord *)((char *)glyphRecord + glyphVector.recordSize);
- glyphWidth = widthForGlyph(self, glyphToWidthMap, glyphID);
+ if (glyphID == spaceGlyph && applyRounding)
+ glyphWidth = ROUND_TO_INT(widthForGlyph(self, glyphToWidthMap, glyphID));
+ else
+ glyphWidth = widthForGlyph(self, glyphToWidthMap, glyphID);
totalWidth += glyphWidth;
}
ATSClearGlyphVector(&glyphVector);
@@ -610,8 +612,13 @@ cleanup:
return totalWidth;
}
+- (float)slowFloatWidthForCharacters: (const UniChar *)characters length: (unsigned)length
+{
+ return [self floatWidthForCharacters: characters length: length applyRounding: YES];
+}
-- (float)floatWidthForCharacters:(const UniChar *)characters length:(unsigned)length
+
+- (float)floatWidthForCharacters:(const UniChar *)characters length:(unsigned)length applyRounding: (BOOL)applyRounding
{
float totalWidth = 0;
unsigned int i;
@@ -649,7 +656,7 @@ cleanup:
}
}
- if (c == SPACE)
+ if (glyphID == spaceGlyph && applyRounding)
totalWidth += ROUND_TO_INT(widthForGlyph(self, glyphToWidthMap, glyphID));
else
totalWidth += widthForGlyph(self, glyphToWidthMap, glyphID);
@@ -658,6 +665,12 @@ cleanup:
return totalWidth;
}
+- (float)floatWidthForCharacters:(const UniChar *)characters length:(unsigned)length
+{
+ return [self floatWidthForCharacters: characters length: length applyRounding: YES];
+}
+
+
- (int)widthForCharacters:(const UniChar *)characters length:(unsigned)length
{
return ROUND_TO_INT([self floatWidthForCharacters:characters length:length]);
@@ -727,6 +740,9 @@ cleanup:
lastMap->next = map;
}
+ if (spaceGlyph == nonGlyphID)
+ spaceGlyph = glyphForCharacter (characterToGlyphMap, SPACE);
+
return map->glyphs[c - start];
}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list