Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
c1da4fb1
Commit
c1da4fb1
authored
May 25, 2023
by
David Kahurani
Committed by
Alexandre Julliard
May 29, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdiplus: Handle Windows style newline.
Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=54962
Signed-off-by:
David Kahurani
<
k.kahurani@gmail.com
>
parent
7ab7e299
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
6 deletions
+34
-6
graphics.c
dlls/gdiplus/graphics.c
+27
-6
graphics.c
dlls/gdiplus/tests/graphics.c
+7
-0
No files found.
dlls/gdiplus/graphics.c
View file @
c1da4fb1
...
...
@@ -5186,7 +5186,7 @@ GpStatus gdip_format_string(HDC hdc,
INT
*
hotkeyprefix_offsets
=
NULL
;
INT
hotkeyprefix_count
=
0
;
INT
hotkeyprefix_pos
=
0
,
hotkeyprefix_end_pos
=
0
;
BOOL
seen_prefix
=
FALSE
;
BOOL
seen_prefix
=
FALSE
,
unixstyle_newline
=
TRUE
;
if
(
length
==
-
1
)
length
=
lstrlenW
(
string
);
...
...
@@ -5259,9 +5259,20 @@ GpStatus gdip_format_string(HDC hdc,
if
(
fit
==
0
)
break
;
for
(
lret
=
0
;
lret
<
fit
;
lret
++
)
for
(
lret
=
0
;
lret
<
fit
;
lret
++
)
{
if
(
*
(
stringdup
+
sum
+
lret
)
==
'\n'
)
break
;
{
unixstyle_newline
=
TRUE
;
break
;
}
if
(
*
(
stringdup
+
sum
+
lret
)
==
'\r'
&&
lret
+
1
<
fit
&&
*
(
stringdup
+
sum
+
lret
+
1
)
==
'\n'
)
{
unixstyle_newline
=
FALSE
;
break
;
}
}
/* Line break code (may look strange, but it imitates windows). */
if
(
lret
<
fit
)
...
...
@@ -5332,9 +5343,19 @@ GpStatus gdip_format_string(HDC hdc,
if
(
stat
!=
Ok
)
break
;
sum
+=
fit
+
(
lret
<
fitcpy
?
1
:
0
);
height
+=
size
.
cy
;
lineno
++
;
if
(
unixstyle_newline
)
{
height
+=
size
.
cy
;
lineno
++
;
sum
+=
fit
+
(
lret
<
fitcpy
?
1
:
0
);
}
else
{
height
+=
size
.
cy
;
lineno
++
;
sum
+=
fit
+
(
lret
<
fitcpy
?
2
:
0
);
}
hotkeyprefix_pos
=
hotkeyprefix_end_pos
;
...
...
dlls/gdiplus/tests/graphics.c
View file @
c1da4fb1
...
...
@@ -3197,6 +3197,7 @@ static void test_string_functions(void)
HDC
hdc
=
GetDC
(
hwnd
);
const
WCHAR
teststring
[]
=
L"MM M
\n
M"
;
const
WCHAR
teststring2
[]
=
L"j"
;
const
WCHAR
teststring3
[]
=
L"MM M
\r\n
M
\0
"
;
REAL
char_width
,
char_height
;
INT
codepointsfitted
,
linesfilled
;
GpStringFormat
*
format
;
...
...
@@ -3268,6 +3269,12 @@ static void test_string_functions(void)
status
=
GdipMeasureString
(
graphics
,
teststring
,
6
,
font
,
&
rc
,
NULL
,
&
bounds
,
&
codepointsfitted
,
NULL
);
expect
(
Ok
,
status
);
/* new line handling */
status
=
GdipMeasureString
(
graphics
,
teststring3
,
-
1
,
font
,
&
rc
,
NULL
,
&
bounds
,
&
codepointsfitted
,
&
linesfilled
);
expect
(
Ok
,
status
);
expect
(
7
,
codepointsfitted
);
expect
(
2
,
linesfilled
);
status
=
GdipMeasureString
(
graphics
,
teststring
,
1
,
font
,
&
rc
,
NULL
,
&
char_bounds
,
&
codepointsfitted
,
&
linesfilled
);
expect
(
Ok
,
status
);
expectf
(
0
.
0
,
char_bounds
.
X
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment