Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
1d299394
Commit
1d299394
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: Set oblique simulation in GetFirstMatchingFont() when appropriate.
parent
901a65ae
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
3 deletions
+44
-3
font.c
dlls/dwrite/font.c
+25
-2
font.c
dlls/dwrite/tests/font.c
+19
-1
No files found.
dlls/dwrite/font.c
View file @
1d299394
...
...
@@ -1213,6 +1213,17 @@ static HRESULT WINAPI dwritefontfamily_GetFamilyNames(IDWriteFontFamily *iface,
return
clone_localizedstring
(
This
->
data
->
familyname
,
names
);
}
static
inline
BOOL
is_matching_font_style
(
DWRITE_FONT_STYLE
style
,
DWRITE_FONT_STYLE
font_style
)
{
if
(
style
==
font_style
)
return
TRUE
;
if
(((
style
==
DWRITE_FONT_STYLE_ITALIC
)
||
(
style
==
DWRITE_FONT_STYLE_OBLIQUE
))
&&
font_style
==
DWRITE_FONT_STYLE_NORMAL
)
return
TRUE
;
return
FALSE
;
}
static
HRESULT
WINAPI
dwritefontfamily_GetFirstMatchingFont
(
IDWriteFontFamily
*
iface
,
DWRITE_FONT_WEIGHT
weight
,
DWRITE_FONT_STRETCH
stretch
,
DWRITE_FONT_STYLE
style
,
IDWriteFont
**
font
)
{
...
...
@@ -1237,7 +1248,7 @@ static HRESULT WINAPI dwritefontfamily_GetFirstMatchingFont(IDWriteFontFamily *i
int
found
=
-
1
,
i
;
for
(
i
=
0
;
i
<
This
->
data
->
font_count
;
i
++
)
{
if
(
style
==
This
->
data
->
fonts
[
i
]
->
style
&&
stretch
==
This
->
data
->
fonts
[
i
]
->
stretch
)
{
if
(
is_matching_font_style
(
style
,
This
->
data
->
fonts
[
i
]
->
style
)
&&
stretch
==
This
->
data
->
fonts
[
i
]
->
stretch
)
{
DWRITE_FONT_WEIGHT
font_weight
=
This
->
data
->
fonts
[
i
]
->
weight
;
UINT32
weight_diff
=
abs
(
font_weight
-
weight
);
if
(
weight_diff
<
min_weight_diff
)
{
...
...
@@ -1247,7 +1258,19 @@ static HRESULT WINAPI dwritefontfamily_GetFirstMatchingFont(IDWriteFontFamily *i
}
}
return
found
!=
-
1
?
create_font_from_data
(
This
->
data
->
fonts
[
found
],
iface
,
DWRITE_FONT_SIMULATIONS_NONE
,
font
)
:
DWRITE_E_NOFONT
;
if
(
found
!=
-
1
)
{
DWRITE_FONT_SIMULATIONS
simulations
=
DWRITE_FONT_SIMULATIONS_NONE
;
if
(((
style
==
DWRITE_FONT_STYLE_ITALIC
)
||
(
style
==
DWRITE_FONT_STYLE_OBLIQUE
))
&&
This
->
data
->
fonts
[
found
]
->
style
==
DWRITE_FONT_STYLE_ITALIC
)
{
simulations
=
DWRITE_FONT_SIMULATIONS_OBLIQUE
;
}
return
create_font_from_data
(
This
->
data
->
fonts
[
found
],
iface
,
simulations
,
font
);
}
else
{
*
font
=
NULL
;
return
DWRITE_E_NOFONT
;
}
}
}
...
...
dlls/dwrite/tests/font.c
View file @
1d299394
...
...
@@ -1475,10 +1475,13 @@ if (font3)
static
void
test_GetFirstMatchingFont
(
void
)
{
DWRITE_FONT_SIMULATIONS
simulations
;
IDWriteFontCollection
*
collection
;
IDWriteFont
*
font
,
*
font2
;
IDWriteFontFamily
*
family
;
IDWriteFactory
*
factory
;
UINT32
index
;
BOOL
exists
;
HRESULT
hr
;
factory
=
create_factory
();
...
...
@@ -1486,7 +1489,13 @@ static void test_GetFirstMatchingFont(void)
hr
=
IDWriteFactory_GetSystemFontCollection
(
factory
,
&
collection
,
FALSE
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
IDWriteFontCollection_GetFontFamily
(
collection
,
0
,
&
family
);
index
=
~
0
;
exists
=
FALSE
;
hr
=
IDWriteFontCollection_FindFamilyName
(
collection
,
tahomaW
,
&
index
,
&
exists
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
exists
,
"got %d
\n
"
,
exists
);
hr
=
IDWriteFontCollection_GetFontFamily
(
collection
,
index
,
&
family
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
IDWriteFontFamily_GetFirstMatchingFont
(
family
,
DWRITE_FONT_WEIGHT_NORMAL
,
...
...
@@ -1497,6 +1506,15 @@ static void test_GetFirstMatchingFont(void)
DWRITE_FONT_STRETCH_NORMAL
,
DWRITE_FONT_STYLE_NORMAL
,
&
font2
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
font
!=
font2
,
"got %p, %p
\n
"
,
font
,
font2
);
IDWriteFont_Release
(
font
);
hr
=
IDWriteFontFamily_GetFirstMatchingFont
(
family
,
DWRITE_FONT_WEIGHT_NORMAL
,
DWRITE_FONT_STRETCH_NORMAL
,
DWRITE_FONT_STYLE_ITALIC
,
&
font
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
simulations
=
IDWriteFont_GetSimulations
(
font
);
todo_wine
ok
(
simulations
==
DWRITE_FONT_SIMULATIONS_OBLIQUE
,
"%d
\n
"
,
simulations
);
IDWriteFont_Release
(
font
);
IDWriteFont_Release
(
font2
);
...
...
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