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
901a65ae
Commit
901a65ae
authored
Oct 27, 2014
by
Nikolay Sivov
Committed by
Alexandre Julliard
Oct 29, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dwrite: Store simulations flags at font instance level.
parent
5a5a6bdd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
74 additions
and
10 deletions
+74
-10
font.c
dlls/dwrite/font.c
+14
-10
font.c
dlls/dwrite/tests/font.c
+60
-0
No files found.
dlls/dwrite/font.c
View file @
901a65ae
...
...
@@ -37,7 +37,6 @@ struct dwrite_font_data {
DWRITE_FONT_STYLE
style
;
DWRITE_FONT_STRETCH
stretch
;
DWRITE_FONT_WEIGHT
weight
;
DWRITE_FONT_SIMULATIONS
simulations
;
DWRITE_FONT_METRICS
metrics
;
IDWriteLocalizedStrings
*
info_strings
[
DWRITE_INFORMATIONAL_STRING_POSTSCRIPT_CID_NAME
+
1
];
...
...
@@ -91,6 +90,7 @@ struct dwrite_font {
BOOL
is_system
;
IDWriteFontFamily
*
family
;
DWRITE_FONT_SIMULATIONS
simulations
;
struct
dwrite_font_data
*
data
;
};
...
...
@@ -138,7 +138,7 @@ struct dwrite_fontfile {
static
HRESULT
create_fontfamily
(
IDWriteLocalizedStrings
*
familyname
,
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_from_data
(
struct
dwrite_font_data
*
,
IDWriteFontFamily
*
,
IDWriteFont
**
);
static
HRESULT
create_font_from_data
(
struct
dwrite_font_data
*
,
IDWriteFontFamily
*
,
DWRITE_FONT_SIMULATIONS
,
IDWriteFont
**
);
static
inline
struct
dwrite_fontface
*
impl_from_IDWriteFontFace2
(
IDWriteFontFace2
*
iface
)
{
...
...
@@ -744,7 +744,7 @@ static HRESULT get_fontface_from_font(struct dwrite_font *font, IDWriteFontFace2
hr
=
font
->
is_system
?
create_system_fontface
(
font
,
&
face
)
:
IDWriteFactory_CreateFontFace
(
data
->
factory
,
data
->
face_type
,
1
,
&
data
->
file
,
data
->
face_index
,
DWRITE_FONT_SIMULATIONS_NONE
,
&
face
);
data
->
face_index
,
font
->
simulations
,
&
face
);
if
(
FAILED
(
hr
))
return
hr
;
...
...
@@ -765,7 +765,7 @@ static HRESULT create_font_base(IDWriteFont **font)
data
=
heap_alloc_zero
(
sizeof
(
*
data
));
if
(
!
data
)
return
E_OUTOFMEMORY
;
ret
=
create_font_from_data
(
data
,
NULL
,
font
);
ret
=
create_font_from_data
(
data
,
NULL
,
DWRITE_FONT_SIMULATIONS_NONE
,
font
);
if
(
FAILED
(
ret
))
heap_free
(
data
);
return
ret
;
}
...
...
@@ -870,7 +870,7 @@ static HRESULT create_font_from_logfont(const LOGFONTW *logfont, IDWriteFont **f
This
->
is_system
=
TRUE
;
This
->
family
=
family
;
This
->
data
->
simulations
=
DWRITE_FONT_SIMULATIONS_NONE
;
This
->
simulations
=
DWRITE_FONT_SIMULATIONS_NONE
;
This
->
data
->
facename
=
heap_strdupW
(
logfont
->
lfFaceName
);
return
S_OK
;
...
...
@@ -1016,7 +1016,7 @@ static DWRITE_FONT_SIMULATIONS WINAPI dwritefont_GetSimulations(IDWriteFont2 *if
{
struct
dwrite_font
*
This
=
impl_from_IDWriteFont2
(
iface
);
TRACE
(
"(%p)
\n
"
,
This
);
return
This
->
data
->
simulations
;
return
This
->
simulations
;
}
static
void
WINAPI
dwritefont_GetMetrics
(
IDWriteFont2
*
iface
,
DWRITE_FONT_METRICS
*
metrics
)
...
...
@@ -1201,7 +1201,7 @@ static HRESULT WINAPI dwritefontfamily_GetFont(IDWriteFontFamily *iface, UINT32
{
if
(
index
>=
This
->
data
->
font_count
)
return
E_INVALIDARG
;
return
create_font_from_data
(
This
->
data
->
fonts
[
index
],
iface
,
font
);
return
create_font_from_data
(
This
->
data
->
fonts
[
index
],
iface
,
DWRITE_FONT_SIMULATIONS_NONE
,
font
);
}
else
return
E_NOTIMPL
;
...
...
@@ -1247,7 +1247,7 @@ static HRESULT WINAPI dwritefontfamily_GetFirstMatchingFont(IDWriteFontFamily *i
}
}
return
found
!=
-
1
?
create_font_from_data
(
This
->
data
->
fonts
[
found
],
iface
,
font
)
:
DWRITE_E_NOFONT
;
return
found
!=
-
1
?
create_font_from_data
(
This
->
data
->
fonts
[
found
],
iface
,
DWRITE_FONT_SIMULATIONS_NONE
,
font
)
:
DWRITE_E_NOFONT
;
}
}
...
...
@@ -1414,6 +1414,7 @@ static HRESULT WINAPI dwritefontcollection_GetFontFromFontFace(IDWriteFontCollec
struct
dwrite_fontcollection
*
This
=
impl_from_IDWriteFontCollection
(
iface
);
struct
dwrite_fontfamily_data
*
found_family
=
NULL
;
struct
dwrite_font_data
*
found_font
=
NULL
;
DWRITE_FONT_SIMULATIONS
simulations
;
IDWriteFontFamily
*
family
;
UINT32
i
,
j
;
HRESULT
hr
;
...
...
@@ -1443,7 +1444,8 @@ static HRESULT WINAPI dwritefontcollection_GetFontFromFontFace(IDWriteFontCollec
if
(
FAILED
(
hr
))
return
hr
;
hr
=
create_font_from_data
(
found_font
,
family
,
font
);
simulations
=
IDWriteFontFace_GetSimulations
(
face
);
hr
=
create_font_from_data
(
found_font
,
family
,
simulations
,
font
);
IDWriteFontFamily_Release
(
family
);
return
hr
;
}
...
...
@@ -1819,7 +1821,8 @@ static HRESULT create_fontfamily(IDWriteLocalizedStrings *familyname, IDWriteFon
return
ret
;
}
static
HRESULT
create_font_from_data
(
struct
dwrite_font_data
*
data
,
IDWriteFontFamily
*
family
,
IDWriteFont
**
font
)
static
HRESULT
create_font_from_data
(
struct
dwrite_font_data
*
data
,
IDWriteFontFamily
*
family
,
DWRITE_FONT_SIMULATIONS
simulations
,
IDWriteFont
**
font
)
{
struct
dwrite_font
*
This
;
*
font
=
NULL
;
...
...
@@ -1833,6 +1836,7 @@ static HRESULT create_font_from_data(struct dwrite_font_data *data, IDWriteFontF
if
(
family
)
IDWriteFontFamily_AddRef
(
family
);
This
->
is_system
=
FALSE
;
This
->
simulations
=
simulations
;
This
->
data
=
data
;
InterlockedIncrement
(
&
This
->
data
->
ref
);
...
...
dlls/dwrite/tests/font.c
View file @
901a65ae
...
...
@@ -1651,6 +1651,65 @@ static void test_CreateFontFaceFromHdc(void)
IDWriteFactory_Release
(
factory
);
}
static
void
test_GetSimulations
(
void
)
{
DWRITE_FONT_SIMULATIONS
simulations
;
IDWriteGdiInterop
*
interop
;
IDWriteFontFace
*
fontface
;
IDWriteFactory
*
factory
;
IDWriteFont
*
font
;
LOGFONTW
logfont
;
HRESULT
hr
;
factory
=
create_factory
();
hr
=
IDWriteFactory_GetGdiInterop
(
factory
,
&
interop
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
memset
(
&
logfont
,
0
,
sizeof
(
logfont
));
logfont
.
lfHeight
=
12
;
logfont
.
lfWidth
=
12
;
logfont
.
lfWeight
=
FW_NORMAL
;
logfont
.
lfItalic
=
1
;
lstrcpyW
(
logfont
.
lfFaceName
,
tahomaW
);
hr
=
IDWriteGdiInterop_CreateFontFromLOGFONT
(
interop
,
&
logfont
,
&
font
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
simulations
=
IDWriteFont_GetSimulations
(
font
);
todo_wine
ok
(
simulations
==
DWRITE_FONT_SIMULATIONS_OBLIQUE
,
"got %d
\n
"
,
simulations
);
hr
=
IDWriteFont_CreateFontFace
(
font
,
&
fontface
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
simulations
=
IDWriteFontFace_GetSimulations
(
fontface
);
todo_wine
ok
(
simulations
==
DWRITE_FONT_SIMULATIONS_OBLIQUE
,
"got %d
\n
"
,
simulations
);
IDWriteFontFace_Release
(
fontface
);
IDWriteFont_Release
(
font
);
memset
(
&
logfont
,
0
,
sizeof
(
logfont
));
logfont
.
lfHeight
=
12
;
logfont
.
lfWidth
=
12
;
logfont
.
lfWeight
=
FW_NORMAL
;
logfont
.
lfItalic
=
0
;
lstrcpyW
(
logfont
.
lfFaceName
,
tahomaW
);
hr
=
IDWriteGdiInterop_CreateFontFromLOGFONT
(
interop
,
&
logfont
,
&
font
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
simulations
=
IDWriteFont_GetSimulations
(
font
);
ok
(
simulations
==
0
,
"got %d
\n
"
,
simulations
);
hr
=
IDWriteFont_CreateFontFace
(
font
,
&
fontface
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
simulations
=
IDWriteFontFace_GetSimulations
(
fontface
);
ok
(
simulations
==
0
,
"got %d
\n
"
,
simulations
);
IDWriteFontFace_Release
(
fontface
);
IDWriteFont_Release
(
font
);
IDWriteGdiInterop_Release
(
interop
);
IDWriteFactory_Release
(
factory
);
}
START_TEST
(
font
)
{
IDWriteFactory
*
factory
;
...
...
@@ -1678,6 +1737,7 @@ START_TEST(font)
test_GetInformationalStrings
();
test_GetGdiInterop
();
test_CreateFontFaceFromHdc
();
test_GetSimulations
();
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