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
84ea75f1
Commit
84ea75f1
authored
Oct 24, 2012
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Oct 26, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdiplus: GdipGetLogFont should use device scale and transform when appropriate.
parent
71eb1644
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
19 deletions
+32
-19
font.c
dlls/gdiplus/font.c
+25
-5
font.c
dlls/gdiplus/tests/font.c
+7
-14
No files found.
dlls/gdiplus/font.c
View file @
84ea75f1
...
...
@@ -454,18 +454,22 @@ GpStatus WINGDIPAPI GdipGetLogFontA(GpFont *font, GpGraphics *graphics,
*/
GpStatus
WINGDIPAPI
GdipGetLogFontW
(
GpFont
*
font
,
GpGraphics
*
graphics
,
LOGFONTW
*
lf
)
{
REAL
height
;
REAL
angle
,
rel_height
,
height
;
GpMatrix
*
matrix
;
GpPointF
pt
[
3
];
TRACE
(
"(%p, %p, %p)
\n
"
,
font
,
graphics
,
lf
);
if
(
!
font
||
!
graphics
||
!
lf
)
return
InvalidParameter
;
GdipCloneMatrix
(
graphics
->
worldtrans
,
&
matrix
);
if
(
font
->
unit
==
UnitPixel
)
{
height
=
units_to_pixels
(
font
->
emSize
,
graphics
->
unit
,
graphics
->
yres
);
if
(
graphics
->
unit
!=
UnitDisplay
)
height
*=
graphics
->
scale
;
GdipScaleMatrix
(
matrix
,
graphics
->
scale
,
graphics
->
scale
,
MatrixOrderAppend
)
;
}
else
{
...
...
@@ -475,10 +479,26 @@ GpStatus WINGDIPAPI GdipGetLogFontW(GpFont *font, GpGraphics *graphics, LOGFONTW
height
=
units_to_pixels
(
font
->
emSize
,
font
->
unit
,
graphics
->
yres
);
}
lf
->
lfHeight
=
-
(
height
+
0
.
5
);
pt
[
0
].
X
=
0
.
0
;
pt
[
0
].
Y
=
0
.
0
;
pt
[
1
].
X
=
1
.
0
;
pt
[
1
].
Y
=
0
.
0
;
pt
[
2
].
X
=
0
.
0
;
pt
[
2
].
Y
=
1
.
0
;
GdipTransformMatrixPoints
(
matrix
,
pt
,
3
);
angle
=
-
gdiplus_atan2
((
pt
[
1
].
Y
-
pt
[
0
].
Y
),
(
pt
[
1
].
X
-
pt
[
0
].
X
));
rel_height
=
sqrt
((
pt
[
2
].
Y
-
pt
[
0
].
Y
)
*
(
pt
[
2
].
Y
-
pt
[
0
].
Y
)
+
(
pt
[
2
].
X
-
pt
[
0
].
X
)
*
(
pt
[
2
].
X
-
pt
[
0
].
X
));
GdipDeleteMatrix
(
matrix
);
lf
->
lfHeight
=
-
gdip_round
(
height
*
rel_height
);
lf
->
lfWidth
=
0
;
lf
->
lfEscapement
=
0
;
lf
->
lfOrientation
=
0
;
lf
->
lfEscapement
=
lf
->
lfOrientation
=
gdip_round
((
angle
/
M_PI
)
*
1800
.
0
);
if
(
lf
->
lfEscapement
<
0
)
{
lf
->
lfEscapement
+=
3600
;
lf
->
lfOrientation
+=
3600
;
}
lf
->
lfWeight
=
font
->
otm
.
otmTextMetrics
.
tmWeight
;
lf
->
lfItalic
=
font
->
otm
.
otmTextMetrics
.
tmItalic
?
1
:
0
;
lf
->
lfUnderline
=
font
->
otm
.
otmTextMetrics
.
tmUnderlined
?
1
:
0
;
...
...
dlls/gdiplus/tests/font.c
View file @
84ea75f1
...
...
@@ -26,6 +26,7 @@
#include "wine/test.h"
#define expect(expected, got) ok(got == expected, "Expected %d, got %d\n", expected, got)
#define expect_(expected, got, precision) ok(abs((expected) - (got)) <= (precision), "Expected %d, got %d\n", (expected), (got))
#define expectf_(expected, got, precision) ok(fabs((expected) - (got)) <= (precision), "Expected %f, got %f\n", (expected), (got))
#define expectf(expected, got) expectf_((expected), (got), 0.001)
...
...
@@ -904,7 +905,6 @@ todo_wine
expect
(
Ok
,
status
);
status
=
GdipGetLogFontA
(
font
,
graphics
,
&
lf
);
expect
(
Ok
,
status
);
todo_wine
expect
(
-
300
,
lf
.
lfHeight
);
expect
(
0
,
lf
.
lfWidth
);
expect
(
0
,
lf
.
lfEscapement
);
...
...
@@ -954,13 +954,10 @@ todo_wine
expect
(
Ok
,
status
);
status
=
GdipGetLogFontA
(
font
,
graphics
,
&
lf
);
expect
(
Ok
,
status
);
todo_wine
expect
(
-
300
,
lf
.
lfHeight
);
expect
(
0
,
lf
.
lfWidth
);
todo_wine
expect
(
3151
,
lf
.
lfEscapement
);
todo_wine
expect
(
3151
,
lf
.
lfOrientation
);
expect_
(
3151
,
lf
.
lfEscapement
,
1
);
expect_
(
3151
,
lf
.
lfOrientation
,
1
);
status
=
GdipGetFontHeight
(
font
,
graphics
,
&
height
);
expect
(
Ok
,
status
);
expectf
(
120
.
703125
,
height
);
...
...
@@ -1010,10 +1007,8 @@ todo_wine
todo_wine
expect
(
1032
,
lf
.
lfHeight
);
expect
(
0
,
lf
.
lfWidth
);
todo_wine
expect
(
3099
,
lf
.
lfEscapement
);
todo_wine
expect
(
3099
,
lf
.
lfOrientation
);
expect_
(
3099
,
lf
.
lfEscapement
,
1
);
expect_
(
3099
,
lf
.
lfOrientation
,
1
);
status
=
GdipGetFontHeight
(
font
,
graphics
,
&
height
);
expect
(
Ok
,
status
);
expectf
(
120
.
703125
,
height
);
...
...
@@ -1063,10 +1058,8 @@ todo_wine
todo_wine
expect
(
1032
,
lf
.
lfHeight
);
expect
(
0
,
lf
.
lfWidth
);
todo_wine
expect
(
3099
,
lf
.
lfEscapement
);
todo_wine
expect
(
3099
,
lf
.
lfOrientation
);
expect_
(
3099
,
lf
.
lfEscapement
,
1
);
expect_
(
3099
,
lf
.
lfOrientation
,
1
);
status
=
GdipGetFontHeight
(
font
,
graphics
,
&
height
);
expect
(
Ok
,
status
);
expectf
(
120
.
703125
,
height
);
...
...
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