aboutsummaryrefslogtreecommitdiff
path: root/src/scintilla_backports/6182_7c132e9340ce.patch
blob: 4eaca03a4ffcc8de5e3b032e9cbb053d46bcac41 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# HG changeset patch
# User Neil <nyamatongwe@gmail.com>
# 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<int>(surface->Ascent(ctrlCharsFont) -
-		surface->InternalLeading(ctrlCharsFont));
+	const int normalCharHeight = static_cast<int>(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<unsigned int>(surface.Ascent(font));
 	descent = static_cast<unsigned int>(surface.Descent(font));
+	capitalHeight = surface.Ascent(font) - surface.InternalLeading(font);
 	aveCharWidth = surface.AverageCharWidth(font);
 	spaceWidth = surface.WidthChar(font, ' ');
 }