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
eb212c19
Commit
eb212c19
authored
Aug 15, 2017
by
Nikolay Sivov
Committed by
Alexandre Julliard
Aug 20, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dwrite: Simplify GetFontSignature().
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
b93d9d93
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
60 deletions
+40
-60
dwrite_private.h
dlls/dwrite/dwrite_private.h
+3
-1
font.c
dlls/dwrite/font.c
+19
-0
gdiinterop.c
dlls/dwrite/gdiinterop.c
+2
-31
opentype.c
dlls/dwrite/opentype.c
+16
-28
No files found.
dlls/dwrite/dwrite_private.h
View file @
eb212c19
...
@@ -202,6 +202,8 @@ extern void factory_detach_gdiinterop(IDWriteFactory5*,IDWriteGdiInterop1*) DECL
...
@@ -202,6 +202,8 @@ extern void factory_detach_gdiinterop(IDWriteFactory5*,IDWriteGdiInterop1*) DECL
extern
struct
fontfacecached
*
factory_cache_fontface
(
IDWriteFactory5
*
,
struct
list
*
,
IDWriteFontFace4
*
)
DECLSPEC_HIDDEN
;
extern
struct
fontfacecached
*
factory_cache_fontface
(
IDWriteFactory5
*
,
struct
list
*
,
IDWriteFontFace4
*
)
DECLSPEC_HIDDEN
;
extern
void
get_logfont_from_font
(
IDWriteFont
*
,
LOGFONTW
*
)
DECLSPEC_HIDDEN
;
extern
void
get_logfont_from_font
(
IDWriteFont
*
,
LOGFONTW
*
)
DECLSPEC_HIDDEN
;
extern
void
get_logfont_from_fontface
(
IDWriteFontFace
*
,
LOGFONTW
*
)
DECLSPEC_HIDDEN
;
extern
void
get_logfont_from_fontface
(
IDWriteFontFace
*
,
LOGFONTW
*
)
DECLSPEC_HIDDEN
;
extern
HRESULT
get_fontsig_from_font
(
IDWriteFont
*
,
FONTSIGNATURE
*
)
DECLSPEC_HIDDEN
;
extern
HRESULT
get_fontsig_from_fontface
(
IDWriteFontFace
*
,
FONTSIGNATURE
*
)
DECLSPEC_HIDDEN
;
extern
HRESULT
create_gdiinterop
(
IDWriteFactory5
*
,
IDWriteGdiInterop1
**
)
DECLSPEC_HIDDEN
;
extern
HRESULT
create_gdiinterop
(
IDWriteFactory5
*
,
IDWriteGdiInterop1
**
)
DECLSPEC_HIDDEN
;
extern
void
fontface_detach_from_cache
(
IDWriteFontFace4
*
)
DECLSPEC_HIDDEN
;
extern
void
fontface_detach_from_cache
(
IDWriteFontFace4
*
)
DECLSPEC_HIDDEN
;
extern
void
factory_lock
(
IDWriteFactory5
*
)
DECLSPEC_HIDDEN
;
extern
void
factory_lock
(
IDWriteFactory5
*
)
DECLSPEC_HIDDEN
;
...
@@ -213,6 +215,7 @@ struct dwrite_font_props {
...
@@ -213,6 +215,7 @@ struct dwrite_font_props {
DWRITE_FONT_STRETCH
stretch
;
DWRITE_FONT_STRETCH
stretch
;
DWRITE_FONT_WEIGHT
weight
;
DWRITE_FONT_WEIGHT
weight
;
DWRITE_PANOSE
panose
;
DWRITE_PANOSE
panose
;
FONTSIGNATURE
fontsig
;
LOGFONTW
lf
;
LOGFONTW
lf
;
};
};
...
@@ -235,7 +238,6 @@ extern BOOL opentype_get_vdmx_size(const void*,INT,UINT16*,UINT16*) DECLSPEC_HID
...
@@ -235,7 +238,6 @@ extern BOOL opentype_get_vdmx_size(const void*,INT,UINT16*,UINT16*) DECLSPEC_HID
extern
UINT32
opentype_get_cpal_palettecount
(
const
void
*
)
DECLSPEC_HIDDEN
;
extern
UINT32
opentype_get_cpal_palettecount
(
const
void
*
)
DECLSPEC_HIDDEN
;
extern
UINT32
opentype_get_cpal_paletteentrycount
(
const
void
*
)
DECLSPEC_HIDDEN
;
extern
UINT32
opentype_get_cpal_paletteentrycount
(
const
void
*
)
DECLSPEC_HIDDEN
;
extern
HRESULT
opentype_get_cpal_entries
(
const
void
*
,
UINT32
,
UINT32
,
UINT32
,
DWRITE_COLOR_F
*
)
DECLSPEC_HIDDEN
;
extern
HRESULT
opentype_get_cpal_entries
(
const
void
*
,
UINT32
,
UINT32
,
UINT32
,
DWRITE_COLOR_F
*
)
DECLSPEC_HIDDEN
;
extern
HRESULT
opentype_get_font_signature
(
struct
file_stream_desc
*
,
FONTSIGNATURE
*
)
DECLSPEC_HIDDEN
;
extern
BOOL
opentype_has_vertical_variants
(
IDWriteFontFace4
*
)
DECLSPEC_HIDDEN
;
extern
BOOL
opentype_has_vertical_variants
(
IDWriteFontFace4
*
)
DECLSPEC_HIDDEN
;
extern
UINT32
opentype_get_glyph_image_formats
(
IDWriteFontFace4
*
)
DECLSPEC_HIDDEN
;
extern
UINT32
opentype_get_glyph_image_formats
(
IDWriteFontFace4
*
)
DECLSPEC_HIDDEN
;
...
...
dlls/dwrite/font.c
View file @
eb212c19
...
@@ -76,6 +76,7 @@ struct dwrite_font_data {
...
@@ -76,6 +76,7 @@ struct dwrite_font_data {
DWRITE_FONT_STRETCH
stretch
;
DWRITE_FONT_STRETCH
stretch
;
DWRITE_FONT_WEIGHT
weight
;
DWRITE_FONT_WEIGHT
weight
;
DWRITE_PANOSE
panose
;
DWRITE_PANOSE
panose
;
FONTSIGNATURE
fontsig
;
struct
dwrite_font_propvec
propvec
;
struct
dwrite_font_propvec
propvec
;
DWRITE_FONT_METRICS1
metrics
;
DWRITE_FONT_METRICS1
metrics
;
...
@@ -242,6 +243,7 @@ struct dwrite_fontface {
...
@@ -242,6 +243,7 @@ struct dwrite_fontface {
DWRITE_FONT_STRETCH
stretch
;
DWRITE_FONT_STRETCH
stretch
;
DWRITE_FONT_WEIGHT
weight
;
DWRITE_FONT_WEIGHT
weight
;
DWRITE_PANOSE
panose
;
DWRITE_PANOSE
panose
;
FONTSIGNATURE
fontsig
;
UINT32
glyph_image_formats
;
UINT32
glyph_image_formats
;
LOGFONTW
lf
;
LOGFONTW
lf
;
...
@@ -1769,6 +1771,20 @@ void get_logfont_from_fontface(IDWriteFontFace *iface, LOGFONTW *lf)
...
@@ -1769,6 +1771,20 @@ void get_logfont_from_fontface(IDWriteFontFace *iface, LOGFONTW *lf)
*
lf
=
fontface
->
lf
;
*
lf
=
fontface
->
lf
;
}
}
HRESULT
get_fontsig_from_font
(
IDWriteFont
*
iface
,
FONTSIGNATURE
*
fontsig
)
{
struct
dwrite_font
*
font
=
unsafe_impl_from_IDWriteFont
(
iface
);
*
fontsig
=
font
->
data
->
fontsig
;
return
S_OK
;
}
HRESULT
get_fontsig_from_fontface
(
IDWriteFontFace
*
iface
,
FONTSIGNATURE
*
fontsig
)
{
struct
dwrite_fontface
*
fontface
=
unsafe_impl_from_IDWriteFontFace
(
iface
);
*
fontsig
=
fontface
->
fontsig
;
return
S_OK
;
}
static
HRESULT
create_font
(
struct
dwrite_fontfamily
*
family
,
UINT32
index
,
IDWriteFont3
**
font
)
static
HRESULT
create_font
(
struct
dwrite_fontfamily
*
family
,
UINT32
index
,
IDWriteFont3
**
font
)
{
{
struct
dwrite_font
*
This
;
struct
dwrite_font
*
This
;
...
@@ -3344,6 +3360,7 @@ static HRESULT init_font_data(const struct fontface_desc *desc, IDWriteLocalized
...
@@ -3344,6 +3360,7 @@ static HRESULT init_font_data(const struct fontface_desc *desc, IDWriteLocalized
data
->
stretch
=
props
.
stretch
;
data
->
stretch
=
props
.
stretch
;
data
->
weight
=
props
.
weight
;
data
->
weight
=
props
.
weight
;
data
->
panose
=
props
.
panose
;
data
->
panose
=
props
.
panose
;
data
->
fontsig
=
props
.
fontsig
;
data
->
lf
=
props
.
lf
;
data
->
lf
=
props
.
lf
;
fontstrings_get_en_string
(
*
family_name
,
familyW
,
sizeof
(
familyW
)
/
sizeof
(
WCHAR
));
fontstrings_get_en_string
(
*
family_name
,
familyW
,
sizeof
(
familyW
)
/
sizeof
(
WCHAR
));
...
@@ -4383,6 +4400,7 @@ HRESULT create_fontface(const struct fontface_desc *desc, struct list *cached_li
...
@@ -4383,6 +4400,7 @@ HRESULT create_fontface(const struct fontface_desc *desc, struct list *cached_li
fontface
->
style
=
desc
->
font_data
->
style
;
fontface
->
style
=
desc
->
font_data
->
style
;
fontface
->
stretch
=
desc
->
font_data
->
stretch
;
fontface
->
stretch
=
desc
->
font_data
->
stretch
;
fontface
->
panose
=
desc
->
font_data
->
panose
;
fontface
->
panose
=
desc
->
font_data
->
panose
;
fontface
->
fontsig
=
desc
->
font_data
->
fontsig
;
fontface
->
lf
=
desc
->
font_data
->
lf
;
fontface
->
lf
=
desc
->
font_data
->
lf
;
}
}
else
{
else
{
...
@@ -4399,6 +4417,7 @@ HRESULT create_fontface(const struct fontface_desc *desc, struct list *cached_li
...
@@ -4399,6 +4417,7 @@ HRESULT create_fontface(const struct fontface_desc *desc, struct list *cached_li
fontface
->
style
=
data
->
style
;
fontface
->
style
=
data
->
style
;
fontface
->
stretch
=
data
->
stretch
;
fontface
->
stretch
=
data
->
stretch
;
fontface
->
panose
=
data
->
panose
;
fontface
->
panose
=
data
->
panose
;
fontface
->
fontsig
=
data
->
fontsig
;
fontface
->
lf
=
data
->
lf
;
fontface
->
lf
=
data
->
lf
;
IDWriteLocalizedStrings_Release
(
names
);
IDWriteLocalizedStrings_Release
(
names
);
...
...
dlls/dwrite/gdiinterop.c
View file @
eb212c19
...
@@ -838,51 +838,22 @@ static HRESULT WINAPI gdiinterop1_GetFontSignature_(IDWriteGdiInterop1 *iface, I
...
@@ -838,51 +838,22 @@ static HRESULT WINAPI gdiinterop1_GetFontSignature_(IDWriteGdiInterop1 *iface, I
FONTSIGNATURE
*
fontsig
)
FONTSIGNATURE
*
fontsig
)
{
{
struct
gdiinterop
*
This
=
impl_from_IDWriteGdiInterop1
(
iface
);
struct
gdiinterop
*
This
=
impl_from_IDWriteGdiInterop1
(
iface
);
struct
file_stream_desc
stream_desc
;
IDWriteFontFileStream
*
stream
;
IDWriteFontFile
*
file
;
UINT32
count
;
HRESULT
hr
;
TRACE
(
"(%p)->(%p %p)
\n
"
,
This
,
fontface
,
fontsig
);
TRACE
(
"(%p)->(%p %p)
\n
"
,
This
,
fontface
,
fontsig
);
memset
(
fontsig
,
0
,
sizeof
(
*
fontsig
));
return
get_fontsig_from_fontface
(
fontface
,
fontsig
);
count
=
1
;
hr
=
IDWriteFontFace_GetFiles
(
fontface
,
&
count
,
&
file
);
hr
=
get_filestream_from_file
(
file
,
&
stream
);
IDWriteFontFile_Release
(
file
);
if
(
FAILED
(
hr
))
return
hr
;
stream_desc
.
stream
=
stream
;
stream_desc
.
face_type
=
IDWriteFontFace_GetType
(
fontface
);
stream_desc
.
face_index
=
IDWriteFontFace_GetIndex
(
fontface
);
hr
=
opentype_get_font_signature
(
&
stream_desc
,
fontsig
);
IDWriteFontFileStream_Release
(
stream
);
return
hr
;
}
}
static
HRESULT
WINAPI
gdiinterop1_GetFontSignature
(
IDWriteGdiInterop1
*
iface
,
IDWriteFont
*
font
,
FONTSIGNATURE
*
fontsig
)
static
HRESULT
WINAPI
gdiinterop1_GetFontSignature
(
IDWriteGdiInterop1
*
iface
,
IDWriteFont
*
font
,
FONTSIGNATURE
*
fontsig
)
{
{
struct
gdiinterop
*
This
=
impl_from_IDWriteGdiInterop1
(
iface
);
struct
gdiinterop
*
This
=
impl_from_IDWriteGdiInterop1
(
iface
);
IDWriteFontFace
*
fontface
;
HRESULT
hr
;
TRACE
(
"(%p)->(%p %p)
\n
"
,
This
,
font
,
fontsig
);
TRACE
(
"(%p)->(%p %p)
\n
"
,
This
,
font
,
fontsig
);
if
(
!
font
)
if
(
!
font
)
return
E_INVALIDARG
;
return
E_INVALIDARG
;
memset
(
fontsig
,
0
,
sizeof
(
*
fontsig
));
return
get_fontsig_from_font
(
font
,
fontsig
);
hr
=
IDWriteFont_CreateFontFace
(
font
,
&
fontface
);
if
(
FAILED
(
hr
))
return
hr
;
hr
=
IDWriteGdiInterop1_GetFontSignature_
(
iface
,
fontface
,
fontsig
);
IDWriteFontFace_Release
(
fontface
);
return
hr
;
}
}
static
HRESULT
WINAPI
gdiinterop1_GetMatchingFontsByLOGFONT
(
IDWriteGdiInterop1
*
iface
,
LOGFONTW
const
*
logfont
,
static
HRESULT
WINAPI
gdiinterop1_GetMatchingFontsByLOGFONT
(
IDWriteGdiInterop1
*
iface
,
LOGFONTW
const
*
logfont
,
...
...
dlls/dwrite/opentype.c
View file @
eb212c19
...
@@ -1317,6 +1317,7 @@ void opentype_get_font_properties(struct file_stream_desc *stream_desc, struct d
...
@@ -1317,6 +1317,7 @@ void opentype_get_font_properties(struct file_stream_desc *stream_desc, struct d
props
->
weight
=
DWRITE_FONT_WEIGHT_NORMAL
;
props
->
weight
=
DWRITE_FONT_WEIGHT_NORMAL
;
props
->
style
=
DWRITE_FONT_STYLE_NORMAL
;
props
->
style
=
DWRITE_FONT_STYLE_NORMAL
;
memset
(
&
props
->
panose
,
0
,
sizeof
(
props
->
panose
));
memset
(
&
props
->
panose
,
0
,
sizeof
(
props
->
panose
));
memset
(
&
props
->
fontsig
,
0
,
sizeof
(
props
->
fontsig
));
memset
(
&
props
->
lf
,
0
,
sizeof
(
props
->
lf
));
memset
(
&
props
->
lf
,
0
,
sizeof
(
props
->
lf
));
/* DWRITE_FONT_STRETCH enumeration values directly match font data values */
/* DWRITE_FONT_STRETCH enumeration values directly match font data values */
...
@@ -1343,6 +1344,21 @@ void opentype_get_font_properties(struct file_stream_desc *stream_desc, struct d
...
@@ -1343,6 +1344,21 @@ void opentype_get_font_properties(struct file_stream_desc *stream_desc, struct d
props
->
style
=
DWRITE_FONT_STYLE_ITALIC
;
props
->
style
=
DWRITE_FONT_STYLE_ITALIC
;
memcpy
(
&
props
->
panose
,
&
tt_os2
->
panose
,
sizeof
(
props
->
panose
));
memcpy
(
&
props
->
panose
,
&
tt_os2
->
panose
,
sizeof
(
props
->
panose
));
/* FONTSIGNATURE */
props
->
fontsig
.
fsUsb
[
0
]
=
GET_BE_DWORD
(
tt_os2
->
ulUnicodeRange1
);
props
->
fontsig
.
fsUsb
[
1
]
=
GET_BE_DWORD
(
tt_os2
->
ulUnicodeRange2
);
props
->
fontsig
.
fsUsb
[
2
]
=
GET_BE_DWORD
(
tt_os2
->
ulUnicodeRange3
);
props
->
fontsig
.
fsUsb
[
3
]
=
GET_BE_DWORD
(
tt_os2
->
ulUnicodeRange4
);
if
(
GET_BE_WORD
(
tt_os2
->
version
)
==
0
)
{
props
->
fontsig
.
fsCsb
[
0
]
=
0
;
props
->
fontsig
.
fsCsb
[
1
]
=
0
;
}
else
{
props
->
fontsig
.
fsCsb
[
0
]
=
GET_BE_DWORD
(
tt_os2
->
ulCodePageRange1
);
props
->
fontsig
.
fsCsb
[
1
]
=
GET_BE_DWORD
(
tt_os2
->
ulCodePageRange2
);
}
}
}
else
if
(
tt_head
)
{
else
if
(
tt_head
)
{
USHORT
macStyle
=
GET_BE_WORD
(
tt_head
->
macStyle
);
USHORT
macStyle
=
GET_BE_WORD
(
tt_head
->
macStyle
);
...
@@ -1971,34 +1987,6 @@ void opentype_colr_next_glyph(const void *colr, struct dwrite_colorglyph *glyph)
...
@@ -1971,34 +1987,6 @@ void opentype_colr_next_glyph(const void *colr, struct dwrite_colorglyph *glyph)
glyph
->
palette_index
=
GET_BE_WORD
(
layer
->
paletteIndex
);
glyph
->
palette_index
=
GET_BE_WORD
(
layer
->
paletteIndex
);
}
}
HRESULT
opentype_get_font_signature
(
struct
file_stream_desc
*
stream_desc
,
FONTSIGNATURE
*
fontsig
)
{
const
TT_OS2_V2
*
tt_os2
;
void
*
os2_context
;
HRESULT
hr
;
hr
=
opentype_get_font_table
(
stream_desc
,
MS_OS2_TAG
,
(
const
void
**
)
&
tt_os2
,
&
os2_context
,
NULL
,
NULL
);
if
(
tt_os2
)
{
fontsig
->
fsUsb
[
0
]
=
GET_BE_DWORD
(
tt_os2
->
ulUnicodeRange1
);
fontsig
->
fsUsb
[
1
]
=
GET_BE_DWORD
(
tt_os2
->
ulUnicodeRange2
);
fontsig
->
fsUsb
[
2
]
=
GET_BE_DWORD
(
tt_os2
->
ulUnicodeRange3
);
fontsig
->
fsUsb
[
3
]
=
GET_BE_DWORD
(
tt_os2
->
ulUnicodeRange4
);
if
(
GET_BE_WORD
(
tt_os2
->
version
)
==
0
)
{
fontsig
->
fsCsb
[
0
]
=
0
;
fontsig
->
fsCsb
[
1
]
=
0
;
}
else
{
fontsig
->
fsCsb
[
0
]
=
GET_BE_DWORD
(
tt_os2
->
ulCodePageRange1
);
fontsig
->
fsCsb
[
1
]
=
GET_BE_DWORD
(
tt_os2
->
ulCodePageRange2
);
}
IDWriteFontFileStream_ReleaseFileFragment
(
stream_desc
->
stream
,
os2_context
);
}
return
hr
;
}
BOOL
opentype_has_vertical_variants
(
IDWriteFontFace4
*
fontface
)
BOOL
opentype_has_vertical_variants
(
IDWriteFontFace4
*
fontface
)
{
{
const
OT_FeatureList
*
featurelist
;
const
OT_FeatureList
*
featurelist
;
...
...
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