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
1cbc74a3
Commit
1cbc74a3
authored
Mar 01, 2021
by
Nikolay Sivov
Committed by
Alexandre Julliard
Mar 01, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dwrite/layout: Implement axis values property for the format object.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
24e41be1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
100 additions
and
19 deletions
+100
-19
layout.c
dlls/dwrite/layout.c
+65
-14
layout.c
dlls/dwrite/tests/layout.c
+34
-4
dwrite_3.idl
include/dwrite_3.idl
+1
-1
No files found.
dlls/dwrite/layout.c
View file @
1cbc74a3
...
...
@@ -62,6 +62,9 @@ struct dwrite_textformat_data
IDWriteFontCollection
*
collection
;
IDWriteFontFallback
*
fallback
;
DWRITE_FONT_AXIS_VALUE
*
axis_values
;
unsigned
int
axis_values_count
;
};
enum
layout_range_attr_kind
{
...
...
@@ -328,6 +331,7 @@ static void release_format_data(struct dwrite_textformat_data *data)
if
(
data
->
trimmingsign
)
IDWriteInlineObject_Release
(
data
->
trimmingsign
);
heap_free
(
data
->
family_name
);
heap_free
(
data
->
locale
);
heap_free
(
data
->
axis_values
);
}
static
inline
struct
dwrite_textlayout
*
impl_from_IDWriteTextLayout4
(
IDWriteTextLayout4
*
iface
)
...
...
@@ -465,6 +469,41 @@ static inline HRESULT format_set_linespacing(struct dwrite_textformat_data *form
return
S_OK
;
}
static
HRESULT
format_set_font_axisvalues
(
struct
dwrite_textformat_data
*
format
,
DWRITE_FONT_AXIS_VALUE
const
*
axis_values
,
unsigned
int
num_values
)
{
heap_free
(
format
->
axis_values
);
format
->
axis_values
=
NULL
;
format
->
axis_values_count
=
0
;
if
(
num_values
)
{
if
(
!
(
format
->
axis_values
=
heap_calloc
(
num_values
,
sizeof
(
*
axis_values
))))
return
E_OUTOFMEMORY
;
memcpy
(
format
->
axis_values
,
axis_values
,
num_values
*
sizeof
(
*
axis_values
));
format
->
axis_values_count
=
num_values
;
}
return
S_OK
;
}
static
HRESULT
format_get_font_axisvalues
(
struct
dwrite_textformat_data
*
format
,
DWRITE_FONT_AXIS_VALUE
*
axis_values
,
unsigned
int
num_values
)
{
if
(
!
format
->
axis_values_count
)
{
if
(
num_values
)
memset
(
axis_values
,
0
,
num_values
*
sizeof
(
*
axis_values
));
return
S_OK
;
}
if
(
num_values
<
format
->
axis_values_count
)
return
E_NOT_SUFFICIENT_BUFFER
;
memcpy
(
axis_values
,
format
->
axis_values
,
min
(
num_values
,
format
->
axis_values_count
)
*
sizeof
(
*
axis_values
));
return
S_OK
;
}
static
HRESULT
get_fontfallback_from_format
(
const
struct
dwrite_textformat_data
*
format
,
IDWriteFontFallback
**
fallback
)
{
*
fallback
=
format
->
fallback
;
...
...
@@ -4922,24 +4961,30 @@ static HRESULT WINAPI dwritetextformat2_layout_GetLineSpacing(IDWriteTextFormat3
static
HRESULT
WINAPI
dwritetextformat3_layout_SetFontAxisValues
(
IDWriteTextFormat3
*
iface
,
DWRITE_FONT_AXIS_VALUE
const
*
axis_values
,
UINT32
num_values
)
{
FIXME
(
"%p, %p, %u.
\n
"
,
iface
,
axis_values
,
num_values
);
struct
dwrite_textlayout
*
layout
=
impl_layout_from_IDWriteTextFormat3
(
iface
);
return
E_NOTIMPL
;
TRACE
(
"%p, %p, %u.
\n
"
,
iface
,
axis_values
,
num_values
);
return
format_set_font_axisvalues
(
&
layout
->
format
,
axis_values
,
num_values
);
}
static
UINT32
WINAPI
dwritetextformat3_layout_GetFontAxisValueCount
(
IDWriteTextFormat3
*
iface
)
{
FIXME
(
"%p.
\n
"
,
iface
);
struct
dwrite_textlayout
*
layout
=
impl_layout_from_IDWriteTextFormat3
(
iface
);
return
0
;
TRACE
(
"%p.
\n
"
,
iface
);
return
layout
->
format
.
axis_values_count
;
}
static
HRESULT
WINAPI
dwritetextformat3_layout_GetFontAxisValues
(
IDWriteTextFormat3
*
iface
,
DWRITE_FONT_AXIS_VALUE
const
*
axis_values
,
UINT32
num_values
)
DWRITE_FONT_AXIS_VALUE
*
axis_values
,
UINT32
num_values
)
{
FIXME
(
"%p, %p, %u.
\n
"
,
iface
,
axis_values
,
num_values
);
struct
dwrite_textlayout
*
layout
=
impl_layout_from_IDWriteTextFormat3
(
iface
);
return
E_NOTIMPL
;
TRACE
(
"%p, %p, %u.
\n
"
,
iface
,
axis_values
,
num_values
);
return
format_get_font_axisvalues
(
&
layout
->
format
,
axis_values
,
num_values
);
}
static
DWRITE_AUTOMATIC_FONT_AXES
WINAPI
dwritetextformat3_layout_GetAutomaticFontAxes
(
IDWriteTextFormat3
*
iface
)
...
...
@@ -6042,24 +6087,30 @@ static HRESULT WINAPI dwritetextformat2_GetLineSpacing(IDWriteTextFormat3 *iface
static
HRESULT
WINAPI
dwritetextformat3_SetFontAxisValues
(
IDWriteTextFormat3
*
iface
,
DWRITE_FONT_AXIS_VALUE
const
*
axis_values
,
UINT32
num_values
)
{
FIXME
(
"%p, %p, %u.
\n
"
,
iface
,
axis_values
,
num_values
);
struct
dwrite_textformat
*
format
=
impl_from_IDWriteTextFormat3
(
iface
);
return
E_NOTIMPL
;
TRACE
(
"%p, %p, %u.
\n
"
,
iface
,
axis_values
,
num_values
);
return
format_set_font_axisvalues
(
&
format
->
format
,
axis_values
,
num_values
);
}
static
UINT32
WINAPI
dwritetextformat3_GetFontAxisValueCount
(
IDWriteTextFormat3
*
iface
)
{
FIXME
(
"%p.
\n
"
,
iface
);
struct
dwrite_textformat
*
format
=
impl_from_IDWriteTextFormat3
(
iface
);
return
0
;
TRACE
(
"%p.
\n
"
,
iface
);
return
format
->
format
.
axis_values_count
;
}
static
HRESULT
WINAPI
dwritetextformat3_GetFontAxisValues
(
IDWriteTextFormat3
*
iface
,
DWRITE_FONT_AXIS_VALUE
const
*
axis_values
,
UINT32
num_values
)
DWRITE_FONT_AXIS_VALUE
*
axis_values
,
UINT32
num_values
)
{
FIXME
(
"%p, %p, %u.
\n
"
,
iface
,
axis_values
,
num_values
);
struct
dwrite_textformat
*
format
=
impl_from_IDWriteTextFormat3
(
iface
);
return
E_NOTIMPL
;
TRACE
(
"%p, %p, %u.
\n
"
,
iface
,
axis_values
,
num_values
);
return
format_get_font_axisvalues
(
&
format
->
format
,
axis_values
,
num_values
);
}
static
DWRITE_AUTOMATIC_FONT_AXES
WINAPI
dwritetextformat3_GetAutomaticFontAxes
(
IDWriteTextFormat3
*
iface
)
...
...
dlls/dwrite/tests/layout.c
View file @
1cbc74a3
...
...
@@ -5894,7 +5894,7 @@ static void test_text_format_axes(void)
{
IDWriteFontCollection
*
collection
;
IDWriteFontCollection2
*
collection2
;
DWRITE_FONT_AXIS_VALUE
ax
is
;
DWRITE_FONT_AXIS_VALUE
ax
es
[
2
]
;
IDWriteTextFormat3
*
format3
;
DWRITE_FONT_STRETCH
stretch
;
DWRITE_FONT_WEIGHT
weight
;
...
...
@@ -5944,9 +5944,9 @@ if (SUCCEEDED(hr))
ok
(
weight
==
DWRITE_FONT_WEIGHT_NORMAL
,
"Unexpected font weight %d.
\n
"
,
weight
);
/* Regular properties are not set from axis values. */
ax
is
.
axisTag
=
DWRITE_FONT_AXIS_TAG_WEIGHT
;
ax
is
.
value
=
200
.
0
f
;
hr
=
IDWriteTextFormat3_SetFontAxisValues
(
format3
,
&
axi
s
,
1
);
ax
es
[
0
]
.
axisTag
=
DWRITE_FONT_AXIS_TAG_WEIGHT
;
ax
es
[
0
]
.
value
=
200
.
0
f
;
hr
=
IDWriteTextFormat3_SetFontAxisValues
(
format3
,
axe
s
,
1
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
weight
=
IDWriteTextFormat3_GetFontWeight
(
format3
);
...
...
@@ -5965,6 +5965,36 @@ if (SUCCEEDED(hr))
count
=
IDWriteTextFormat3_GetFontAxisValueCount
(
format3
);
ok
(
!
count
,
"Unexpected axis count %u.
\n
"
,
count
);
axes
[
0
].
axisTag
=
DWRITE_FONT_AXIS_TAG_WEIGHT
;
hr
=
IDWriteTextFormat3_GetFontAxisValues
(
format3
,
axes
,
1
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
axes
[
0
].
axisTag
==
0
&&
axes
[
0
].
value
==
0
.
0
f
,
"Unexpected value.
\n
"
);
axes
[
0
].
axisTag
=
DWRITE_FONT_AXIS_TAG_WEIGHT
;
axes
[
0
].
value
=
200
.
0
f
;
axes
[
1
].
axisTag
=
DWRITE_FONT_AXIS_TAG_WIDTH
;
axes
[
1
].
value
=
2
.
0
f
;
hr
=
IDWriteTextFormat3_SetFontAxisValues
(
format3
,
axes
,
2
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
count
=
IDWriteTextFormat3_GetFontAxisValueCount
(
format3
);
ok
(
count
==
2
,
"Unexpected axis count %u.
\n
"
,
count
);
hr
=
IDWriteTextFormat3_GetFontAxisValues
(
format3
,
axes
,
1
);
ok
(
hr
==
E_NOT_SUFFICIENT_BUFFER
,
"Unexpected hr %#x.
\n
"
,
hr
);
hr
=
IDWriteTextFormat3_GetFontAxisValues
(
format3
,
axes
,
0
);
ok
(
hr
==
E_NOT_SUFFICIENT_BUFFER
,
"Unexpected hr %#x.
\n
"
,
hr
);
hr
=
IDWriteTextFormat3_GetFontAxisValues
(
format3
,
axes
,
2
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
hr
=
IDWriteTextFormat3_SetFontAxisValues
(
format3
,
axes
,
0
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
count
=
IDWriteTextFormat3_GetFontAxisValueCount
(
format3
);
ok
(
!
count
,
"Unexpected axis count %u.
\n
"
,
count
);
IDWriteTextFormat3_Release
(
format3
);
IDWriteTextFormat_Release
(
format
);
...
...
include/dwrite_3.idl
View file @
1cbc74a3
...
...
@@ -562,7 +562,7 @@ interface IDWriteTextFormat3 : IDWriteTextFormat2
UINT32
num_values
)
;
UINT32
GetFontAxisValueCount
()
;
HRESULT
GetFontAxisValues
(
DWRITE_FONT_AXIS_VALUE
const
*
axis_values
,
DWRITE_FONT_AXIS_VALUE
*
axis_values
,
UINT32
num_values
)
;
DWRITE_AUTOMATIC_FONT_AXES
GetAutomaticFontAxes
()
;
HRESULT
SetAutomaticFontAxes
(
DWRITE_AUTOMATIC_FONT_AXES
axes
)
;
...
...
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