Skip to content

Commit eeeb7dd

Browse files
authored
Ceil measured text sizes in WinForms (#1659) (#1691)
1 parent 08cb274 commit eeeb7dd

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ All notable changes to this project will be documented in this file.
113113
- OpenStreetMap example (#1642)
114114
- Incorrect clipping in TwoColorAreaSeries (#1678)
115115
- ScreenMin and ScreenMax on Horizontal and Vertical Axes depends on plot bounds (#1652)
116+
- Windows Forms clipping last line of measured text (#1659)
116117

117118
## [2.0.0] - 2019-10-19
118119
### Added

Source/Examples/ExampleLibrary/Issues/Issues.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2359,6 +2359,19 @@ public static PlotModel ZeroCrossingWithInsertHorizontalAxisAndTransparentBorder
23592359
return plotModel1;
23602360
}
23612361

2362+
[Example("#1659: Last line of series titles in legend not displayed in Chinese on WinForms (Closed)")]
2363+
public static PlotModel LastLineOfSeriesTitlesNotDisplayedInChineseOnWindows()
2364+
{
2365+
var plot = new PlotModel() { Title = "#1659: Last line of series titles in legend not displayed in Chinese on WinForms" };
2366+
2367+
plot.Legends.Add(new Legend() { LegendTitle = "漂亮的天鹅" });
2368+
plot.Series.Add(new FunctionSeries(x => x, 0, 1, 0.1, "漂亮的天鹅"));
2369+
plot.Series.Add(new FunctionSeries(x => x, 0, 1, 0.1, "漂亮的天鹅\n友好的天鹅"));
2370+
plot.Series.Add(new FunctionSeries(x => x, 0, 1, 0.1, "漂亮的天鹅\n友好的天鹅\n尼斯天鹅"));
2371+
2372+
return plot;
2373+
}
2374+
23622375
private class TimeSpanPoint
23632376
{
23642377
public TimeSpan X { get; set; }

Source/OxyPlot.WindowsForms/GraphicsRenderContext.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ public override OxySize MeasureText(string text, string fontFamily, double fontS
295295
{
296296
this.stringFormat.Alignment = StringAlignment.Near;
297297
this.stringFormat.LineAlignment = StringAlignment.Near;
298-
var size = this.g.MeasureString(text, font, int.MaxValue, this.stringFormat);
298+
var size = Ceiling(this.g.MeasureString(text, font, int.MaxValue, this.stringFormat));
299299
return new OxySize(size.Width, size.Height);
300300
}
301301
}

0 commit comments

Comments
 (0)