Commit 68860175 authored by rjw's avatar rjw

Fixed mono spaced fonts to always render with mono spacing! (3078065)

        * WebCoreSupport.subproj/WebTextRenderer.h:
        * WebCoreSupport.subproj/WebTextRenderer.m:
        (widthForGlyph):
        (-[WebTextRenderer initWithFont:]):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@2793 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 5b1e7b71
2002-11-20 Richard Williamson <rjw@apple.com>
Fixed mono spaced fonts to always render with mono spacing! (3078065)
* WebCoreSupport.subproj/WebTextRenderer.h:
* WebCoreSupport.subproj/WebTextRenderer.m:
(widthForGlyph):
(-[WebTextRenderer initWithFont:]):
2002-11-20 Chris Blumenberg <cblu@apple.com> 2002-11-20 Chris Blumenberg <cblu@apple.com>
Fixed: 3074926 - crash in BitsToPix() trying to print cnet page Fixed: 3074926 - crash in BitsToPix() trying to print cnet page
......
2002-11-20 Richard Williamson <rjw@apple.com>
Fixed mono spaced fonts to always render with mono spacing! (3078065)
* WebCoreSupport.subproj/WebTextRenderer.h:
* WebCoreSupport.subproj/WebTextRenderer.m:
(widthForGlyph):
(-[WebTextRenderer initWithFont:]):
2002-11-20 Chris Blumenberg <cblu@apple.com> 2002-11-20 Chris Blumenberg <cblu@apple.com>
Fixed: 3074926 - crash in BitsToPix() trying to print cnet page Fixed: 3074926 - crash in BitsToPix() trying to print cnet page
......
...@@ -146,7 +146,7 @@ static void setGlyphForCharacter (GlyphMap *map, ATSGlyphRef glyph, UniChar c) ...@@ -146,7 +146,7 @@ static void setGlyphForCharacter (GlyphMap *map, ATSGlyphRef glyph, UniChar c)
static inline WebGlyphWidth widthForGlyph (WebTextRenderer *renderer, WidthMap *map, ATSGlyphRef glyph) static inline WebGlyphWidth widthForGlyph (WebTextRenderer *renderer, WidthMap *map, ATSGlyphRef glyph)
{ {
WebGlyphWidth width; WebGlyphWidth width = UNINITIALIZED_GLYPH_WIDTH;
BOOL errorResult; BOOL errorResult;
if (map == 0){ if (map == 0){
...@@ -169,12 +169,17 @@ static inline WebGlyphWidth widthForGlyph (WebTextRenderer *renderer, WidthMap * ...@@ -169,12 +169,17 @@ static inline WebGlyphWidth widthForGlyph (WebTextRenderer *renderer, WidthMap *
double thisTime = CFAbsoluteTimeGetCurrent() - startTime; double thisTime = CFAbsoluteTimeGetCurrent() - startTime;
totalCGGetAdvancesTime += thisTime; totalCGGetAdvancesTime += thisTime;
#endif #endif
return ((WebGlyphWidth *)map->widths)[glyph-map->startRange]; width = ((WebGlyphWidth *)map->widths)[glyph-map->startRange];
} }
return width;
} }
return widthForGlyph (renderer, map->next, glyph); if (width == UNINITIALIZED_GLYPH_WIDTH)
width = widthForGlyph (renderer, map->next, glyph);
if (renderer->isFixedPitch && width != 0)
return renderer->fixedWidth;
return width;
} }
...@@ -352,7 +357,11 @@ - (void)convertCharacters: (const UniChar *)characters length: (unsigned)numChar ...@@ -352,7 +357,11 @@ - (void)convertCharacters: (const UniChar *)characters length: (unsigned)numChar
ATSUDisposeStyle(style); ATSUDisposeStyle(style);
spaceGlyph = nonGlyphID; spaceGlyph = nonGlyphID;
isFixedPitch = [font isFixedPitch];
if (isFixedPitch)
fixedWidth = CEIL_TO_INT([font widthOfString: @"X"]);
return self; return self;
} }
......
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