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
12668f5e
Commit
12668f5e
authored
Oct 31, 1999
by
Francis Beaudet
Committed by
Alexandre Julliard
Oct 31, 1999
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Return correct height and width for stock fonts in GetObject.
parent
6efcd9d8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
96 additions
and
0 deletions
+96
-0
gdiobj.c
objects/gdiobj.c
+96
-0
No files found.
objects/gdiobj.c
View file @
12668f5e
...
...
@@ -26,6 +26,7 @@
#include "debugtools.h"
#include "gdi.h"
#include "tweak.h"
#include "winuser.h"
DEFAULT_DEBUG_CHANNEL
(
gdi
)
...
...
@@ -236,6 +237,80 @@ static void ReadFontInformation(
}
/***********************************************************************
* Because the stock fonts have their structure initialized with
* a height of 0 to keep them independent of mapping mode, simply
* returning the LOGFONT as is will not work correctly.
* These "FixStockFontSizeXXX()" methods will get the correct
* size for the fonts.
*/
static
void
GetFontMetrics
(
HFONT
handle
,
LPTEXTMETRICA
lptm
)
{
HDC
hdc
=
GetDC
((
HWND
)
0
);
HFONT
hOldFont
;
hOldFont
=
(
HFONT
)
SelectObject
(
hdc
,
handle
);
GetTextMetricsA
(
hdc
,
lptm
);
SelectObject
(
hdc
,
hOldFont
);
ReleaseDC
((
HWND
)
0
,
hdc
);
}
static
inline
void
FixStockFontSize16
(
HFONT
handle
,
INT16
count
,
LPVOID
buffer
)
{
TEXTMETRICA
tm
;
LOGFONT16
*
pLogFont
=
(
LOGFONT16
*
)
buffer
;
/*
* Was the lfHeight field copied (it's the first field)?
* If it was and it was null, replace the height.
*/
if
(
(
count
>=
2
*
sizeof
(
INT16
))
&&
(
pLogFont
->
lfHeight
==
0
)
)
{
GetFontMetrics
(
handle
,
&
tm
);
pLogFont
->
lfHeight
=
tm
.
tmHeight
;
pLogFont
->
lfWidth
=
tm
.
tmAveCharWidth
;
}
}
static
inline
void
FixStockFontSizeA
(
HFONT
handle
,
INT
count
,
LPVOID
buffer
)
{
TEXTMETRICA
tm
;
LOGFONTA
*
pLogFont
=
(
LOGFONTA
*
)
buffer
;
/*
* Was the lfHeight field copied (it's the first field)?
* If it was and it was null, replace the height.
*/
if
(
(
count
>=
2
*
sizeof
(
INT
))
&&
(
pLogFont
->
lfHeight
==
0
)
)
{
GetFontMetrics
(
handle
,
&
tm
);
pLogFont
->
lfHeight
=
tm
.
tmHeight
;
pLogFont
->
lfWidth
=
tm
.
tmAveCharWidth
;
}
}
/**
* Since the LOGFONTA and LOGFONTW structures are identical up to the
* lfHeight member (the one of interest in this case) we simply define
* the W version as the A version.
*/
#define FixStockFontSizeW FixStockFontSizeA
/***********************************************************************
* GDI_Init
*
* GDI initialization.
...
...
@@ -450,6 +525,13 @@ INT16 WINAPI GetObject16( HANDLE16 handle, INT16 count, LPVOID buffer )
break
;
case
FONT_MAGIC
:
result
=
FONT_GetObject16
(
(
FONTOBJ
*
)
ptr
,
count
,
buffer
);
/*
* Fix the LOGFONT structure for the stock fonts
*/
if
(
(
handle
>=
FIRST_STOCK_HANDLE
)
&&
(
handle
<=
LAST_STOCK_HANDLE
)
)
FixStockFontSize16
(
handle
,
count
,
buffer
);
break
;
case
PALETTE_MAGIC
:
result
=
PALETTE_GetObject
(
(
PALETTEOBJ
*
)
ptr
,
count
,
buffer
);
...
...
@@ -489,6 +571,13 @@ INT WINAPI GetObjectA( HANDLE handle, INT count, LPVOID buffer )
break
;
case
FONT_MAGIC
:
result
=
FONT_GetObjectA
(
(
FONTOBJ
*
)
ptr
,
count
,
buffer
);
/*
* Fix the LOGFONT structure for the stock fonts
*/
if
(
(
handle
>=
FIRST_STOCK_HANDLE
)
&&
(
handle
<=
LAST_STOCK_HANDLE
)
)
FixStockFontSizeA
(
handle
,
count
,
buffer
);
break
;
case
PALETTE_MAGIC
:
result
=
PALETTE_GetObject
(
(
PALETTEOBJ
*
)
ptr
,
count
,
buffer
);
...
...
@@ -530,6 +619,13 @@ INT WINAPI GetObjectW( HANDLE handle, INT count, LPVOID buffer )
break
;
case
FONT_MAGIC
:
result
=
FONT_GetObjectW
(
(
FONTOBJ
*
)
ptr
,
count
,
buffer
);
/*
* Fix the LOGFONT structure for the stock fonts
*/
if
(
(
handle
>=
FIRST_STOCK_HANDLE
)
&&
(
handle
<=
LAST_STOCK_HANDLE
)
)
FixStockFontSizeW
(
handle
,
count
,
buffer
);
break
;
case
PALETTE_MAGIC
:
result
=
PALETTE_GetObject
(
(
PALETTEOBJ
*
)
ptr
,
count
,
buffer
);
...
...
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