Commit 7d0b05a1 authored by rjw's avatar rjw

Fixed 3107007. Letter-spacing is causing width to be miscalculated.

        This also fixed some selection problems.

        * khtml/rendering/font.cpp:
        (Font::width):


        Fixed 3107007.  Letter-spacing is causing width to be miscalculated.
        This also fixed some selection problems.

        * WebCoreSupport.subproj/WebTextRenderer.m:
        (-[WebTextRenderer _floatWidthForCharacters:stringLength:fromCharacterPosition:numberOfCharacters:withPadding:applyRounding:attemptFontSubstitution:widths:fonts:glyphs:numGlyphs:letterSpacing:wordSpacing:]):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@2796 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 1d4dea84
......@@ -118,7 +118,10 @@ void Font::floatCharacterWidths( QChar *str, int slen, int pos, int len, int toA
int Font::width( QChar *chs, int slen, int pos, int len ) const
{
#if APPLE_CHANGES
return fm.width(chs + pos, len);
#ifndef ROUND_TO_INT
#define ROUND_TO_INT(x) (unsigned int)((x)+.5)
#endif
return ROUND_TO_INT(fm.floatWidth(chs, slen, pos, len, letterSpacing, wordSpacing));
#else
QString qstr = QConstString(chs+pos, len).string();
// hack for fonts that don't have a welldefined nbsp
......@@ -151,7 +154,7 @@ int Font::width( QChar *chs, int slen, int pos, int len ) const
int Font::width( QChar *chs, int slen, int pos ) const
{
#if APPLE_CHANGES
return width(chs, slen, pos, 1);
return ROUND_TO_INT(fm.floatWidth(chs, slen, pos, 1, letterSpacing, wordSpacing));
#else
int w;
if ( !fontDef.hasNbsp && (chs+pos)->unicode() == 0xa0 )
......
2002-11-20 Richard Williamson <rjw@apple.com>
Fixed 3107007. Letter-spacing is causing width to be miscalculated.
This also fixed some selection problems.
* WebCoreSupport.subproj/WebTextRenderer.m:
(-[WebTextRenderer _floatWidthForCharacters:stringLength:fromCharacterPosition:numberOfCharacters:withPadding:applyRounding:attemptFontSubstitution:widths:fonts:glyphs:numGlyphs:letterSpacing:wordSpacing:]):
2002-11-20 Richard Williamson <rjw@apple.com>
Fixed mono spaced fonts to always render with mono spacing! (3078065)
......
2002-11-20 Richard Williamson <rjw@apple.com>
Fixed 3107007. Letter-spacing is causing width to be miscalculated.
This also fixed some selection problems.
* WebCoreSupport.subproj/WebTextRenderer.m:
(-[WebTextRenderer _floatWidthForCharacters:stringLength:fromCharacterPosition:numberOfCharacters:withPadding:applyRounding:attemptFontSubstitution:widths:fonts:glyphs:numGlyphs:letterSpacing:wordSpacing:]):
2002-11-20 Richard Williamson <rjw@apple.com>
Fixed mono spaced fonts to always render with mono spacing! (3078065)
......
......@@ -870,8 +870,9 @@ - (float)_floatWidthForCharacters:(const UniChar *)characters stringLength:(unsi
#ifdef DEBUG_COMBINING
printf ("Character 0x%04x, joining attribute %d(%s), combining class %d, direction %d(%s)\n", c, WebCoreUnicodeJoiningFunction(c), joiningNames[WebCoreUnicodeJoiningFunction(c)], WebCoreUnicodeCombiningClassFunction(c), WebCoreUnicodeDirectionFunction(c), directionNames[WebCoreUnicodeDirectionFunction(c)]);
#endif
totalWidth += lastWidth;
if (i >= (unsigned int)pos)
totalWidth += lastWidth;
}
// Ceil the last glyph, but only if
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment