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
57665edc
Commit
57665edc
authored
Jan 24, 2020
by
Nikolay Sivov
Committed by
Alexandre Julliard
Jan 24, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dwrite: Implement GetFaceNames() for fontfaces.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
7299735f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
65 additions
and
28 deletions
+65
-28
dwrite_private.h
dlls/dwrite/dwrite_private.h
+3
-1
font.c
dlls/dwrite/font.c
+32
-25
main.c
dlls/dwrite/main.c
+1
-1
font.c
dlls/dwrite/tests/font.c
+29
-1
No files found.
dlls/dwrite/dwrite_private.h
View file @
57665edc
...
...
@@ -231,6 +231,8 @@ struct dwrite_fontface
FONTSIGNATURE
fontsig
;
UINT32
glyph_image_formats
;
IDWriteLocalizedStrings
*
names
;
struct
scriptshaping_cache
*
shaping_cache
;
LOGFONTW
lf
;
...
...
@@ -245,7 +247,7 @@ extern HRESULT create_trimmingsign(IDWriteFactory7 *factory, IDWriteTextFormat *
extern
HRESULT
create_typography
(
IDWriteTypography
**
)
DECLSPEC_HIDDEN
;
extern
HRESULT
create_localizedstrings
(
IDWriteLocalizedStrings
**
)
DECLSPEC_HIDDEN
;
extern
HRESULT
add_localizedstring
(
IDWriteLocalizedStrings
*
,
const
WCHAR
*
,
const
WCHAR
*
)
DECLSPEC_HIDDEN
;
extern
HRESULT
clone_localizedstring
(
IDWriteLocalizedStrings
*
iface
,
IDWriteLocalizedStrings
**
strings
)
DECLSPEC_HIDDEN
;
extern
HRESULT
clone_localizedstring
s
(
IDWriteLocalizedStrings
*
iface
,
IDWriteLocalizedStrings
**
strings
)
DECLSPEC_HIDDEN
;
extern
void
set_en_localizedstring
(
IDWriteLocalizedStrings
*
,
const
WCHAR
*
)
DECLSPEC_HIDDEN
;
extern
void
sort_localizedstrings
(
IDWriteLocalizedStrings
*
)
DECLSPEC_HIDDEN
;
extern
HRESULT
get_system_fontcollection
(
IDWriteFactory7
*
factory
,
IDWriteFontCollection1
**
collection
)
DECLSPEC_HIDDEN
;
...
...
dlls/dwrite/font.c
View file @
57665edc
...
...
@@ -539,6 +539,8 @@ static ULONG WINAPI dwritefontface_Release(IDWriteFontFace5 *iface)
if
(
fontface
->
stream
)
IDWriteFontFileStream_Release
(
fontface
->
stream
);
heap_free
(
fontface
->
files
);
if
(
fontface
->
names
)
IDWriteLocalizedStrings_Release
(
fontface
->
names
);
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
fontface
->
glyphs
);
i
++
)
heap_free
(
fontface
->
glyphs
[
i
]);
...
...
@@ -1259,9 +1261,11 @@ static HRESULT WINAPI dwritefontface3_GetFamilyNames(IDWriteFontFace5 *iface, ID
static
HRESULT
WINAPI
dwritefontface3_GetFaceNames
(
IDWriteFontFace5
*
iface
,
IDWriteLocalizedStrings
**
names
)
{
FIXME
(
"%p, %p: stub
\n
"
,
iface
,
names
);
struct
dwrite_fontface
*
fontface
=
impl_from_IDWriteFontFace5
(
iface
);
return
E_NOTIMPL
;
TRACE
(
"%p, %p.
\n
"
,
iface
,
names
);
return
clone_localizedstrings
(
fontface
->
names
,
names
);
}
static
HRESULT
WINAPI
dwritefontface3_GetInformationalStrings
(
IDWriteFontFace5
*
iface
,
...
...
@@ -1616,9 +1620,11 @@ static BOOL WINAPI dwritefont_IsSymbolFont(IDWriteFont3 *iface)
static
HRESULT
WINAPI
dwritefont_GetFaceNames
(
IDWriteFont3
*
iface
,
IDWriteLocalizedStrings
**
names
)
{
struct
dwrite_font
*
This
=
impl_from_IDWriteFont3
(
iface
);
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
names
);
return
clone_localizedstring
(
This
->
data
->
names
,
names
);
struct
dwrite_font
*
font
=
impl_from_IDWriteFont3
(
iface
);
TRACE
(
"%p, %p.
\n
"
,
iface
,
names
);
return
clone_localizedstrings
(
font
->
data
->
names
,
names
);
}
static
HRESULT
WINAPI
dwritefont_GetInformationalStrings
(
IDWriteFont3
*
iface
,
...
...
@@ -1663,7 +1669,7 @@ static HRESULT WINAPI dwritefont_GetInformationalStrings(IDWriteFont3 *iface,
IDWriteFontFace5_Release
(
fontface
);
}
hr
=
clone_localizedstring
(
data
->
info_strings
[
stringid
],
strings
);
hr
=
clone_localizedstring
s
(
data
->
info_strings
[
stringid
],
strings
);
if
(
FAILED
(
hr
))
return
hr
;
...
...
@@ -2166,7 +2172,10 @@ static HRESULT WINAPI dwritefontfamily_GetFont(IDWriteFontFamily2 *iface, UINT32
static
HRESULT
WINAPI
dwritefontfamily_GetFamilyNames
(
IDWriteFontFamily2
*
iface
,
IDWriteLocalizedStrings
**
names
)
{
struct
dwrite_fontfamily
*
family
=
impl_from_IDWriteFontFamily2
(
iface
);
return
clone_localizedstring
(
family
->
data
->
familyname
,
names
);
TRACE
(
"%p, %p.
\n
"
,
iface
,
names
);
return
clone_localizedstrings
(
family
->
data
->
familyname
,
names
);
}
static
BOOL
is_better_font_match
(
const
struct
dwrite_font_propvec
*
next
,
const
struct
dwrite_font_propvec
*
cur
,
...
...
@@ -4614,6 +4623,7 @@ HRESULT create_font_file(IDWriteFontFileLoader *loader, const void *reference_ke
HRESULT
create_fontface
(
const
struct
fontface_desc
*
desc
,
struct
list
*
cached_list
,
IDWriteFontFace5
**
ret
)
{
struct
file_stream_desc
stream_desc
;
struct
dwrite_font_data
*
font_data
;
struct
dwrite_fontface
*
fontface
;
HRESULT
hr
;
int
i
;
...
...
@@ -4678,38 +4688,35 @@ HRESULT create_fontface(const struct fontface_desc *desc, struct list *cached_li
*/
if
(
desc
->
font_data
)
{
fontface
->
weight
=
desc
->
font_data
->
weight
;
fontface
->
style
=
desc
->
font_data
->
style
;
fontface
->
stretch
=
desc
->
font_data
->
stretch
;
fontface
->
panose
=
desc
->
font_data
->
panose
;
fontface
->
fontsig
=
desc
->
font_data
->
fontsig
;
fontface
->
lf
=
desc
->
font_data
->
lf
;
fontface
->
flags
|=
desc
->
font_data
->
flags
&
(
FONT_IS_SYMBOL
|
FONT_IS_MONOSPACED
|
FONT_IS_COLORED
);
font_data
=
desc
->
font_data
;
addref_font_data
(
font_data
);
}
else
{
IDWriteLocalizedStrings
*
names
;
struct
dwrite_font_data
*
data
;
hr
=
init_font_data
(
desc
,
&
names
,
&
data
);
hr
=
init_font_data
(
desc
,
&
names
,
&
font_
data
);
if
(
FAILED
(
hr
))
{
IDWriteFontFace5_Release
(
&
fontface
->
IDWriteFontFace5_iface
);
return
hr
;
}
fontface
->
weight
=
data
->
weight
;
fontface
->
style
=
data
->
style
;
fontface
->
stretch
=
data
->
stretch
;
fontface
->
panose
=
data
->
panose
;
fontface
->
fontsig
=
data
->
fontsig
;
fontface
->
lf
=
data
->
lf
;
fontface
->
flags
|=
data
->
flags
&
(
FONT_IS_SYMBOL
|
FONT_IS_MONOSPACED
|
FONT_IS_COLORED
);
IDWriteLocalizedStrings_Release
(
names
);
release_font_data
(
data
);
}
fontface
->
weight
=
font_data
->
weight
;
fontface
->
style
=
font_data
->
style
;
fontface
->
stretch
=
font_data
->
stretch
;
fontface
->
panose
=
font_data
->
panose
;
fontface
->
fontsig
=
font_data
->
fontsig
;
fontface
->
lf
=
font_data
->
lf
;
fontface
->
flags
|=
font_data
->
flags
&
(
FONT_IS_SYMBOL
|
FONT_IS_MONOSPACED
|
FONT_IS_COLORED
);
fontface
->
names
=
font_data
->
names
;
if
(
fontface
->
names
)
IDWriteLocalizedStrings_AddRef
(
fontface
->
names
);
release_font_data
(
font_data
);
fontface
->
cached
=
factory_cache_fontface
(
fontface
->
factory
,
cached_list
,
&
fontface
->
IDWriteFontFace5_iface
);
*
ret
=
&
fontface
->
IDWriteFontFace5_iface
;
...
...
dlls/dwrite/main.c
View file @
57665edc
...
...
@@ -468,7 +468,7 @@ HRESULT add_localizedstring(IDWriteLocalizedStrings *iface, const WCHAR *locale,
return
S_OK
;
}
HRESULT
clone_localizedstring
(
IDWriteLocalizedStrings
*
iface
,
IDWriteLocalizedStrings
**
ret
)
HRESULT
clone_localizedstring
s
(
IDWriteLocalizedStrings
*
iface
,
IDWriteLocalizedStrings
**
ret
)
{
struct
localizedstrings
*
strings
,
*
strings_clone
;
size_t
i
;
...
...
dlls/dwrite/tests/font.c
View file @
57665edc
...
...
@@ -4410,8 +4410,10 @@ static void test_GetFaceNames(void)
static
const
WCHAR
obliqueW
[]
=
{
'O'
,
'b'
,
'l'
,
'i'
,
'q'
,
'u'
,
'e'
,
0
};
static
const
WCHAR
enus2W
[]
=
{
'e'
,
'n'
,
'-'
,
'U'
,
's'
,
0
};
static
const
WCHAR
enusW
[]
=
{
'e'
,
'n'
,
'-'
,
'u'
,
's'
,
0
};
IDWriteLocalizedStrings
*
strings
,
*
strings2
;
IDWriteLocalizedStrings
*
strings
,
*
strings2
,
*
strings3
;
IDWriteFontFace3
*
fontface3
;
IDWriteGdiInterop
*
interop
;
IDWriteFontFace
*
fontface
;
IDWriteFactory
*
factory
;
UINT32
count
,
index
;
IDWriteFont
*
font
;
...
...
@@ -4470,6 +4472,32 @@ static void test_GetFaceNames(void)
ok
(
!
lstrcmpW
(
buffW
,
obliqueW
),
"got %s
\n
"
,
wine_dbgstr_w
(
buffW
));
IDWriteLocalizedStrings_Release
(
strings
);
hr
=
IDWriteFont_CreateFontFace
(
font
,
&
fontface
);
ok
(
hr
==
S_OK
,
"Failed to create a font face, hr %#x.
\n
"
,
hr
);
if
(
SUCCEEDED
(
IDWriteFontFace_QueryInterface
(
fontface
,
&
IID_IDWriteFontFace3
,
(
void
**
)
&
fontface3
)))
{
hr
=
IDWriteFontFace3_GetFaceNames
(
fontface3
,
&
strings2
);
ok
(
hr
==
S_OK
,
"Failed to get face names, hr %#x.
\n
"
,
hr
);
hr
=
IDWriteFontFace3_GetFaceNames
(
fontface3
,
&
strings3
);
ok
(
hr
==
S_OK
,
"Failed to get face names, hr %#x.
\n
"
,
hr
);
ok
(
strings2
!=
strings3
,
"Unexpected instance.
\n
"
);
IDWriteLocalizedStrings_Release
(
strings3
);
buffW
[
0
]
=
0
;
hr
=
IDWriteLocalizedStrings_GetString
(
strings2
,
0
,
buffW
,
ARRAY_SIZE
(
buffW
));
ok
(
hr
==
S_OK
,
"Failed to get a string, hr %#x.
\n
"
,
hr
);
ok
(
!
lstrcmpW
(
buffW
,
obliqueW
),
"Unexpected name %s.
\n
"
,
wine_dbgstr_w
(
buffW
));
IDWriteLocalizedStrings_Release
(
strings2
);
IDWriteFontFace3_Release
(
fontface3
);
}
else
win_skip
(
"GetFaceNames() is not supported.
\n
"
);
IDWriteFontFace_Release
(
fontface
);
IDWriteFont_Release
(
font
);
IDWriteGdiInterop_Release
(
interop
);
ref
=
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