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
c8bc7ea8
Commit
c8bc7ea8
authored
Nov 06, 2014
by
Nikolay Sivov
Committed by
Alexandre Julliard
Nov 06, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dwrite: Implement GetMetrics() for fontface.
parent
90753ada
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
3 deletions
+34
-3
font.c
dlls/dwrite/font.c
+13
-3
font.c
dlls/dwrite/tests/font.c
+21
-0
No files found.
dlls/dwrite/font.c
View file @
c8bc7ea8
...
...
@@ -112,6 +112,7 @@ struct dwrite_fontface {
USHORT
simulations
;
DWRITE_FONT_FACE_TYPE
type
;
DWRITE_FONT_METRICS
metrics
;
struct
dwrite_fonttable
cmap
;
};
...
...
@@ -313,7 +314,8 @@ static BOOL WINAPI dwritefontface_IsSymbolFont(IDWriteFontFace2 *iface)
static
void
WINAPI
dwritefontface_GetMetrics
(
IDWriteFontFace2
*
iface
,
DWRITE_FONT_METRICS
*
metrics
)
{
struct
dwrite_fontface
*
This
=
impl_from_IDWriteFontFace2
(
iface
);
FIXME
(
"(%p)->(%p): stub
\n
"
,
This
,
metrics
);
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
metrics
);
*
metrics
=
This
->
metrics
;
}
static
UINT16
WINAPI
dwritefontface_GetGlyphCount
(
IDWriteFontFace2
*
iface
)
...
...
@@ -615,11 +617,18 @@ static void get_font_properties_from_stream(IDWriteFontFileStream *stream, DWRIT
{
const
void
*
tt_os2
=
NULL
,
*
tt_head
=
NULL
,
*
tt_post
=
NULL
;
void
*
os2_context
,
*
head_context
,
*
post_context
;
DWRITE_FONT_STRETCH
fontstretch
;
DWRITE_FONT_WEIGHT
fontweight
;
DWRITE_FONT_STYLE
fontstyle
;
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
);
if
(
!
stretch
)
stretch
=
&
fontstretch
;
if
(
!
weight
)
weight
=
&
fontweight
;
if
(
!
style
)
style
=
&
fontstyle
;
opentype_get_font_properties
(
tt_os2
,
tt_head
,
stretch
,
weight
,
style
);
opentype_get_font_metrics
(
tt_os2
,
tt_head
,
tt_post
,
metrics
);
...
...
@@ -1930,6 +1939,8 @@ HRESULT create_fontface(DWRITE_FONT_FACE_TYPE facetype, UINT32 files_number, IDW
fontface
->
cmap
.
data
=
NULL
;
fontface
->
cmap
.
context
=
NULL
;
fontface
->
cmap
.
size
=
0
;
fontface
->
index
=
index
;
fontface
->
simulations
=
simulations
;
for
(
i
=
0
;
i
<
fontface
->
file_count
;
i
++
)
{
hr
=
get_stream_from_file
(
font_files
[
i
],
&
fontface
->
streams
[
i
]);
...
...
@@ -1942,8 +1953,7 @@ HRESULT create_fontface(DWRITE_FONT_FACE_TYPE facetype, UINT32 files_number, IDW
IDWriteFontFile_AddRef
(
font_files
[
i
]);
}
fontface
->
index
=
index
;
fontface
->
simulations
=
simulations
;
get_font_properties_from_stream
(
fontface
->
streams
[
0
],
facetype
,
index
,
&
fontface
->
metrics
,
NULL
,
NULL
,
NULL
);
*
ret
=
&
fontface
->
IDWriteFontFace2_iface
;
return
S_OK
;
...
...
dlls/dwrite/tests/font.c
View file @
c8bc7ea8
...
...
@@ -957,6 +957,7 @@ static void test_GetMetrics(void)
{
IDWriteGdiInterop
*
interop
;
DWRITE_FONT_METRICS
metrics
;
IDWriteFontFace
*
fontface
;
IDWriteFactory
*
factory
;
OUTLINETEXTMETRICW
otm
;
IDWriteFont
*
font
;
...
...
@@ -1009,6 +1010,26 @@ todo_wine
ok
(
metrics
.
strikethroughPosition
>
0
,
"strikethroughPosition %d
\n
"
,
metrics
.
strikethroughPosition
);
ok
(
metrics
.
strikethroughThickness
!=
0
,
"strikethroughThickness %u
\n
"
,
metrics
.
strikethroughThickness
);
hr
=
IDWriteFont_CreateFontFace
(
font
,
&
fontface
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
memset
(
&
metrics
,
0
,
sizeof
(
metrics
));
IDWriteFontFace_GetMetrics
(
fontface
,
&
metrics
);
ok
(
metrics
.
designUnitsPerEm
!=
0
,
"designUnitsPerEm %u
\n
"
,
metrics
.
designUnitsPerEm
);
ok
(
metrics
.
ascent
!=
0
,
"ascent %u
\n
"
,
metrics
.
ascent
);
ok
(
metrics
.
descent
!=
0
,
"descent %u
\n
"
,
metrics
.
descent
);
todo_wine
ok
(
metrics
.
lineGap
==
0
,
"lineGap %d
\n
"
,
metrics
.
lineGap
);
ok
(
metrics
.
capHeight
,
"capHeight %u
\n
"
,
metrics
.
capHeight
);
ok
(
metrics
.
xHeight
!=
0
,
"xHeight %u
\n
"
,
metrics
.
xHeight
);
ok
(
metrics
.
underlinePosition
<
0
,
"underlinePosition %d
\n
"
,
metrics
.
underlinePosition
);
ok
(
metrics
.
underlineThickness
!=
0
,
"underlineThickness %u
\n
"
,
metrics
.
underlineThickness
);
ok
(
metrics
.
strikethroughPosition
>
0
,
"strikethroughPosition %d
\n
"
,
metrics
.
strikethroughPosition
);
ok
(
metrics
.
strikethroughThickness
!=
0
,
"strikethroughThickness %u
\n
"
,
metrics
.
strikethroughThickness
);
IDWriteFontFace_Release
(
fontface
);
IDWriteFont_Release
(
font
);
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