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
9f592208
Commit
9f592208
authored
Jan 22, 2002
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed no longer used average width calculation.
parent
de46c229
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
30 deletions
+3
-30
dialog.c
windows/dialog.c
+3
-30
No files found.
windows/dialog.c
View file @
9f592208
...
...
@@ -155,40 +155,13 @@ static BOOL DIALOG_GetCharSizeFromDC( HDC hDC, HFONT hFont, SIZE * pSize )
TEXTMETRICA
tm
;
memset
(
&
tm
,
0
,
sizeof
(
tm
));
if
(
hFont
)
hFontPrev
=
SelectFont
(
hDC
,
hFont
);
if
(
GetTextMetricsA
(
hDC
,
&
tm
))
if
(
(
Success
=
GetTextMetricsA
(
hDC
,
&
tm
)
))
{
pSize
->
cx
=
tm
.
tmAveCharWidth
;
pSize
->
cy
=
tm
.
tmHeight
;
/* if variable width font */
if
(
tm
.
tmPitchAndFamily
&
TMPF_FIXED_PITCH
)
{
SIZE
total
;
const
char
*
szAvgChars
=
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
;
/* Calculate a true average as opposed to the one returned
* by tmAveCharWidth. This works better when dealing with
* proportional spaced fonts and (more important) that's
* how Microsoft's dialog creation code calculates the size
* of the font
*/
if
(
GetTextExtentPointA
(
hDC
,
szAvgChars
,
sizeof
(
szAvgChars
),
&
total
))
{
/* round up */
pSize
->
cx
=
((
2
*
total
.
cx
/
sizeof
(
szAvgChars
))
+
1
)
/
2
;
Success
=
TRUE
;
}
}
else
{
Success
=
TRUE
;
}
/* Use the text metrics */
TRACE
(
"Using tm: %ldx%ld (dlg: %ld x %ld) (%s)
\n
"
,
TRACE
(
"Using tm: %ldx%ld (dlg: %ld x %ld) (%s)
\n
"
,
tm
.
tmAveCharWidth
,
tm
.
tmHeight
,
pSize
->
cx
,
pSize
->
cy
,
tm
.
tmPitchAndFamily
&
TMPF_FIXED_PITCH
?
"variable"
:
"fixed"
);
pSize
->
cx
=
tm
.
tmAveCharWidth
;
pSize
->
cy
=
tm
.
tmHeight
;
tm
.
tmPitchAndFamily
&
TMPF_FIXED_PITCH
?
"variable"
:
"fixed"
);
}
/* select the original font */
if
(
hFontPrev
)
SelectFont
(
hDC
,
hFontPrev
);
...
...
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