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
90265ac5
Commit
90265ac5
authored
Apr 03, 2008
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Apr 04, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdi32: Add a font scaling test when lfHeight == 0 and lfWidth != 0, make it pass under Wine.
parent
4f3dbb7f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
11 deletions
+26
-11
freetype.c
dlls/gdi32/freetype.c
+1
-2
font.c
dlls/gdi32/tests/font.c
+25
-9
No files found.
dlls/gdi32/freetype.c
View file @
90265ac5
...
...
@@ -3378,14 +3378,13 @@ found:
TRACE
(
"Chosen: %s %s (%s/%p:%ld)
\n
"
,
debugstr_w
(
family
->
FamilyName
),
debugstr_w
(
face
->
StyleName
),
face
->
file
,
face
->
font_data_ptr
,
face
->
face_index
);
ret
->
aveWidth
=
abs
(
lf
.
lfWidth
)
;
ret
->
aveWidth
=
height
?
abs
(
lf
.
lfWidth
)
:
0
;
if
(
!
face
->
scalable
)
{
/* Windows uses integer scaling factors for bitmap fonts */
INT
scale
,
scaled_height
;
if
(
height
!=
0
)
height
=
diff
;
else
height
=
0
;
height
+=
face
->
size
.
height
;
scale
=
(
height
+
face
->
size
.
height
-
1
)
/
face
->
size
.
height
;
...
...
dlls/gdi32/tests/font.c
View file @
90265ac5
...
...
@@ -158,7 +158,8 @@ static INT CALLBACK font_enum_proc(const LOGFONT *elf, const TEXTMETRIC *ntm, DW
return
1
;
/* continue enumeration */
}
static
void
test_font_metrics
(
HDC
hdc
,
HFONT
hfont
,
LONG
lfHeight
,
const
char
*
test_str
,
static
void
test_font_metrics
(
HDC
hdc
,
HFONT
hfont
,
LONG
lfHeight
,
LONG
lfWidth
,
const
char
*
test_str
,
INT
test_str_len
,
const
TEXTMETRICA
*
tm_orig
,
const
SIZE
*
size_orig
,
INT
width_of_A_orig
,
INT
scale_x
,
INT
scale_y
)
...
...
@@ -188,9 +189,14 @@ static void test_font_metrics(HDC hdc, HFONT hfont, LONG lfHeight, const char *t
ok
(
tm
.
tmAveCharWidth
==
tm_orig
->
tmAveCharWidth
*
scale_x
,
"%d != %d
\n
"
,
tm
.
tmAveCharWidth
,
tm_orig
->
tmAveCharWidth
*
scale_x
);
ok
(
tm
.
tmMaxCharWidth
==
tm_orig
->
tmMaxCharWidth
*
scale_x
,
"%d != %d
\n
"
,
tm
.
tmAveCharWidth
,
tm_orig
->
tmMaxCharWidth
*
scale_x
);
ok
(
lf
.
lfHeight
==
lfHeight
,
"lf %d != %d
\n
"
,
lf
.
lfHeight
,
lfHeight
);
if
(
lf
.
lfWidth
)
ok
(
lf
.
lfWidth
==
tm
.
tmAveCharWidth
,
"lf %d != tm %d
\n
"
,
lf
.
lfWidth
,
tm
.
tmAveCharWidth
);
ok
(
lf
.
lfHeight
==
lfHeight
,
"lf %d != %d
\n
"
,
lf
.
lfHeight
,
lfHeight
);
if
(
lf
.
lfHeight
)
{
if
(
lf
.
lfWidth
)
ok
(
lf
.
lfWidth
==
tm
.
tmAveCharWidth
,
"lf %d != tm %d
\n
"
,
lf
.
lfWidth
,
tm
.
tmAveCharWidth
);
}
else
ok
(
lf
.
lfWidth
==
lfWidth
,
"lf %d != %d
\n
"
,
lf
.
lfWidth
,
lfWidth
);
GetTextExtentPoint32A
(
hdc
,
test_str
,
test_str_len
,
&
size
);
...
...
@@ -213,7 +219,7 @@ static void test_bitmap_font(void)
HFONT
hfont
,
old_hfont
;
TEXTMETRICA
tm_orig
;
SIZE
size_orig
;
INT
ret
,
i
,
width_orig
,
height_orig
,
scale
;
INT
ret
,
i
,
width_orig
,
height_orig
,
scale
,
lfWidth
;
hdc
=
GetDC
(
0
);
...
...
@@ -229,8 +235,9 @@ static void test_bitmap_font(void)
trace
(
"found bitmap font %s, height %d
\n
"
,
bitmap_lf
.
lfFaceName
,
bitmap_lf
.
lfHeight
);
height_orig
=
bitmap_lf
.
lfHeight
;
hfont
=
create_font
(
"bitmap"
,
&
bitmap_lf
)
;
lfWidth
=
bitmap_lf
.
lfWidth
;
hfont
=
create_font
(
"bitmap"
,
&
bitmap_lf
);
old_hfont
=
SelectObject
(
hdc
,
hfont
);
ok
(
GetTextMetricsA
(
hdc
,
&
tm_orig
),
"GetTextMetricsA failed
\n
"
);
ok
(
GetTextExtentPoint32A
(
hdc
,
test_str
,
sizeof
(
test_str
),
&
size_orig
),
"GetTextExtentPoint32A failed
\n
"
);
...
...
@@ -238,6 +245,15 @@ static void test_bitmap_font(void)
SelectObject
(
hdc
,
old_hfont
);
DeleteObject
(
hfont
);
bitmap_lf
.
lfHeight
=
0
;
bitmap_lf
.
lfWidth
=
4
;
hfont
=
create_font
(
"bitmap"
,
&
bitmap_lf
);
test_font_metrics
(
hdc
,
hfont
,
0
,
4
,
test_str
,
sizeof
(
test_str
),
&
tm_orig
,
&
size_orig
,
width_orig
,
1
,
1
);
DeleteObject
(
hfont
);
bitmap_lf
.
lfHeight
=
height_orig
;
bitmap_lf
.
lfWidth
=
lfWidth
;
/* test fractional scaling */
for
(
i
=
1
;
i
<=
height_orig
*
3
;
i
++
)
{
...
...
@@ -249,7 +265,7 @@ static void test_bitmap_font(void)
nearest_height
=
scale
*
height_orig
;
/* XP allows not more than 10% deviation */
if
(
scale
>
1
&&
nearest_height
-
i
>
nearest_height
/
10
)
scale
--
;
test_font_metrics
(
hdc
,
hfont
,
bitmap_lf
.
lfHeight
,
test_str
,
sizeof
(
test_str
),
&
tm_orig
,
&
size_orig
,
width_orig
,
1
,
scale
);
test_font_metrics
(
hdc
,
hfont
,
bitmap_lf
.
lfHeight
,
0
,
test_str
,
sizeof
(
test_str
),
&
tm_orig
,
&
size_orig
,
width_orig
,
1
,
scale
);
DeleteObject
(
hfont
);
}
...
...
@@ -257,14 +273,14 @@ static void test_bitmap_font(void)
bitmap_lf
.
lfHeight
=
height_orig
*
2
;
bitmap_lf
.
lfWidth
*=
3
;
hfont
=
create_font
(
"3x2"
,
&
bitmap_lf
);
test_font_metrics
(
hdc
,
hfont
,
bitmap_lf
.
lfHeight
,
test_str
,
sizeof
(
test_str
),
&
tm_orig
,
&
size_orig
,
width_orig
,
3
,
2
);
test_font_metrics
(
hdc
,
hfont
,
bitmap_lf
.
lfHeight
,
0
,
test_str
,
sizeof
(
test_str
),
&
tm_orig
,
&
size_orig
,
width_orig
,
3
,
2
);
DeleteObject
(
hfont
);
/* test integer scaling 3x3 */
bitmap_lf
.
lfHeight
=
height_orig
*
3
;
bitmap_lf
.
lfWidth
=
0
;
hfont
=
create_font
(
"3x3"
,
&
bitmap_lf
);
test_font_metrics
(
hdc
,
hfont
,
bitmap_lf
.
lfHeight
,
test_str
,
sizeof
(
test_str
),
&
tm_orig
,
&
size_orig
,
width_orig
,
3
,
3
);
test_font_metrics
(
hdc
,
hfont
,
bitmap_lf
.
lfHeight
,
0
,
test_str
,
sizeof
(
test_str
),
&
tm_orig
,
&
size_orig
,
width_orig
,
3
,
3
);
DeleteObject
(
hfont
);
ReleaseDC
(
0
,
hdc
);
...
...
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