diff --git a/AppKit/CPTextView/CPLayoutManager.j b/AppKit/CPTextView/CPLayoutManager.j index 103e19921..6179243b9 100644 --- a/AppKit/CPTextView/CPLayoutManager.j +++ b/AppKit/CPTextView/CPLayoutManager.j @@ -1229,6 +1229,10 @@ var _objectsInRange = function(aList, aRange) } } +// The spacings with kerning/ligatures are recalculated here for the visible part +// See comment in layoutGlyphsInLayoutManager: of CPSimpleTypesetter +// This gives an overall speed imrovement of ~20% in my testing (depending on text size / view size of course) + - (CPArray)glyphFrames { if (!_exactFramesCalculated && _glyphsFrames && _runs && _runs.length > 0) diff --git a/AppKit/CPTextView/CPTypesetter.j b/AppKit/CPTextView/CPTypesetter.j index e8946fcfc..418bfbb4e 100644 --- a/AppKit/CPTextView/CPTypesetter.j +++ b/AppKit/CPTextView/CPTypesetter.j @@ -318,6 +318,9 @@ var CPSystemTypesetterFactory, var currentCharCode = theString.charCodeAt(glyphIndex), charStr = theString.charAt(glyphIndex), + // this is ignoring kerning and ligatures but 100x faster than calculating the full string + // we cut corners here and do the exact calculation in - glyphFrames of _CPLineFragment (CPLayoutManager.j) + // this gives an overall speed imrovement of ~20% in my testing (depending on text size / view size of course) charWidth = [charStr sizeWithFont:currentFont inWidth:NULL].width, rangeWidth = prevRangeWidth + charWidth;