Skip to content
This repository was archived by the owner on Mar 7, 2025. It is now read-only.

Commit 8de5eef

Browse files
filipnavaraakoeplinger
authored andcommitted
Bump minimum version of Pango and add C version of MeasureString_Wrapping_Dots test (#574)
* Add C version of MeasureString_Wrapping_Dots test * Bump minimum Pango version to 1.40.14 to get fix for line breaking bug This is one funky bug... It works fine on macOS with Pango 1.42 and it doesn't work on Ubuntu 16.04 with Pango 1.38.1. The problem is that on Ubuntu the "." characters are not marked with "char_break" logical attribute so the Pango layout fails to insert a line break. On macOS all the characters have the "char_break" logical attribute and it returns the correct result. The fix in Pango was implemented in GNOME/pango@e8316c1#diff-3d8168315b940c3e9d29a4991735a9a7 so any version newer than 1.40.14 is fine.
1 parent 4d832c7 commit 8de5eef

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

configure.ac

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ CAIRO_CFLAGS="`pkg-config --cflags cairo `"
5858
cairo_info="`pkg-config --modversion cairo ` (system)"
5959
GDIPLUS_PKG_REQ="cairo"
6060

61-
PANGO_REQUIRED_VERSION="1.38"
61+
PANGO_REQUIRED_VERSION="1.40.14"
6262
if test $text_v = "pango"; then
6363
PKG_CHECK_MODULES(PANGO, pango >= $PANGO_REQUIRED_VERSION)
6464
fi

tests/testtext.c

+13
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ static void test_measure_string(void)
4646
const WCHAR teststring1[] = { 'M', '\n', '\n', 'M', 0 };
4747
const WCHAR teststring2[] = { ' ', L'\u2003', ' ', 0 }; // Space, em space, space
4848
const WCHAR teststring3[] = { L'\u2003', L'\u2003', L'\u2003', 0 }; // em spaces
49+
const WCHAR teststringdots[] = { 't','h','i','s',' ','i','s',' ','r','e','a','l','l','y',' ','l','o','n','g',' ','t','e','x','t','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.',' ','w','i','t','h',' ','a',' ','l','o','t',' ','o',' ','p','e','r','i','o','d','s','.' };
4950
int glyphs;
5051
int lines;
5152
const SHORT fontSize = 10;
@@ -178,6 +179,18 @@ static void test_measure_string(void)
178179
expect (1, lines);
179180
expectf ((double)fontSize, bounds.Width); // An em-space should be the same width as the font size.
180181

182+
// MonoTests.System.Drawing.GraphicsTest.MeasureString_Wrapping_Dots
183+
GdipDeleteStringFormat (format);
184+
status = GdipCreateStringFormat (0, 0, &format);
185+
expect (Ok, status);
186+
GdipSetStringFormatAlign (format, StringAlignmentCenter);
187+
set_rect_empty (&rect);
188+
rect.Width = 80;
189+
rect.Height = 10000;
190+
status = GdipMeasureString (graphics, teststringdots, sizeof(teststringdots) / sizeof(teststringdots[0]), font, &rect, format, &bounds, &glyphs, &lines);
191+
expect (Ok, status);
192+
ok (bounds.Width <= 80, "GdipMeasureString is overstepping boundaries (%f <= 80)\n", bounds.Width);
193+
181194
GdipDeleteGraphics (graphics);
182195
GdipDeleteFont (font);
183196
GdipDeleteFontFamily (family);

0 commit comments

Comments
 (0)