# HG changeset patch # User Neil # Date 1491982645 -36000 # Node ID 7c132e9340ce3425120c0c84820461d238f0560a # Parent 75b60222c770944068ee3492a39e82a29c775da6 For speed, store height of capital letters in FontMeasurements so not recalculated for every character blob. diff -r 75b60222c770 -r 7c132e9340ce src/EditView.cxx --- a/src/EditView.cxx Tue Apr 11 18:11:18 2017 +1000 +++ b/src/EditView.cxx Wed Apr 12 17:37:25 2017 +1000 @@ -818,8 +818,7 @@ surface->FillRectangle(rcSegment, textBack); } FontAlias ctrlCharsFont = vsDraw.styles[STYLE_CONTROLCHAR].font; - int normalCharHeight = static_cast(surface->Ascent(ctrlCharsFont) - - surface->InternalLeading(ctrlCharsFont)); + const int normalCharHeight = static_cast(ceil(vsDraw.styles[STYLE_CONTROLCHAR].capitalHeight)); PRectangle rcCChar = rcSegment; rcCChar.left = rcCChar.left + 1; rcCChar.top = rcSegment.top + vsDraw.maxAscent - normalCharHeight; diff -r 75b60222c770 -r 7c132e9340ce src/Style.h --- a/src/Style.h Tue Apr 11 18:11:18 2017 +1000 +++ b/src/Style.h Wed Apr 12 17:37:25 2017 +1000 @@ -46,6 +46,7 @@ struct FontMeasurements { unsigned int ascent; unsigned int descent; + XYPOSITION capitalHeight; // Top of capital letter to baseline: ascent - internal leading XYPOSITION aveCharWidth; XYPOSITION spaceWidth; int sizeZoomed; diff -r 75b60222c770 -r 7c132e9340ce src/ViewStyle.cxx --- a/src/ViewStyle.cxx Tue Apr 11 18:11:18 2017 +1000 +++ b/src/ViewStyle.cxx Wed Apr 12 17:37:25 2017 +1000 @@ -86,6 +86,7 @@ ascent = static_cast(surface.Ascent(font)); descent = static_cast(surface.Descent(font)); + capitalHeight = surface.Ascent(font) - surface.InternalLeading(font); aveCharWidth = surface.AverageCharWidth(font); spaceWidth = surface.WidthChar(font, ' '); }