Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
44e98392
Commit
44e98392
authored
Aug 15, 2007
by
Evan Stade
Committed by
Alexandre Julliard
Aug 16, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdiplus: Handle empty layout rectangle in GdipMeasureString.
parent
d4107db6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
3 deletions
+13
-3
graphics.c
dlls/gdiplus/graphics.c
+13
-3
No files found.
dlls/gdiplus/graphics.c
View file @
44e98392
...
...
@@ -18,6 +18,7 @@
#include <stdarg.h>
#include <math.h>
#include <limits.h>
#include "windef.h"
#include "winbase.h"
...
...
@@ -1716,6 +1717,10 @@ GpStatus WINGDIPAPI GdipGetWorldTransform(GpGraphics *graphics, GpMatrix *matrix
return
Ok
;
}
/* Find the smallest rectangle that bounds the text when it is printed in rect
* according to the format options listed in format. If rect has 0 width and
* height, then just find the smallest rectangle that bounds the text when it's
* printed at location (rect->X, rect-Y). */
GpStatus
WINGDIPAPI
GdipMeasureString
(
GpGraphics
*
graphics
,
GDIPCONST
WCHAR
*
string
,
INT
length
,
GDIPCONST
GpFont
*
font
,
GDIPCONST
RectF
*
rect
,
GDIPCONST
GpStringFormat
*
format
,
RectF
*
bounds
,
...
...
@@ -1723,7 +1728,8 @@ GpStatus WINGDIPAPI GdipMeasureString(GpGraphics *graphics,
{
HFONT
oldfont
;
WCHAR
*
stringdup
;
INT
sum
=
0
,
height
=
0
,
fit
,
fitcpy
,
max_width
=
0
,
i
,
j
,
lret
,
nwidth
;
INT
sum
=
0
,
height
=
0
,
fit
,
fitcpy
,
max_width
=
0
,
i
,
j
,
lret
,
nwidth
,
nheight
;
SIZE
size
;
if
(
!
graphics
||
!
string
||
!
font
||
!
rect
)
...
...
@@ -1744,6 +1750,10 @@ GpStatus WINGDIPAPI GdipMeasureString(GpGraphics *graphics,
oldfont
=
SelectObject
(
graphics
->
hdc
,
CreateFontIndirectW
(
&
font
->
lfw
));
nwidth
=
roundr
(
rect
->
Width
);
nheight
=
roundr
(
rect
->
Height
);
if
((
nwidth
==
0
)
&&
(
nheight
==
0
))
nwidth
=
nheight
=
INT_MAX
;
for
(
i
=
0
,
j
=
0
;
i
<
length
;
i
++
){
if
(
!
isprintW
(
string
[
i
])
&&
(
string
[
i
]
!=
'\n'
))
...
...
@@ -1796,7 +1806,7 @@ GpStatus WINGDIPAPI GdipMeasureString(GpGraphics *graphics,
height
+=
size
.
cy
;
max_width
=
max
(
max_width
,
size
.
cx
);
if
(
height
>
roundr
(
rect
->
Height
)
)
if
(
height
>
nheight
)
break
;
/* Stop if this was a linewrap (but not if it was a linebreak). */
...
...
@@ -1807,7 +1817,7 @@ GpStatus WINGDIPAPI GdipMeasureString(GpGraphics *graphics,
bounds
->
X
=
rect
->
X
;
bounds
->
Y
=
rect
->
Y
;
bounds
->
Width
=
(
REAL
)
max_width
;
bounds
->
Height
=
min
((
REAL
)
height
,
rect
->
H
eight
);
bounds
->
Height
=
(
REAL
)
min
(
height
,
nh
eight
);
DeleteObject
(
SelectObject
(
graphics
->
hdc
,
oldfont
));
...
...
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