The attached test case shows the using text-rendering: optimizelegibility can cause lines to break too late, and the effect that it has on left-aligned and on justified text. Perhaps there is a discrepancy between how text is measured for the purpose of line breaking and how itβs actually rendered afterwards.
Created attachment 45282 [details] Test case
<rdar://problem/7488126>
Created attachment 46010 [details] Allow trailing space to affect kerning when measuring a word
style-queue ran check-webkit-style on attachment 46010 [details] without any errors.
Comment on attachment 46010 [details] Allow trailing space to affect kerning when measuring a word > + TextRenderingMode textRenderingMode = f.fontDescription().textRenderingMode(); > + // Non-zero only when kerning is enabled, in which case we measure words with their trailing > + // space, then subtract its width. > + int wordTrailingSpaceWidth = textRenderingMode == OptimizeLegibility || textRenderingMode == GeometricPrecision ? f.spaceWidth() + wordSpacing : 0; I think it would be clearer to have a function named allowsKerning or something like that. It could contain: TextRenderingMode textRenderingMode = f.fontDescription().textRenderingMode(); textRenderingMode == OptimizeLegibility || textRenderingMode == GeometricPrecision Then you could saw: wordTrailingSpaceWidth = allowsKerning(f) ? f.spaceWidth() + wordSpacing : 0; Maybe there's a better name than "allows kerning", though.
(In reply to comment #5) > (From update of attachment 46010 [details]) > > + TextRenderingMode textRenderingMode = f.fontDescription().textRenderingMode(); > > + // Non-zero only when kerning is enabled, in which case we measure words with their trailing > > + // space, then subtract its width. > > + int wordTrailingSpaceWidth = textRenderingMode == OptimizeLegibility || textRenderingMode == GeometricPrecision ? f.spaceWidth() + wordSpacing : 0; > > I think it would be clearer to have a function named allowsKerning or something > like that. It could contain: > > TextRenderingMode textRenderingMode = > f.fontDescription().textRenderingMode(); > textRenderingMode == OptimizeLegibility || textRenderingMode == > GeometricPrecision > > Then you could saw: > > wordTrailingSpaceWidth = allowsKerning(f) ? f.spaceWidth() + wordSpacing : > 0; > > Maybe there's a better name than "allows kerning", though. I intend to add two Font methods (one for kerning and one for ligatures) and deploy them here and in the many other places that currently access the TextRenderingMode.
Fixed in <http://trac.webkit.org/projects/webkit/changeset/52889>.