Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/mcs/class
diff options
context:
space:
mode:
authorKarl <karl@scowencomputers.co.nz>2018-07-06 03:43:50 +0300
committerKarl <contact@scowencomputers.co.nz>2020-01-13 07:54:00 +0300
commite586084ae895f1b6a9f713f75d9c248b9787476d (patch)
treebd1b368db0e663dcb06ae7bb49d76fd093c1fc06 /mcs/class
parent3d9e4fa7f4b039af6e2249e7349445aeaaaa1a0f (diff)
Rearrage slightly, fix kerning.
Diffstat (limited to 'mcs/class')
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/Line.cs24
1 files changed, 15 insertions, 9 deletions
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/Line.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/Line.cs
index 008a2aabc4e..790e60e3ec4 100644
--- a/mcs/class/System.Windows.Forms/System.Windows.Forms/Line.cs
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/Line.cs
@@ -738,14 +738,16 @@ namespace System.Windows.Forms
// Make sure to set the last width of the line before wrapping
widths[pos + 1] = newWidth;
- if (wrap_pos > pos && Char.IsWhiteSpace(c)) {
- while (wrap_pos < text.Length && Char.IsWhiteSpace(text[wrap_pos]) && text[wrap_pos] != '\t') {
- wrap_pos++;
- }
- pos++;
- wrapped = true; // don't try pulling more into this line, but keep looping to deal with the rest of the widths and tags
- } else {
+ if (Char.IsWhiteSpace(c)) {
if (wrap_pos > pos) {
+ while (wrap_pos < text.Length && Char.IsWhiteSpace(text[wrap_pos]) && text[wrap_pos] != '\t') {
+ wrap_pos++;
+ }
+ pos++;
+ wrapped = true; // don't try pulling more into this line, but keep looping to deal with the rest of the widths and tags
+ }
+ } else {
+ if (wrap_pos > pos && pos > 0) {
// We're at a dash (otherwise we'd be above), but don't have room to fit it in.
// Wrap at the previous wrap point if possible.
wrap_pos = prev_wrap_pos > 0 ? prev_wrap_pos : pos;
@@ -857,6 +859,10 @@ namespace System.Windows.Forms
}
}
+ if (pos != currentFontStart) {
+ CheckKerning(g, currentFont, currentFontStart, pos - currentFontStart);
+ }
+
if (lastTab != null) {
ProcessLastTab(lastTab, lastTabPos, pos);
lastTab = null;
@@ -895,7 +901,7 @@ namespace System.Windows.Forms
private void CheckKerning(Graphics g, Font font, int start, int length) {
if (length > 1) {
- if (!kerning_fonts.ContainsKey (tags.Font.GetHashCode ())) {
+ if (!kerning_fonts.ContainsKey (font.GetHashCode ())) {
// Check whether kerning takes place for this string and font.
var partText = text.ToString(start, length);
var realSize = TextBoxTextRenderer.MeasureText(g, partText, font);
@@ -905,7 +911,7 @@ namespace System.Windows.Forms
float sumWidth = widths[textLength + start + 1];
if (realWidth != sumWidth)
{
- kerning_fonts.Add(tags.Font.GetHashCode (), true);
+ kerning_fonts.Add(font.GetHashCode (), true);
// Using a slightly incorrect width this time around isn't that bad. All that happens
// is that the cursor is a pixel or two off until the next character is typed. It's
// the accumulation of pixel after pixel that causes display problems.