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
b6ffd6cb
Commit
b6ffd6cb
authored
Mar 10, 2021
by
Nikolay Sivov
Committed by
Alexandre Julliard
Mar 10, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dwrite: Initial implementation of fontset filtering.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
0ce34328
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
93 additions
and
3 deletions
+93
-3
dwrite_private.h
dlls/dwrite/dwrite_private.h
+1
-0
font.c
dlls/dwrite/font.c
+79
-3
main.c
dlls/dwrite/main.c
+13
-0
No files found.
dlls/dwrite/dwrite_private.h
View file @
b6ffd6cb
...
...
@@ -299,6 +299,7 @@ extern HRESULT clone_localizedstrings(IDWriteLocalizedStrings *iface, IDWriteLoc
extern
void
set_en_localizedstring
(
IDWriteLocalizedStrings
*
,
const
WCHAR
*
)
DECLSPEC_HIDDEN
;
extern
void
sort_localizedstrings
(
IDWriteLocalizedStrings
*
)
DECLSPEC_HIDDEN
;
extern
unsigned
int
get_localizedstrings_count
(
IDWriteLocalizedStrings
*
strings
)
DECLSPEC_HIDDEN
;
extern
BOOL
localizedstrings_contains
(
IDWriteLocalizedStrings
*
strings
,
const
WCHAR
*
str
)
DECLSPEC_HIDDEN
;
extern
HRESULT
get_system_fontcollection
(
IDWriteFactory7
*
factory
,
IDWriteFontCollection1
**
collection
)
DECLSPEC_HIDDEN
;
extern
HRESULT
get_eudc_fontcollection
(
IDWriteFactory7
*
factory
,
IDWriteFontCollection3
**
collection
)
DECLSPEC_HIDDEN
;
extern
IDWriteTextAnalyzer2
*
get_text_analyzer
(
void
)
DECLSPEC_HIDDEN
;
...
...
dlls/dwrite/font.c
View file @
b6ffd6cb
...
...
@@ -7280,6 +7280,47 @@ static HRESULT WINAPI dwritefontset_GetPropertyOccurrenceCount(IDWriteFontSet3 *
return
E_NOTIMPL
;
}
static
BOOL
fontset_entry_is_matching
(
struct
dwrite_fontset_entry
*
entry
,
DWRITE_FONT_PROPERTY
const
*
props
,
unsigned
int
count
)
{
IDWriteLocalizedStrings
*
value
;
unsigned
int
i
;
BOOL
ret
;
for
(
i
=
0
;
i
<
count
;
++
i
)
{
switch
(
props
[
i
].
propertyId
)
{
case
DWRITE_FONT_PROPERTY_ID_POSTSCRIPT_NAME
:
case
DWRITE_FONT_PROPERTY_ID_FULL_NAME
:
if
(
!
(
value
=
fontset_entry_get_property
(
entry
,
props
[
i
].
propertyId
)))
return
FALSE
;
ret
=
localizedstrings_contains
(
value
,
props
[
i
].
propertyValue
);
IDWriteLocalizedStrings_Release
(
value
);
if
(
!
ret
)
return
FALSE
;
break
;
case
DWRITE_FONT_PROPERTY_ID_WEIGHT_STRETCH_STYLE_FAMILY_NAME
:
case
DWRITE_FONT_PROPERTY_ID_TYPOGRAPHIC_FAMILY_NAME
:
case
DWRITE_FONT_PROPERTY_ID_WEIGHT_STRETCH_STYLE_FACE_NAME
:
case
DWRITE_FONT_PROPERTY_ID_WIN32_FAMILY_NAME
:
case
DWRITE_FONT_PROPERTY_ID_DESIGN_SCRIPT_LANGUAGE_TAG
:
case
DWRITE_FONT_PROPERTY_ID_SUPPORTED_SCRIPT_LANGUAGE_TAG
:
case
DWRITE_FONT_PROPERTY_ID_SEMANTIC_TAG
:
case
DWRITE_FONT_PROPERTY_ID_WEIGHT
:
case
DWRITE_FONT_PROPERTY_ID_STRETCH
:
case
DWRITE_FONT_PROPERTY_ID_STYLE
:
case
DWRITE_FONT_PROPERTY_ID_TYPOGRAPHIC_FACE_NAME
:
FIXME
(
"Unsupported property %d.
\n
"
,
props
[
i
].
propertyId
);
/* fallthrough */
default:
return
FALSE
;
}
}
return
TRUE
;
}
static
HRESULT
WINAPI
dwritefontset_GetMatchingFonts_
(
IDWriteFontSet3
*
iface
,
WCHAR
const
*
family
,
DWRITE_FONT_WEIGHT
weight
,
DWRITE_FONT_STRETCH
stretch
,
DWRITE_FONT_STYLE
style
,
IDWriteFontSet
**
fontset
)
{
...
...
@@ -7289,11 +7330,46 @@ static HRESULT WINAPI dwritefontset_GetMatchingFonts_(IDWriteFontSet3 *iface, WC
}
static
HRESULT
WINAPI
dwritefontset_GetMatchingFonts
(
IDWriteFontSet3
*
iface
,
DWRITE_FONT_PROPERTY
const
*
props
,
UINT32
count
,
IDWriteFontSet
**
f
ont
set
)
IDWriteFontSet
**
f
iltered_
set
)
{
FIXME
(
"%p, %p, %u, %p.
\n
"
,
iface
,
props
,
count
,
fontset
);
struct
dwrite_fontset
*
set
=
impl_from_IDWriteFontSet3
(
iface
);
struct
dwrite_fontset_entry
**
entries
;
unsigned
int
i
,
matched_count
=
0
;
struct
dwrite_fontset
*
object
;
return
E_NOTIMPL
;
TRACE
(
"%p, %p, %u, %p.
\n
"
,
iface
,
props
,
count
,
filtered_set
);
if
(
!
props
&&
count
)
return
E_INVALIDARG
;
if
(
!
(
object
=
heap_alloc_zero
(
sizeof
(
*
object
))))
return
E_OUTOFMEMORY
;
if
(
!
(
entries
=
heap_calloc
(
set
->
count
,
sizeof
(
*
entries
))))
{
heap_free
(
object
);
return
E_OUTOFMEMORY
;
}
for
(
i
=
0
;
i
<
set
->
count
;
++
i
)
{
if
(
fontset_entry_is_matching
(
set
->
entries
[
i
],
props
,
count
))
{
entries
[
matched_count
++
]
=
addref_fontset_entry
(
set
->
entries
[
i
]);
}
}
if
(
!
matched_count
)
{
heap_free
(
entries
);
entries
=
NULL
;
}
init_fontset
(
object
,
set
->
factory
,
entries
,
matched_count
);
*
filtered_set
=
(
IDWriteFontSet
*
)
&
object
->
IDWriteFontSet3_iface
;
return
S_OK
;
}
static
HRESULT
WINAPI
dwritefontset1_GetMatchingFonts
(
IDWriteFontSet3
*
iface
,
DWRITE_FONT_PROPERTY
const
*
property
,
...
...
dlls/dwrite/main.c
View file @
b6ffd6cb
...
...
@@ -564,6 +564,19 @@ unsigned int get_localizedstrings_count(IDWriteLocalizedStrings *iface)
return
strings
->
count
;
}
BOOL
localizedstrings_contains
(
IDWriteLocalizedStrings
*
iface
,
const
WCHAR
*
str
)
{
struct
localizedstrings
*
strings
=
impl_from_IDWriteLocalizedStrings
(
iface
);
unsigned
int
i
;
for
(
i
=
0
;
i
<
strings
->
count
;
++
i
)
{
if
(
!
lstrcmpiW
(
strings
->
data
[
i
].
string
,
str
))
return
TRUE
;
}
return
FALSE
;
}
struct
collectionloader
{
struct
list
entry
;
...
...
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