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
d800cd74
Commit
d800cd74
authored
Jul 18, 2022
by
Nikolay Sivov
Committed by
Alexandre Julliard
Jul 22, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dwrite: Extend matching font creation helper.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
parent
fcbb0f6c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
16 deletions
+22
-16
analyzer.c
dlls/dwrite/analyzer.c
+14
-6
dwrite_private.h
dlls/dwrite/dwrite_private.h
+2
-2
layout.c
dlls/dwrite/layout.c
+6
-8
No files found.
dlls/dwrite/analyzer.c
View file @
d800cd74
...
...
@@ -2129,15 +2129,16 @@ static const struct fallback_mapping *find_fallback_mapping(struct dwrite_fontfa
return
NULL
;
}
HRESULT
create_matching_font
(
IDWriteFontCollection
*
collection
,
const
WCHAR
*
name
,
DWRITE_FONT_WEIGHT
weight
,
DWRITE_FONT_STYLE
style
,
DWRITE_FONT_STRETCH
stretch
,
IDWriteFont
**
font
)
HRESULT
create_matching_font
(
IDWriteFontCollection
*
collection
,
const
WCHAR
*
name
,
DWRITE_FONT_WEIGHT
weight
,
DWRITE_FONT_STYLE
style
,
DWRITE_FONT_STRETCH
stretch
,
REFIID
riid
,
void
**
obj
)
{
IDWriteFontFamily
*
family
;
BOOL
exists
=
FALSE
;
IDWriteFont
*
font
;
HRESULT
hr
;
UINT32
i
;
*
font
=
NULL
;
*
obj
=
NULL
;
hr
=
IDWriteFontCollection_FindFamilyName
(
collection
,
name
,
&
i
,
&
exists
);
if
(
FAILED
(
hr
))
...
...
@@ -2150,8 +2151,15 @@ HRESULT create_matching_font(IDWriteFontCollection *collection, const WCHAR *nam
if
(
FAILED
(
hr
))
return
hr
;
hr
=
IDWriteFontFamily_GetFirstMatchingFont
(
family
,
weight
,
stretch
,
style
,
font
);
hr
=
IDWriteFontFamily_GetFirstMatchingFont
(
family
,
weight
,
stretch
,
style
,
&
font
);
IDWriteFontFamily_Release
(
family
);
if
(
SUCCEEDED
(
hr
))
{
hr
=
IDWriteFont_QueryInterface
(
font
,
riid
,
obj
);
IDWriteFont_Release
(
font
);
}
return
hr
;
}
...
...
@@ -2200,7 +2208,7 @@ static HRESULT fallback_get_fallback_font(struct dwrite_fontfallback *fallback,
/* Now let's see what fallback can handle. Pick first font that could be created. */
for
(
i
=
0
;
i
<
mapping
->
families_count
;
i
++
)
{
hr
=
create_matching_font
((
IDWriteFontCollection
*
)
fallback
->
systemcollection
,
mapping
->
families
[
i
],
weight
,
style
,
stretch
,
mapped_font
);
weight
,
style
,
stretch
,
&
IID_IDWriteFont
,
(
void
**
)
mapped_font
);
if
(
hr
==
S_OK
)
{
TRACE
(
"Created fallback font using family %s.
\n
"
,
debugstr_w
(
mapping
->
families
[
i
]));
break
;
...
...
@@ -2255,7 +2263,7 @@ static HRESULT WINAPI fontfallback_MapCharacters(IDWriteFontFallback1 *iface, ID
goto
done
;
if
(
basefamily
&&
*
basefamily
)
{
hr
=
create_matching_font
(
basecollection
,
basefamily
,
weight
,
style
,
stretch
,
ret_font
);
hr
=
create_matching_font
(
basecollection
,
basefamily
,
weight
,
style
,
stretch
,
&
IID_IDWriteFont
,
(
void
**
)
ret_font
);
if
(
FAILED
(
hr
))
goto
done
;
...
...
dlls/dwrite/dwrite_private.h
View file @
d800cd74
...
...
@@ -324,8 +324,8 @@ extern BOOL lb_is_newline_char(WCHAR) DECLSPEC_HIDDEN;
extern
HRESULT
create_system_fontfallback
(
IDWriteFactory7
*
factory
,
IDWriteFontFallback1
**
fallback
)
DECLSPEC_HIDDEN
;
extern
void
release_system_fontfallback
(
IDWriteFontFallback1
*
fallback
)
DECLSPEC_HIDDEN
;
extern
HRESULT
create_fontfallback_builder
(
IDWriteFactory7
*
factory
,
IDWriteFontFallbackBuilder
**
builder
)
DECLSPEC_HIDDEN
;
extern
HRESULT
create_matching_font
(
IDWriteFontCollection
*
,
const
WCHAR
*
,
DWRITE_FONT_WEIGHT
,
DWRITE_FONT_STYLE
,
DWRITE_FONT_STRETCH
,
IDWriteFont
**
)
DECLSPEC_HIDDEN
;
extern
HRESULT
create_matching_font
(
IDWriteFontCollection
*
collection
,
const
WCHAR
*
family
,
DWRITE_FONT_WEIGHT
weight
,
DWRITE_FONT_STYLE
style
,
DWRITE_FONT_STRETCH
stretch
,
REFIID
riid
,
void
**
obj
)
DECLSPEC_HIDDEN
;
extern
HRESULT
create_fontfacereference
(
IDWriteFactory7
*
factory
,
IDWriteFontFile
*
file
,
UINT32
face_index
,
DWRITE_FONT_SIMULATIONS
simulations
,
DWRITE_FONT_AXIS_VALUE
const
*
axis_values
,
UINT32
axis_values_count
,
IDWriteFontFaceReference1
**
reference
)
DECLSPEC_HIDDEN
;
...
...
dlls/dwrite/layout.c
View file @
d800cd74
...
...
@@ -682,7 +682,8 @@ static HRESULT layout_resolve_fonts(struct dwrite_textlayout *layout)
collection
=
range
->
collection
?
range
->
collection
:
sys_collection
;
if
(
FAILED
(
hr
=
create_matching_font
(
collection
,
range
->
fontfamily
,
range
->
weight
,
range
->
style
,
range
->
stretch
,
&
font
)))
{
range
->
stretch
,
&
IID_IDWriteFont
,
(
void
**
)
&
font
)))
{
WARN
(
"%s: failed to create matching font for non visual run, family %s, collection %p
\n
"
,
debugstr_rundescr
(
&
run
->
descr
),
debugstr_w
(
range
->
fontfamily
),
range
->
collection
);
break
;
...
...
@@ -1828,14 +1829,11 @@ static HRESULT layout_set_dummy_line_metrics(struct dwrite_textlayout *layout, U
HRESULT
hr
;
range
=
get_layout_range_by_pos
(
layout
,
pos
);
hr
=
create_matching_font
(
range
->
collection
,
range
->
fontfamily
,
range
->
weight
,
range
->
style
,
range
->
stretch
,
&
font
);
if
(
FAILED
(
hr
))
if
(
FAILED
(
hr
=
create_matching_font
(
range
->
collection
,
range
->
fontfamily
,
range
->
weight
,
range
->
style
,
range
->
stretch
,
&
IID_IDWriteFont
,
(
void
**
)
&
font
)))
{
return
hr
;
}
hr
=
IDWriteFont_CreateFontFace
(
font
,
&
fontface
);
IDWriteFont_Release
(
font
);
if
(
FAILED
(
hr
))
...
...
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