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
6855740a
Commit
6855740a
authored
Oct 28, 2014
by
Nikolay Sivov
Committed by
Alexandre Julliard
Oct 29, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dwrite: Reimplement ConvertFontFaceToLOGFONT().
parent
1d299394
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
2 deletions
+60
-2
font.c
dlls/dwrite/font.c
+57
-2
font.c
dlls/dwrite/tests/font.c
+3
-0
No files found.
dlls/dwrite/font.c
View file @
6855740a
...
@@ -139,6 +139,7 @@ static HRESULT create_fontfamily(IDWriteLocalizedStrings *familyname, IDWriteFon
...
@@ -139,6 +139,7 @@ static HRESULT create_fontfamily(IDWriteLocalizedStrings *familyname, IDWriteFon
static
HRESULT
create_fontfamily_from_data
(
struct
dwrite_fontfamily_data
*
data
,
IDWriteFontCollection
*
collection
,
IDWriteFontFamily
**
family
);
static
HRESULT
create_fontfamily_from_data
(
struct
dwrite_fontfamily_data
*
data
,
IDWriteFontCollection
*
collection
,
IDWriteFontFamily
**
family
);
static
HRESULT
create_font_base
(
IDWriteFont
**
font
);
static
HRESULT
create_font_base
(
IDWriteFont
**
font
);
static
HRESULT
create_font_from_data
(
struct
dwrite_font_data
*
,
IDWriteFontFamily
*
,
DWRITE_FONT_SIMULATIONS
,
IDWriteFont
**
);
static
HRESULT
create_font_from_data
(
struct
dwrite_font_data
*
,
IDWriteFontFamily
*
,
DWRITE_FONT_SIMULATIONS
,
IDWriteFont
**
);
static
HRESULT
get_filestream_from_file
(
IDWriteFontFile
*
,
IDWriteFontFileStream
**
);
static
inline
struct
dwrite_fontface
*
impl_from_IDWriteFontFace2
(
IDWriteFontFace2
*
iface
)
static
inline
struct
dwrite_fontface
*
impl_from_IDWriteFontFace2
(
IDWriteFontFace2
*
iface
)
{
{
...
@@ -723,11 +724,65 @@ static HRESULT create_system_fontface(struct dwrite_font *font, IDWriteFontFace
...
@@ -723,11 +724,65 @@ static HRESULT create_system_fontface(struct dwrite_font *font, IDWriteFontFace
return
S_OK
;
return
S_OK
;
}
}
static
void
get_font_properties_from_stream
(
IDWriteFontFileStream
*
stream
,
DWRITE_FONT_FACE_TYPE
face_type
,
UINT32
face_index
,
DWRITE_FONT_METRICS
*
metrics
,
DWRITE_FONT_STRETCH
*
stretch
,
DWRITE_FONT_WEIGHT
*
weight
,
DWRITE_FONT_STYLE
*
style
)
{
const
void
*
tt_os2
=
NULL
,
*
tt_head
=
NULL
,
*
tt_post
=
NULL
;
void
*
os2_context
,
*
head_context
,
*
post_context
;
opentype_get_font_table
(
stream
,
face_type
,
face_index
,
MS_OS2_TAG
,
&
tt_os2
,
&
os2_context
,
NULL
,
NULL
);
opentype_get_font_table
(
stream
,
face_type
,
face_index
,
MS_HEAD_TAG
,
&
tt_head
,
&
head_context
,
NULL
,
NULL
);
opentype_get_font_table
(
stream
,
face_type
,
face_index
,
MS_POST_TAG
,
&
tt_post
,
&
post_context
,
NULL
,
NULL
);
get_font_properties
(
tt_os2
,
tt_head
,
tt_post
,
metrics
,
stretch
,
weight
,
style
);
if
(
tt_os2
)
IDWriteFontFileStream_ReleaseFileFragment
(
stream
,
os2_context
);
if
(
tt_head
)
IDWriteFontFileStream_ReleaseFileFragment
(
stream
,
head_context
);
if
(
tt_post
)
IDWriteFontFileStream_ReleaseFileFragment
(
stream
,
post_context
);
}
HRESULT
convert_fontface_to_logfont
(
IDWriteFontFace
*
face
,
LOGFONTW
*
logfont
)
HRESULT
convert_fontface_to_logfont
(
IDWriteFontFace
*
face
,
LOGFONTW
*
logfont
)
{
{
struct
dwrite_fontface
*
fontface
=
impl_from_IDWriteFontFace2
((
IDWriteFontFace2
*
)
face
);
DWRITE_FONT_SIMULATIONS
simulations
;
DWRITE_FONT_FACE_TYPE
face_type
;
IDWriteFontFileStream
*
stream
;
DWRITE_FONT_METRICS
metrics
;
DWRITE_FONT_STRETCH
stretch
;
DWRITE_FONT_STYLE
style
;
DWRITE_FONT_WEIGHT
weight
;
IDWriteFontFile
*
file
=
NULL
;
UINT32
index
;
HRESULT
hr
;
memset
(
logfont
,
0
,
sizeof
(
*
logfont
));
index
=
1
;
hr
=
IDWriteFontFace_GetFiles
(
face
,
&
index
,
&
file
);
if
(
FAILED
(
hr
)
||
!
file
)
return
hr
;
hr
=
get_filestream_from_file
(
file
,
&
stream
);
if
(
FAILED
(
hr
))
{
IDWriteFontFile_Release
(
file
);
return
hr
;
}
index
=
IDWriteFontFace_GetIndex
(
face
);
face_type
=
IDWriteFontFace_GetType
(
face
);
get_font_properties_from_stream
(
stream
,
face_type
,
index
,
&
metrics
,
&
stretch
,
&
weight
,
&
style
);
IDWriteFontFileStream_Release
(
stream
);
simulations
=
IDWriteFontFace_GetSimulations
(
face
);
*
logfont
=
fontface
->
logfont
;
logfont
->
lfCharSet
=
DEFAULT_CHARSET
;
logfont
->
lfWeight
=
weight
;
logfont
->
lfItalic
=
style
==
DWRITE_FONT_STYLE_ITALIC
||
(
simulations
|
DWRITE_FONT_SIMULATIONS_OBLIQUE
);
logfont
->
lfOutPrecision
=
OUT_OUTLINE_PRECIS
;
/* TODO: set facename */
return
S_OK
;
return
S_OK
;
}
}
...
...
dlls/dwrite/tests/font.c
View file @
6855740a
...
@@ -1013,11 +1013,14 @@ if (0) /* crashes on native */
...
@@ -1013,11 +1013,14 @@ if (0) /* crashes on native */
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
logfont
.
lfHeight
==
0
,
"got %d
\n
"
,
logfont
.
lfHeight
);
ok
(
logfont
.
lfHeight
==
0
,
"got %d
\n
"
,
logfont
.
lfHeight
);
ok
(
logfont
.
lfWidth
==
0
,
"got %d
\n
"
,
logfont
.
lfWidth
);
ok
(
logfont
.
lfWidth
==
0
,
"got %d
\n
"
,
logfont
.
lfWidth
);
todo_wine
ok
(
logfont
.
lfWeight
==
FW_NORMAL
,
"got %d
\n
"
,
logfont
.
lfWeight
);
ok
(
logfont
.
lfWeight
==
FW_NORMAL
,
"got %d
\n
"
,
logfont
.
lfWeight
);
ok
(
logfont
.
lfEscapement
==
0
,
"got %d
\n
"
,
logfont
.
lfEscapement
);
ok
(
logfont
.
lfEscapement
==
0
,
"got %d
\n
"
,
logfont
.
lfEscapement
);
todo_wine
ok
(
logfont
.
lfItalic
==
1
,
"got %d
\n
"
,
logfont
.
lfItalic
);
ok
(
logfont
.
lfItalic
==
1
,
"got %d
\n
"
,
logfont
.
lfItalic
);
ok
(
logfont
.
lfUnderline
==
0
,
"got %d
\n
"
,
logfont
.
lfUnderline
);
ok
(
logfont
.
lfUnderline
==
0
,
"got %d
\n
"
,
logfont
.
lfUnderline
);
ok
(
logfont
.
lfStrikeOut
==
0
,
"got %d
\n
"
,
logfont
.
lfStrikeOut
);
ok
(
logfont
.
lfStrikeOut
==
0
,
"got %d
\n
"
,
logfont
.
lfStrikeOut
);
todo_wine
ok
(
!
lstrcmpW
(
logfont
.
lfFaceName
,
tahomaW
),
"got %s
\n
"
,
wine_dbgstr_w
(
logfont
.
lfFaceName
));
ok
(
!
lstrcmpW
(
logfont
.
lfFaceName
,
tahomaW
),
"got %s
\n
"
,
wine_dbgstr_w
(
logfont
.
lfFaceName
));
IDWriteGdiInterop_Release
(
interop
);
IDWriteGdiInterop_Release
(
interop
);
...
...
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