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
8a6c1d99
Commit
8a6c1d99
authored
Apr 22, 2016
by
Nikolay Sivov
Committed by
Alexandre Julliard
Apr 22, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dwrite: Implement newer version of CreateFontFromLOGFONT().
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
ecc57731
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
61 additions
and
40 deletions
+61
-40
gdiinterop.c
dlls/dwrite/gdiinterop.c
+41
-40
font.c
dlls/dwrite/tests/font.c
+20
-0
No files found.
dlls/dwrite/gdiinterop.c
View file @
8a6c1d99
...
...
@@ -620,47 +620,10 @@ static HRESULT WINAPI gdiinterop_CreateFontFromLOGFONT(IDWriteGdiInterop1 *iface
LOGFONTW
const
*
logfont
,
IDWriteFont
**
font
)
{
struct
gdiinterop
*
This
=
impl_from_IDWriteGdiInterop1
(
iface
);
IDWriteFontCollection
*
collection
;
IDWriteFontFamily
*
family
;
DWRITE_FONT_STYLE
style
;
BOOL
exists
=
FALSE
;
UINT32
index
;
HRESULT
hr
;
TRACE
(
"(%p)->(%p %p)
\n
"
,
This
,
logfont
,
font
);
*
font
=
NULL
;
if
(
!
logfont
)
return
E_INVALIDARG
;
hr
=
IDWriteFactory2_GetSystemFontCollection
((
IDWriteFactory2
*
)
This
->
factory
,
&
collection
,
FALSE
);
if
(
FAILED
(
hr
))
{
ERR
(
"failed to get system font collection: 0x%08x.
\n
"
,
hr
);
return
hr
;
}
hr
=
IDWriteFontCollection_FindFamilyName
(
collection
,
logfont
->
lfFaceName
,
&
index
,
&
exists
);
if
(
FAILED
(
hr
))
{
IDWriteFontCollection_Release
(
collection
);
goto
done
;
}
if
(
!
exists
)
{
hr
=
DWRITE_E_NOFONT
;
goto
done
;
}
hr
=
IDWriteFontCollection_GetFontFamily
(
collection
,
index
,
&
family
);
if
(
FAILED
(
hr
))
goto
done
;
style
=
logfont
->
lfItalic
?
DWRITE_FONT_STYLE_ITALIC
:
DWRITE_FONT_STYLE_NORMAL
;
hr
=
IDWriteFontFamily_GetFirstMatchingFont
(
family
,
logfont
->
lfWeight
,
DWRITE_FONT_STRETCH_NORMAL
,
style
,
font
);
IDWriteFontFamily_Release
(
family
);
done:
IDWriteFontCollection_Release
(
collection
);
return
hr
;
return
IDWriteGdiInterop1_CreateFontFromLOGFONT
(
iface
,
logfont
,
NULL
,
font
);
}
static
HRESULT
WINAPI
gdiinterop_ConvertFontToLOGFONT
(
IDWriteGdiInterop1
*
iface
,
...
...
@@ -880,10 +843,48 @@ static HRESULT WINAPI gdiinterop1_CreateFontFromLOGFONT(IDWriteGdiInterop1 *ifac
LOGFONTW
const
*
logfont
,
IDWriteFontCollection
*
collection
,
IDWriteFont
**
font
)
{
struct
gdiinterop
*
This
=
impl_from_IDWriteGdiInterop1
(
iface
);
IDWriteFontFamily
*
family
;
DWRITE_FONT_STYLE
style
;
BOOL
exists
=
FALSE
;
UINT32
index
;
HRESULT
hr
;
FIXME
(
"(%p)->(%p %p %p): stub
\n
"
,
This
,
logfont
,
collection
,
font
);
TRACE
(
"(%p)->(%p %p %p)
\n
"
,
This
,
logfont
,
collection
,
font
);
return
E_NOTIMPL
;
*
font
=
NULL
;
if
(
!
logfont
)
return
E_INVALIDARG
;
if
(
collection
)
IDWriteFontCollection_AddRef
(
collection
);
else
{
hr
=
IDWriteFactory2_GetSystemFontCollection
((
IDWriteFactory2
*
)
This
->
factory
,
&
collection
,
FALSE
);
if
(
FAILED
(
hr
))
{
ERR
(
"failed to get system font collection: 0x%08x.
\n
"
,
hr
);
return
hr
;
}
}
hr
=
IDWriteFontCollection_FindFamilyName
(
collection
,
logfont
->
lfFaceName
,
&
index
,
&
exists
);
if
(
FAILED
(
hr
))
goto
done
;
if
(
!
exists
)
{
hr
=
DWRITE_E_NOFONT
;
goto
done
;
}
hr
=
IDWriteFontCollection_GetFontFamily
(
collection
,
index
,
&
family
);
if
(
FAILED
(
hr
))
goto
done
;
style
=
logfont
->
lfItalic
?
DWRITE_FONT_STYLE_ITALIC
:
DWRITE_FONT_STYLE_NORMAL
;
hr
=
IDWriteFontFamily_GetFirstMatchingFont
(
family
,
logfont
->
lfWeight
,
DWRITE_FONT_STRETCH_NORMAL
,
style
,
font
);
IDWriteFontFamily_Release
(
family
);
done:
IDWriteFontCollection_Release
(
collection
);
return
hr
;
}
static
HRESULT
WINAPI
gdiinterop1_GetFontSignature_
(
IDWriteGdiInterop1
*
iface
,
IDWriteFontFace
*
fontface
,
...
...
dlls/dwrite/tests/font.c
View file @
8a6c1d99
...
...
@@ -749,6 +749,7 @@ static ID2D1SimplifiedGeometrySink test_geomsink2 = { &test_geometrysink2_vtbl }
static
void
test_CreateFontFromLOGFONT
(
void
)
{
static
const
WCHAR
tahomaspW
[]
=
{
'T'
,
'a'
,
'h'
,
'o'
,
'm'
,
'a'
,
' '
,
0
};
IDWriteGdiInterop1
*
interop1
;
IDWriteGdiInterop
*
interop
;
DWRITE_FONT_WEIGHT
weight
;
DWRITE_FONT_STYLE
style
;
...
...
@@ -906,6 +907,25 @@ if (0)
ok
(
hr
==
DWRITE_E_NOFONT
,
"got 0x%08x
\n
"
,
hr
);
ok
(
font
==
NULL
,
"got %p
\n
"
,
font
);
/* IDWriteGdiInterop1::CreateFontFromLOGFONT() */
hr
=
IDWriteGdiInterop_QueryInterface
(
interop
,
&
IID_IDWriteGdiInterop1
,
(
void
**
)
&
interop1
);
if
(
hr
==
S_OK
)
{
memset
(
&
logfont
,
0
,
sizeof
(
logfont
));
logfont
.
lfHeight
=
12
;
logfont
.
lfWidth
=
12
;
logfont
.
lfWeight
=
FW_NORMAL
;
logfont
.
lfItalic
=
1
;
lstrcpyW
(
logfont
.
lfFaceName
,
tahomaW
);
hr
=
IDWriteGdiInterop1_CreateFontFromLOGFONT
(
interop1
,
&
logfont
,
NULL
,
&
font
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
IDWriteFont_Release
(
font
);
IDWriteGdiInterop1_Release
(
interop1
);
}
else
win_skip
(
"IDWriteGdiInterop1 is not supported, skipping CreateFontFromLOGFONT() tests.
\n
"
);
IDWriteGdiInterop_Release
(
interop
);
IDWriteFactory_Release
(
factory
);
}
...
...
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