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
50bf5fca
Commit
50bf5fca
authored
Jul 06, 2015
by
Nikolay Sivov
Committed by
Alexandre Julliard
Jul 07, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dwrite: Implement GetPanose().
parent
bb0c6f74
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
83 additions
and
18 deletions
+83
-18
dwrite_private.h
dlls/dwrite/dwrite_private.h
+8
-2
font.c
dlls/dwrite/font.c
+10
-2
gdiinterop.c
dlls/dwrite/gdiinterop.c
+4
-6
opentype.c
dlls/dwrite/opentype.c
+11
-8
font.c
dlls/dwrite/tests/font.c
+50
-0
No files found.
dlls/dwrite/dwrite_private.h
View file @
50bf5fca
...
...
@@ -125,11 +125,17 @@ extern BOOL is_face_type_supported(DWRITE_FONT_FACE_TYPE) DECLSPEC_HIDDEN;
extern
HRESULT
get_family_names_from_stream
(
IDWriteFontFileStream
*
,
UINT32
,
DWRITE_FONT_FACE_TYPE
,
IDWriteLocalizedStrings
**
)
DECLSPEC_HIDDEN
;
/* Opentype font table functions */
struct
dwrite_font_props
{
DWRITE_FONT_STYLE
style
;
DWRITE_FONT_STRETCH
stretch
;
DWRITE_FONT_WEIGHT
weight
;
DWRITE_PANOSE
panose
;
};
extern
HRESULT
opentype_analyze_font
(
IDWriteFontFileStream
*
,
UINT32
*
,
DWRITE_FONT_FILE_TYPE
*
,
DWRITE_FONT_FACE_TYPE
*
,
BOOL
*
)
DECLSPEC_HIDDEN
;
extern
HRESULT
opentype_get_font_table
(
IDWriteFontFileStream
*
,
DWRITE_FONT_FACE_TYPE
,
UINT32
,
UINT32
,
const
void
**
,
void
**
,
UINT32
*
,
BOOL
*
)
DECLSPEC_HIDDEN
;
extern
HRESULT
opentype_cmap_get_unicode_ranges
(
void
*
,
UINT32
,
DWRITE_UNICODE_RANGE
*
,
UINT32
*
)
DECLSPEC_HIDDEN
;
extern
void
opentype_get_font_properties
(
IDWriteFontFileStream
*
,
DWRITE_FONT_FACE_TYPE
,
UINT32
,
DWRITE_FONT_STRETCH
*
,
DWRITE_FONT_WEIGHT
*
,
DWRITE_FONT_STYLE
*
)
DECLSPEC_HIDDEN
;
extern
void
opentype_get_font_properties
(
IDWriteFontFileStream
*
,
DWRITE_FONT_FACE_TYPE
,
UINT32
,
struct
dwrite_font_props
*
)
DECLSPEC_HIDDEN
;
extern
void
opentype_get_font_metrics
(
IDWriteFontFileStream
*
,
DWRITE_FONT_FACE_TYPE
,
UINT32
,
DWRITE_FONT_METRICS1
*
,
DWRITE_CARET_METRICS
*
)
DECLSPEC_HIDDEN
;
extern
HRESULT
opentype_get_font_strings_from_id
(
const
void
*
,
DWRITE_INFORMATIONAL_STRING_ID
,
IDWriteLocalizedStrings
**
)
DECLSPEC_HIDDEN
;
extern
HRESULT
opentype_get_typographic_features
(
IDWriteFontFace
*
,
UINT32
,
UINT32
,
UINT32
,
UINT32
*
,
DWRITE_FONT_FEATURE_TAG
*
)
DECLSPEC_HIDDEN
;
...
...
dlls/dwrite/font.c
View file @
50bf5fca
...
...
@@ -39,6 +39,7 @@ struct dwrite_font_data {
DWRITE_FONT_STYLE
style
;
DWRITE_FONT_STRETCH
stretch
;
DWRITE_FONT_WEIGHT
weight
;
DWRITE_PANOSE
panose
;
DWRITE_FONT_METRICS1
metrics
;
IDWriteLocalizedStrings
*
info_strings
[
DWRITE_INFORMATIONAL_STRING_POSTSCRIPT_CID_NAME
+
1
];
...
...
@@ -1094,7 +1095,8 @@ static void WINAPI dwritefont1_GetMetrics(IDWriteFont2 *iface, DWRITE_FONT_METRI
static
void
WINAPI
dwritefont1_GetPanose
(
IDWriteFont2
*
iface
,
DWRITE_PANOSE
*
panose
)
{
struct
dwrite_font
*
This
=
impl_from_IDWriteFont2
(
iface
);
FIXME
(
"(%p)->(%p): stub
\n
"
,
This
,
panose
);
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
panose
);
*
panose
=
This
->
data
->
panose
;
}
static
HRESULT
WINAPI
dwritefont1_GetUnicodeRanges
(
IDWriteFont2
*
iface
,
UINT32
max_count
,
DWRITE_UNICODE_RANGE
*
ranges
,
UINT32
*
count
)
...
...
@@ -1631,6 +1633,7 @@ static HRESULT init_font_data(IDWriteFactory2 *factory, IDWriteFontFile *file, U
{
void
*
os2_context
,
*
head_context
;
const
void
*
tt_os2
=
NULL
,
*
tt_head
=
NULL
;
struct
dwrite_font_props
props
;
struct
dwrite_font_data
*
data
;
HRESULT
hr
;
...
...
@@ -1655,9 +1658,14 @@ static HRESULT init_font_data(IDWriteFactory2 *factory, IDWriteFontFile *file, U
opentype_get_font_table
(
*
stream
,
face_type
,
face_index
,
MS_OS2_TAG
,
&
tt_os2
,
&
os2_context
,
NULL
,
NULL
);
opentype_get_font_table
(
*
stream
,
face_type
,
face_index
,
MS_HEAD_TAG
,
&
tt_head
,
&
head_context
,
NULL
,
NULL
);
opentype_get_font_properties
(
*
stream
,
face_type
,
face_index
,
&
data
->
stretch
,
&
data
->
weight
,
&
data
->
style
);
opentype_get_font_properties
(
*
stream
,
face_type
,
face_index
,
&
props
);
opentype_get_font_metrics
(
*
stream
,
face_type
,
face_index
,
&
data
->
metrics
,
NULL
);
data
->
style
=
props
.
style
;
data
->
stretch
=
props
.
stretch
;
data
->
weight
=
props
.
weight
;
data
->
panose
=
props
.
panose
;
if
(
tt_os2
)
IDWriteFontFileStream_ReleaseFileFragment
(
*
stream
,
os2_context
);
if
(
tt_head
)
...
...
dlls/dwrite/gdiinterop.c
View file @
50bf5fca
...
...
@@ -411,10 +411,8 @@ static HRESULT WINAPI gdiinterop_ConvertFontFaceToLOGFONT(IDWriteGdiInterop *ifa
IDWriteLocalizedStrings
*
familynames
;
DWRITE_FONT_SIMULATIONS
simulations
;
DWRITE_FONT_FACE_TYPE
face_type
;
struct
dwrite_font_props
props
;
IDWriteFontFileStream
*
stream
;
DWRITE_FONT_STRETCH
stretch
;
DWRITE_FONT_STYLE
style
;
DWRITE_FONT_WEIGHT
weight
;
IDWriteFontFile
*
file
=
NULL
;
UINT32
index
;
BOOL
exists
;
...
...
@@ -437,7 +435,7 @@ static HRESULT WINAPI gdiinterop_ConvertFontFaceToLOGFONT(IDWriteGdiInterop *ifa
index
=
IDWriteFontFace_GetIndex
(
fontface
);
face_type
=
IDWriteFontFace_GetType
(
fontface
);
opentype_get_font_properties
(
stream
,
face_type
,
index
,
&
stretch
,
&
weight
,
&
style
);
opentype_get_font_properties
(
stream
,
face_type
,
index
,
&
props
);
hr
=
get_family_names_from_stream
(
stream
,
index
,
face_type
,
&
familynames
);
IDWriteFontFile_Release
(
file
);
IDWriteFontFileStream_Release
(
stream
);
...
...
@@ -447,8 +445,8 @@ static HRESULT WINAPI gdiinterop_ConvertFontFaceToLOGFONT(IDWriteGdiInterop *ifa
simulations
=
IDWriteFontFace_GetSimulations
(
fontface
);
logfont
->
lfCharSet
=
DEFAULT_CHARSET
;
logfont
->
lfWeight
=
weight
;
logfont
->
lfItalic
=
style
==
DWRITE_FONT_STYLE_ITALIC
||
(
simulations
&
DWRITE_FONT_SIMULATIONS_OBLIQUE
);
logfont
->
lfWeight
=
props
.
weight
;
logfont
->
lfItalic
=
props
.
style
==
DWRITE_FONT_STYLE_ITALIC
||
(
simulations
&
DWRITE_FONT_SIMULATIONS_OBLIQUE
);
logfont
->
lfOutPrecision
=
OUT_OUTLINE_PRECIS
;
logfont
->
lfFaceName
[
0
]
=
0
;
...
...
dlls/dwrite/opentype.c
View file @
50bf5fca
...
...
@@ -954,7 +954,7 @@ void opentype_get_font_metrics(IDWriteFontFileStream *stream, DWRITE_FONT_FACE_T
}
void
opentype_get_font_properties
(
IDWriteFontFileStream
*
stream
,
DWRITE_FONT_FACE_TYPE
type
,
UINT32
index
,
DWRITE_FONT_STRETCH
*
stretch
,
DWRITE_FONT_WEIGHT
*
weight
,
DWRITE_FONT_STYLE
*
style
)
struct
dwrite_font_props
*
props
)
{
void
*
os2_context
,
*
head_context
;
const
TT_OS2_V2
*
tt_os2
;
...
...
@@ -964,23 +964,26 @@ void opentype_get_font_properties(IDWriteFontFileStream *stream, DWRITE_FONT_FAC
opentype_get_font_table
(
stream
,
type
,
index
,
MS_HEAD_TAG
,
(
const
void
**
)
&
tt_head
,
&
head_context
,
NULL
,
NULL
);
/* default stretch, weight and style to normal */
*
stretch
=
DWRITE_FONT_STRETCH_NORMAL
;
*
weight
=
DWRITE_FONT_WEIGHT_NORMAL
;
*
style
=
DWRITE_FONT_STYLE_NORMAL
;
props
->
stretch
=
DWRITE_FONT_STRETCH_NORMAL
;
props
->
weight
=
DWRITE_FONT_WEIGHT_NORMAL
;
props
->
style
=
DWRITE_FONT_STYLE_NORMAL
;
memset
(
&
props
->
panose
,
0
,
sizeof
(
props
->
panose
));
/* DWRITE_FONT_STRETCH enumeration values directly match font data values */
if
(
tt_os2
)
{
if
(
GET_BE_WORD
(
tt_os2
->
usWidthClass
)
<=
DWRITE_FONT_STRETCH_ULTRA_EXPANDED
)
*
stretch
=
GET_BE_WORD
(
tt_os2
->
usWidthClass
);
props
->
stretch
=
GET_BE_WORD
(
tt_os2
->
usWidthClass
);
*
weight
=
GET_BE_WORD
(
tt_os2
->
usWeightClass
);
TRACE
(
"stretch=%d, weight=%d
\n
"
,
*
stretch
,
*
weight
);
props
->
weight
=
GET_BE_WORD
(
tt_os2
->
usWeightClass
);
memcpy
(
&
props
->
panose
,
&
tt_os2
->
panose
,
sizeof
(
props
->
panose
));
TRACE
(
"stretch=%d, weight=%d
\n
"
,
props
->
stretch
,
props
->
weight
);
}
if
(
tt_head
)
{
USHORT
macStyle
=
GET_BE_WORD
(
tt_head
->
macStyle
);
if
(
macStyle
&
0x0002
)
*
style
=
DWRITE_FONT_STYLE_ITALIC
;
props
->
style
=
DWRITE_FONT_STYLE_ITALIC
;
}
if
(
tt_os2
)
...
...
dlls/dwrite/tests/font.c
View file @
50bf5fca
...
...
@@ -3634,6 +3634,55 @@ static void test_GetGdiCompatibleMetrics(void)
IDWriteFactory_Release
(
factory
);
}
static
void
test_GetPanose
(
void
)
{
IDWriteFactory
*
factory
;
IDWriteFont1
*
font1
;
IDWriteFont
*
font
;
HRESULT
hr
;
factory
=
create_factory
();
font
=
get_tahoma_instance
(
factory
,
DWRITE_FONT_STYLE_NORMAL
);
hr
=
IDWriteFont_QueryInterface
(
font
,
&
IID_IDWriteFont1
,
(
void
**
)
&
font1
);
IDWriteFont_Release
(
font
);
if
(
hr
==
S_OK
)
{
DWRITE_PANOSE
panose
;
if
(
0
)
/* crashes on native */
IDWriteFont1_GetPanose
(
font1
,
NULL
);
memset
(
&
panose
,
0
,
sizeof
(
panose
));
IDWriteFont1_GetPanose
(
font1
,
&
panose
);
ok
(
panose
.
familyKind
==
DWRITE_PANOSE_FAMILY_TEXT_DISPLAY
,
"got %u
\n
"
,
panose
.
familyKind
);
ok
(
panose
.
text
.
serifStyle
==
DWRITE_PANOSE_SERIF_STYLE_NORMAL_SANS
,
"got %u
\n
"
,
panose
.
text
.
serifStyle
);
ok
(
panose
.
text
.
weight
==
DWRITE_PANOSE_WEIGHT_MEDIUM
,
"got %u
\n
"
,
panose
.
text
.
weight
);
ok
(
panose
.
text
.
proportion
==
DWRITE_PANOSE_PROPORTION_EVEN_WIDTH
,
"got %u
\n
"
,
panose
.
text
.
proportion
);
ok
(
panose
.
text
.
contrast
==
DWRITE_PANOSE_CONTRAST_VERY_LOW
,
"got %u
\n
"
,
panose
.
text
.
contrast
);
ok
(
panose
.
text
.
strokeVariation
==
DWRITE_PANOSE_STROKE_VARIATION_GRADUAL_VERTICAL
,
"got %u
\n
"
,
panose
.
text
.
strokeVariation
);
ok
(
panose
.
text
.
armStyle
==
DWRITE_PANOSE_ARM_STYLE_STRAIGHT_ARMS_VERTICAL
,
"got %u
\n
"
,
panose
.
text
.
armStyle
);
ok
(
panose
.
text
.
letterform
==
DWRITE_PANOSE_LETTERFORM_NORMAL_BOXED
,
"got %u
\n
"
,
panose
.
text
.
letterform
);
ok
(
panose
.
text
.
midline
==
DWRITE_PANOSE_MIDLINE_STANDARD_TRIMMED
,
"got %u
\n
"
,
panose
.
text
.
midline
);
ok
(
panose
.
text
.
xHeight
==
DWRITE_PANOSE_XHEIGHT_CONSTANT_LARGE
,
"got %u
\n
"
,
panose
.
text
.
xHeight
);
IDWriteFont1_Release
(
font1
);
}
else
win_skip
(
"GetPanose() is not supported.
\n
"
);
IDWriteFactory_Release
(
factory
);
}
START_TEST
(
font
)
{
IDWriteFactory
*
factory
;
...
...
@@ -3678,6 +3727,7 @@ START_TEST(font)
test_CreateRenderingParams
();
test_CreateGlyphRunAnalysis
();
test_GetGdiCompatibleMetrics
();
test_GetPanose
();
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