[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677
darin
darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 06:08:55 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit 9afc49bb6fdb3e0fb6e929bcd2ef298696dc4da5
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Apr 23 01:37:04 2002 +0000
Fix width of non-breaking spaces. There's code to hack this
at the KDE level for fonts that don't have non-breaking space
characters, but we need it even for fonts that do.
Not sure why this worked better on Puma, but now it's fine on
both Puma and Jaguar.
* kwq/KWQFontMetrics.mm:
(ConvertCharactersToGlyphs): New. Turns non-breaking spaces into
normal spaces if needed.
(-[KWQLayoutInfo drawString:atPoint:withFont:color:]),
(-[KWQLayoutInfo _initializeCaches]), (_rectForString): Change to
call ConvertCharactersToGlyphs instead of ATSUConvertCharToGlyphs.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@1063 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog-2002-12-03 b/WebCore/ChangeLog-2002-12-03
index 40dbb3e..3ab3f62 100644
--- a/WebCore/ChangeLog-2002-12-03
+++ b/WebCore/ChangeLog-2002-12-03
@@ -1,5 +1,21 @@
2002-04-22 Darin Adler <darin at apple.com>
+ Fix width of non-breaking spaces. There's code to hack this
+ at the KDE level for fonts that don't have non-breaking space
+ characters, but we need it even for fonts that do.
+
+ Not sure why this worked better on Puma, but now it's fine on
+ both Puma and Jaguar.
+
+ * kwq/KWQFontMetrics.mm:
+ (ConvertCharactersToGlyphs): New. Turns non-breaking spaces into
+ normal spaces if needed.
+ (-[KWQLayoutInfo drawString:atPoint:withFont:color:]),
+ (-[KWQLayoutInfo _initializeCaches]), (_rectForString): Change to
+ call ConvertCharactersToGlyphs instead of ATSUConvertCharToGlyphs.
+
+2002-04-22 Darin Adler <darin at apple.com>
+
* kwq/qt/qpixmap.h:
* kwq/KWQPixmap.mm:
(QPixmap::QPixmap): Clear needsCopyOnWrite flag in all the
diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index 40dbb3e..3ab3f62 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,5 +1,21 @@
2002-04-22 Darin Adler <darin at apple.com>
+ Fix width of non-breaking spaces. There's code to hack this
+ at the KDE level for fonts that don't have non-breaking space
+ characters, but we need it even for fonts that do.
+
+ Not sure why this worked better on Puma, but now it's fine on
+ both Puma and Jaguar.
+
+ * kwq/KWQFontMetrics.mm:
+ (ConvertCharactersToGlyphs): New. Turns non-breaking spaces into
+ normal spaces if needed.
+ (-[KWQLayoutInfo drawString:atPoint:withFont:color:]),
+ (-[KWQLayoutInfo _initializeCaches]), (_rectForString): Change to
+ call ConvertCharactersToGlyphs instead of ATSUConvertCharToGlyphs.
+
+2002-04-22 Darin Adler <darin at apple.com>
+
* kwq/qt/qpixmap.h:
* kwq/KWQPixmap.mm:
(QPixmap::QPixmap): Clear needsCopyOnWrite flag in all the
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 40dbb3e..3ab3f62 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,5 +1,21 @@
2002-04-22 Darin Adler <darin at apple.com>
+ Fix width of non-breaking spaces. There's code to hack this
+ at the KDE level for fonts that don't have non-breaking space
+ characters, but we need it even for fonts that do.
+
+ Not sure why this worked better on Puma, but now it's fine on
+ both Puma and Jaguar.
+
+ * kwq/KWQFontMetrics.mm:
+ (ConvertCharactersToGlyphs): New. Turns non-breaking spaces into
+ normal spaces if needed.
+ (-[KWQLayoutInfo drawString:atPoint:withFont:color:]),
+ (-[KWQLayoutInfo _initializeCaches]), (_rectForString): Change to
+ call ConvertCharactersToGlyphs instead of ATSUConvertCharToGlyphs.
+
+2002-04-22 Darin Adler <darin at apple.com>
+
* kwq/qt/qpixmap.h:
* kwq/KWQPixmap.mm:
(QPixmap::QPixmap): Clear needsCopyOnWrite flag in all the
diff --git a/WebCore/kwq/KWQFontMetrics.mm b/WebCore/kwq/KWQFontMetrics.mm
index a02f4eb..3f52773 100644
--- a/WebCore/kwq/KWQFontMetrics.mm
+++ b/WebCore/kwq/KWQFontMetrics.mm
@@ -22,11 +22,11 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <math.h>
-#include <kwqdebug.h>
-#include <qfontmetrics.h>
+#import <qfontmetrics.h>
+#import <math.h>
+#import <kwqdebug.h>
#import <Cocoa/Cocoa.h>
#define DIRECT_TO_CG
@@ -35,6 +35,9 @@
#import <KWQTextStorage.h>
#import <KWQTextContainer.h>
+#define NON_BREAKING_SPACE 0xA0
+#define SPACE 0x20
+
#define FLOOR_TO_INT(x) (int)(floor(x))
//#define ROUND_TO_INT(x) (int)(((x) > (floor(x) + .5)) ? ceil(x) : floor(x))
#define ROUND_TO_INT(x) (unsigned int)(x+.5)
@@ -211,6 +214,43 @@ static void __IFFillStyleWithAttributes(ATSUStyle style, NSFont *theFont) {
}
}
}
+
+/* Convert non-breaking spaces into spaces. */
+static void ConvertCharactersToGlyphs(ATSStyleGroupPtr styleGroup, const UniChar *characters, int numCharacters, ATSGlyphVector *glyphs)
+{
+ int i;
+ UniChar localBuffer[LOCAL_GLYPH_BUFFER_SIZE];
+ UniChar *buffer = localBuffer;
+
+ for (i = 0; i < numCharacters; i++) {
+ if (characters[i] == NON_BREAKING_SPACE) {
+ break;
+ }
+ }
+
+ if (i < numCharacters) {
+ if (numCharacters > LOCAL_GLYPH_BUFFER_SIZE) {
+ buffer = (UniChar *)malloc(sizeof(UniChar) * numCharacters);
+ }
+
+ for (i = 0; i < numCharacters; i++) {
+ if (characters[i] == NON_BREAKING_SPACE) {
+ buffer[i] = SPACE;
+ } else {
+ buffer[i] = characters[i];
+ }
+ }
+
+ characters = buffer;
+ }
+
+ ATSUConvertCharToGlyphs(styleGroup, characters, 0, numCharacters, 0, glyphs);
+
+ if (buffer != localBuffer) {
+ free(buffer);
+ }
+}
+
#endif
- (void)drawString: (NSString *)string atPoint: (NSPoint)p withFont: (NSFont *)aFont color: (NSColor *)color
@@ -221,6 +261,7 @@ static void __IFFillStyleWithAttributes(ATSUStyle style, NSFont *theFont) {
const UniChar *internalBuffer;
if (!_internalBuffer){
+ // FIXME: Handle case where length > LOCAL_GLYPH_BUFFER_SIZE
CFStringGetCharacters((CFStringRef)string, CFRangeMake(0, CFStringGetLength((CFStringRef)string)), &localBuffer[0]);
internalBuffer = &localBuffer[0];
}
@@ -231,7 +272,7 @@ static void __IFFillStyleWithAttributes(ATSUStyle style, NSFont *theFont) {
__IFInitATSGlyphVector(&_glyphVector, [string length]);
- (void)ATSUConvertCharToGlyphs(_styleGroup, internalBuffer, 0, [string length], 0, &_glyphVector);
+ ConvertCharactersToGlyphs(_styleGroup, internalBuffer, [string length], &_glyphVector);
[color set];
[aFont set];
@@ -503,7 +544,7 @@ static void __IFFillStyleWithAttributes(ATSUStyle style, NSFont *theFont) {
ATSGlyphVector latinGlyphVector;
ATSInitializeGlyphVector(latinCount, 0, &latinGlyphVector);
- (void)ATSUConvertCharToGlyphs(_styleGroup, &latinBuffer[FIRST_CACHE_CHARACTER], 0, latinCount, 0, &latinGlyphVector);
+ ConvertCharactersToGlyphs(_styleGroup, &latinBuffer[FIRST_CACHE_CHARACTER], latinCount, &latinGlyphVector);
if (latinGlyphVector.numGlyphs != latinCount)
[NSException raise:NSInternalInconsistencyException format:@"Optimization assumption violation: ascii and glyphID count not equal - for %@ %f", self, [font displayName], [font pointSize]];
@@ -579,7 +620,7 @@ static NSRect _rectForString (KWQLayoutInfo *self, const UniChar *internalBuffer
KWQDEBUGLEVEL(KWQ_LOG_FONTCACHECHARMISS, "character-to-glyph cache miss for character 0x%04x in %s, %.0f\n", internalBuffer[i], [[font displayName] lossyCString], [font pointSize]);
__IFInitATSGlyphVector(&self->_glyphVector, stringLength);
- (void)ATSUConvertCharToGlyphs(self->_styleGroup, internalBuffer, 0, stringLength, 0, &self->_glyphVector);
+ ConvertCharactersToGlyphs(self->_styleGroup, internalBuffer, stringLength, &self->_glyphVector);
glyphRecords = (ATSLayoutRecord *)self->_glyphVector.firstRecord;
numGlyphs = self->_glyphVector.numGlyphs;
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list