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
cd43ff16
Commit
cd43ff16
authored
Jun 11, 2010
by
Nikolay Sivov
Committed by
Alexandre Julliard
Jun 14, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdi32: Add CreateFontIndirectEx implementation.
parent
14d1b7a5
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
130 additions
and
13 deletions
+130
-13
font.c
dlls/gdi32/font.c
+67
-11
gdi32.spec
dlls/gdi32/gdi32.spec
+2
-2
font.c
dlls/gdi32/tests/font.c
+34
-0
wingdi.h
include/wingdi.h
+27
-0
No files found.
dlls/gdi32/font.c
View file @
cd43ff16
...
...
@@ -180,7 +180,7 @@ static void FONT_LogFontWToA( const LOGFONTW *fontW, LPLOGFONTA fontA )
static
void
FONT_EnumLogFontExWToA
(
const
ENUMLOGFONTEXW
*
fontW
,
LPENUMLOGFONTEXA
fontA
)
{
FONT_LogFontWToA
(
(
const
LOGFONTW
*
)
fontW
,
(
LPLOGFONTA
)
fontA
);
FONT_LogFontWToA
(
&
fontW
->
elfLogFont
,
&
fontA
->
elfLogFont
);
WideCharToMultiByte
(
CP_ACP
,
0
,
fontW
->
elfFullName
,
-
1
,
(
LPSTR
)
fontA
->
elfFullName
,
LF_FULLFACESIZE
,
NULL
,
NULL
);
...
...
@@ -193,6 +193,21 @@ static void FONT_EnumLogFontExWToA( const ENUMLOGFONTEXW *fontW, LPENUMLOGFONTEX
fontA
->
elfScript
[
LF_FACESIZE
-
1
]
=
'\0'
;
}
static
void
FONT_EnumLogFontExAToW
(
const
ENUMLOGFONTEXA
*
fontA
,
LPENUMLOGFONTEXW
fontW
)
{
FONT_LogFontAToW
(
&
fontA
->
elfLogFont
,
&
fontW
->
elfLogFont
);
MultiByteToWideChar
(
CP_ACP
,
0
,
(
LPCSTR
)
fontA
->
elfFullName
,
-
1
,
fontW
->
elfFullName
,
LF_FULLFACESIZE
);
fontW
->
elfFullName
[
LF_FULLFACESIZE
-
1
]
=
'\0'
;
MultiByteToWideChar
(
CP_ACP
,
0
,
(
LPCSTR
)
fontA
->
elfStyle
,
-
1
,
fontW
->
elfStyle
,
LF_FACESIZE
);
fontW
->
elfStyle
[
LF_FACESIZE
-
1
]
=
'\0'
;
MultiByteToWideChar
(
CP_ACP
,
0
,
(
LPCSTR
)
fontA
->
elfScript
,
-
1
,
fontW
->
elfScript
,
LF_FACESIZE
);
fontW
->
elfScript
[
LF_FACESIZE
-
1
]
=
'\0'
;
}
/***********************************************************************
* TEXTMETRIC conversion functions.
*/
...
...
@@ -287,30 +302,42 @@ static LPWSTR FONT_mbtowc(HDC hdc, LPCSTR str, INT count, INT *plenW, UINT *pCP)
return
strW
;
}
/***********************************************************************
* CreateFontIndirectA (GDI32.@)
* CreateFontIndirect
Ex
A (GDI32.@)
*/
HFONT
WINAPI
CreateFontIndirect
A
(
const
LOGFONTA
*
plf
A
)
HFONT
WINAPI
CreateFontIndirect
ExA
(
const
ENUMLOGFONTEXDVA
*
penumex
A
)
{
LOGFONTW
lf
W
;
ENUMLOGFONTEXDVW
enumex
W
;
if
(
!
p
lf
A
)
return
0
;
if
(
!
p
enumex
A
)
return
0
;
FONT_LogFontAToW
(
plfA
,
&
lfW
);
return
CreateFontIndirectW
(
&
lfW
);
FONT_EnumLogFontExAToW
(
&
penumexA
->
elfEnumLogfontEx
,
&
enumexW
.
elfEnumLogfontEx
);
enumexW
.
elfDesignVector
=
penumexA
->
elfDesignVector
;
return
CreateFontIndirectExW
(
&
enumexW
);
}
/***********************************************************************
* CreateFontIndirect
W
(GDI32.@)
* CreateFontIndirect
ExA
(GDI32.@)
*/
HFONT
WINAPI
CreateFontIndirect
W
(
const
LOGFONTW
*
plf
)
HFONT
WINAPI
CreateFontIndirect
ExW
(
const
ENUMLOGFONTEXDVW
*
penumex
)
{
HFONT
hFont
;
FONTOBJ
*
fontPtr
;
const
LOGFONTW
*
plf
;
if
(
!
plf
)
return
0
;
if
(
!
penumex
)
return
0
;
if
(
penumex
->
elfEnumLogfontEx
.
elfFullName
[
0
]
||
penumex
->
elfEnumLogfontEx
.
elfStyle
[
0
]
||
penumex
->
elfEnumLogfontEx
.
elfScript
[
0
])
{
FIXME
(
"some fields ignored. fullname=%s, style=%s, script=%s
\n
"
,
debugstr_w
(
penumex
->
elfEnumLogfontEx
.
elfFullName
),
debugstr_w
(
penumex
->
elfEnumLogfontEx
.
elfStyle
),
debugstr_w
(
penumex
->
elfEnumLogfontEx
.
elfScript
));
}
plf
=
&
penumex
->
elfEnumLogfontEx
.
elfLogFont
;
if
(
!
(
fontPtr
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
fontPtr
)
)))
return
0
;
fontPtr
->
logfont
=
*
plf
;
...
...
@@ -344,6 +371,35 @@ HFONT WINAPI CreateFontIndirectW( const LOGFONTW *plf )
return
hFont
;
}
/***********************************************************************
* CreateFontIndirectA (GDI32.@)
*/
HFONT
WINAPI
CreateFontIndirectA
(
const
LOGFONTA
*
plfA
)
{
LOGFONTW
lfW
;
if
(
!
plfA
)
return
0
;
FONT_LogFontAToW
(
plfA
,
&
lfW
);
return
CreateFontIndirectW
(
&
lfW
);
}
/***********************************************************************
* CreateFontIndirectW (GDI32.@)
*/
HFONT
WINAPI
CreateFontIndirectW
(
const
LOGFONTW
*
plf
)
{
ENUMLOGFONTEXDVW
exdv
;
if
(
!
plf
)
return
0
;
exdv
.
elfEnumLogfontEx
.
elfLogFont
=
*
plf
;
exdv
.
elfEnumLogfontEx
.
elfFullName
[
0
]
=
0
;
exdv
.
elfEnumLogfontEx
.
elfStyle
[
0
]
=
0
;
exdv
.
elfEnumLogfontEx
.
elfScript
[
0
]
=
0
;
return
CreateFontIndirectExW
(
&
exdv
);
}
/*************************************************************************
* CreateFontA (GDI32.@)
*/
...
...
dlls/gdi32/gdi32.spec
View file @
cd43ff16
...
...
@@ -58,8 +58,8 @@
@ stdcall CreateEnhMetaFileW(long wstr ptr wstr)
@ stdcall CreateFontA(long long long long long long long long long long long long long str)
@ stdcall CreateFontIndirectA(ptr)
# @ stub CreateFontIndirectExA
# @ stub CreateFontIndirectExW
@ stdcall CreateFontIndirectExA(ptr)
@ stdcall CreateFontIndirectExW(ptr)
@ stdcall CreateFontIndirectW(ptr)
@ stdcall CreateFontW(long long long long long long long long long long long long long wstr)
@ stdcall CreateHalftonePalette(long)
...
...
dlls/gdi32/tests/font.c
View file @
cd43ff16
...
...
@@ -43,6 +43,7 @@ DWORD (WINAPI *pGetFontUnicodeRanges)(HDC hdc, LPGLYPHSET lpgs);
DWORD
(
WINAPI
*
pGetGlyphIndicesA
)(
HDC
hdc
,
LPCSTR
lpstr
,
INT
count
,
LPWORD
pgi
,
DWORD
flags
);
DWORD
(
WINAPI
*
pGetGlyphIndicesW
)(
HDC
hdc
,
LPCWSTR
lpstr
,
INT
count
,
LPWORD
pgi
,
DWORD
flags
);
BOOL
(
WINAPI
*
pGdiRealizationInfo
)(
HDC
hdc
,
DWORD
*
);
HFONT
(
WINAPI
*
pCreateFontIndirectExA
)(
const
ENUMLOGFONTEXDV
*
);
static
HMODULE
hgdi32
=
0
;
...
...
@@ -57,6 +58,7 @@ static void init(void)
pGetGlyphIndicesA
=
(
void
*
)
GetProcAddress
(
hgdi32
,
"GetGlyphIndicesA"
);
pGetGlyphIndicesW
=
(
void
*
)
GetProcAddress
(
hgdi32
,
"GetGlyphIndicesW"
);
pGdiRealizationInfo
=
(
void
*
)
GetProcAddress
(
hgdi32
,
"GdiRealizationInfo"
);
pCreateFontIndirectExA
=
(
void
*
)
GetProcAddress
(
hgdi32
,
"CreateFontIndirectExA"
);
}
static
INT
CALLBACK
is_truetype_font_installed_proc
(
const
LOGFONT
*
elf
,
const
TEXTMETRIC
*
ntm
,
DWORD
type
,
LPARAM
lParam
)
...
...
@@ -3109,6 +3111,37 @@ static void test_CreateFontIndirect(void)
}
}
static
void
test_CreateFontIndirectEx
(
void
)
{
ENUMLOGFONTEXDVA
lfex
;
HFONT
hfont
;
if
(
!
pCreateFontIndirectExA
)
{
win_skip
(
"CreateFontIndirectExA is not available
\n
"
);
return
;
}
if
(
!
is_truetype_font_installed
(
"Arial"
))
{
skip
(
"Arial is not installed
\n
"
);
return
;
}
SetLastError
(
0xdeadbeef
);
hfont
=
pCreateFontIndirectExA
(
NULL
);
ok
(
hfont
==
NULL
,
"got %p
\n
"
,
hfont
);
ok
(
GetLastError
()
==
0xdeadbeef
,
"got error %d
\n
"
,
GetLastError
());
memset
(
&
lfex
,
0
,
sizeof
(
lfex
));
lstrcpyA
(
lfex
.
elfEnumLogfontEx
.
elfLogFont
.
lfFaceName
,
"Arial"
);
hfont
=
pCreateFontIndirectExA
(
&
lfex
);
ok
(
hfont
!=
0
,
"CreateFontIndirectEx failed
\n
"
);
if
(
hfont
)
check_font
(
"Arial"
,
&
lfex
.
elfEnumLogfontEx
.
elfLogFont
,
hfont
);
DeleteObject
(
hfont
);
}
START_TEST
(
font
)
{
init
();
...
...
@@ -3155,5 +3188,6 @@ START_TEST(font)
test_GetTextMetrics2
(
"Arial"
,
-
55
);
test_GetTextMetrics2
(
"Arial"
,
-
110
);
test_CreateFontIndirect
();
test_CreateFontIndirectEx
();
test_oemcharset
();
}
include/wingdi.h
View file @
cd43ff16
...
...
@@ -610,6 +610,30 @@ typedef struct
DECL_WINELIB_TYPE_AW
(
ENUMLOGFONTEX
)
DECL_WINELIB_TYPE_AW
(
LPENUMLOGFONTEX
)
#define MM_MAX_NUMAXES 16
typedef
struct
{
DWORD
dvReserved
;
DWORD
dvNumAxes
;
LONG
dvValues
[
MM_MAX_NUMAXES
];
}
DESIGNVECTOR
,
*
PDESIGNVECTOR
;
typedef
struct
{
ENUMLOGFONTEXA
elfEnumLogfontEx
;
DESIGNVECTOR
elfDesignVector
;
}
ENUMLOGFONTEXDVA
,
*
PENUMLOGFONTEXDVA
;
typedef
struct
{
ENUMLOGFONTEXW
elfEnumLogfontEx
;
DESIGNVECTOR
elfDesignVector
;
}
ENUMLOGFONTEXDVW
,
*
PENUMLOGFONTEXDVW
;
DECL_WINELIB_TYPE_AW
(
ENUMLOGFONTEXDV
)
DECL_WINELIB_TYPE_AW
(
PENUMLOGFONTEXDV
)
/*
* The FONTSIGNATURE tells which Unicode ranges and which code pages
* have glyphs in a font.
...
...
@@ -3356,6 +3380,9 @@ WINGDIAPI HFONT WINAPI CreateFontW(INT,INT,INT,INT,INT,DWORD,DWORD,DWORD,D
WINGDIAPI
HFONT
WINAPI
CreateFontIndirectA
(
const
LOGFONTA
*
);
WINGDIAPI
HFONT
WINAPI
CreateFontIndirectW
(
const
LOGFONTW
*
);
#define CreateFontIndirect WINELIB_NAME_AW(CreateFontIndirect)
WINGDIAPI
HFONT
WINAPI
CreateFontIndirectExA
(
const
ENUMLOGFONTEXDVA
*
);
WINGDIAPI
HFONT
WINAPI
CreateFontIndirectExW
(
const
ENUMLOGFONTEXDVW
*
);
#define CreateFontIndirectEx WINELIB_NAME_AW(CreateFontIndirectEx)
WINGDIAPI
HPALETTE
WINAPI
CreateHalftonePalette
(
HDC
);
WINGDIAPI
HBRUSH
WINAPI
CreateHatchBrush
(
INT
,
COLORREF
);
WINGDIAPI
HDC
WINAPI
CreateICA
(
LPCSTR
,
LPCSTR
,
LPCSTR
,
const
DEVMODEA
*
);
...
...
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