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
2a74ed80
Commit
2a74ed80
authored
Nov 30, 2020
by
Nikolay Sivov
Committed by
Alexandre Julliard
Nov 30, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dwrite/layout: Keep automatic axes property.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
3a9ecc58
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
129 additions
and
15 deletions
+129
-15
layout.c
dlls/dwrite/layout.c
+38
-15
layout.c
dlls/dwrite/tests/layout.c
+91
-0
No files found.
dlls/dwrite/layout.c
View file @
2a74ed80
...
@@ -32,7 +32,8 @@
...
@@ -32,7 +32,8 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
dwrite
);
WINE_DEFAULT_DEBUG_CHANNEL
(
dwrite
);
struct
dwrite_textformat_data
{
struct
dwrite_textformat_data
{
WCHAR
*
family_name
;
WCHAR
*
family_name
;
UINT32
family_len
;
UINT32
family_len
;
WCHAR
*
locale
;
WCHAR
*
locale
;
...
@@ -51,6 +52,7 @@ struct dwrite_textformat_data {
...
@@ -51,6 +52,7 @@ struct dwrite_textformat_data {
DWRITE_VERTICAL_GLYPH_ORIENTATION
vertical_orientation
;
DWRITE_VERTICAL_GLYPH_ORIENTATION
vertical_orientation
;
DWRITE_OPTICAL_ALIGNMENT
optical_alignment
;
DWRITE_OPTICAL_ALIGNMENT
optical_alignment
;
DWRITE_LINE_SPACING
spacing
;
DWRITE_LINE_SPACING
spacing
;
DWRITE_AUTOMATIC_FONT_AXES
automatic_axes
;
FLOAT
fontsize
;
FLOAT
fontsize
;
FLOAT
tabstop
;
FLOAT
tabstop
;
...
@@ -4144,17 +4146,25 @@ static HRESULT WINAPI dwritetextlayout4_GetFontAxisValues(IDWriteTextLayout4 *if
...
@@ -4144,17 +4146,25 @@ static HRESULT WINAPI dwritetextlayout4_GetFontAxisValues(IDWriteTextLayout4 *if
static
DWRITE_AUTOMATIC_FONT_AXES
WINAPI
dwritetextlayout4_GetAutomaticFontAxes
(
IDWriteTextLayout4
*
iface
)
static
DWRITE_AUTOMATIC_FONT_AXES
WINAPI
dwritetextlayout4_GetAutomaticFontAxes
(
IDWriteTextLayout4
*
iface
)
{
{
FIXME
(
"%p.
\n
"
,
iface
);
struct
dwrite_textlayout
*
layout
=
impl_from_IDWriteTextLayout4
(
iface
);
TRACE
(
"%p.
\n
"
,
iface
);
return
DWRITE_AUTOMATIC_FONT_AXES_NONE
;
return
layout
->
format
.
automatic_axes
;
}
}
static
HRESULT
WINAPI
dwritetextlayout4_SetAutomaticFontAxes
(
IDWriteTextLayout4
*
iface
,
static
HRESULT
WINAPI
dwritetextlayout4_SetAutomaticFontAxes
(
IDWriteTextLayout4
*
iface
,
DWRITE_AUTOMATIC_FONT_AXES
axes
)
DWRITE_AUTOMATIC_FONT_AXES
axes
)
{
{
FIXME
(
"%p, %d.
\n
"
,
iface
,
axes
);
struct
dwrite_textlayout
*
layout
=
impl_from_IDWriteTextLayout4
(
iface
);
return
E_NOTIMPL
;
TRACE
(
"%p, %d.
\n
"
,
iface
,
axes
);
if
((
unsigned
int
)
axes
>
DWRITE_AUTOMATIC_FONT_AXES_OPTICAL_SIZE
)
return
E_INVALIDARG
;
layout
->
format
.
automatic_axes
=
axes
;
return
S_OK
;
}
}
static
const
IDWriteTextLayout4Vtbl
dwritetextlayoutvtbl
=
static
const
IDWriteTextLayout4Vtbl
dwritetextlayoutvtbl
=
...
@@ -4702,17 +4712,15 @@ static HRESULT WINAPI dwritetextformat3_layout_GetFontAxisValues(IDWriteTextForm
...
@@ -4702,17 +4712,15 @@ static HRESULT WINAPI dwritetextformat3_layout_GetFontAxisValues(IDWriteTextForm
static
DWRITE_AUTOMATIC_FONT_AXES
WINAPI
dwritetextformat3_layout_GetAutomaticFontAxes
(
IDWriteTextFormat3
*
iface
)
static
DWRITE_AUTOMATIC_FONT_AXES
WINAPI
dwritetextformat3_layout_GetAutomaticFontAxes
(
IDWriteTextFormat3
*
iface
)
{
{
FIXME
(
"%p.
\n
"
,
iface
);
struct
dwrite_textlayout
*
layout
=
impl_layout_from_IDWriteTextFormat3
(
iface
);
return
IDWriteTextLayout4_GetAutomaticFontAxes
(
&
layout
->
IDWriteTextLayout4_iface
);
return
DWRITE_AUTOMATIC_FONT_AXES_NONE
;
}
}
static
HRESULT
WINAPI
dwritetextformat3_layout_SetAutomaticFontAxes
(
IDWriteTextFormat3
*
iface
,
static
HRESULT
WINAPI
dwritetextformat3_layout_SetAutomaticFontAxes
(
IDWriteTextFormat3
*
iface
,
DWRITE_AUTOMATIC_FONT_AXES
axes
)
DWRITE_AUTOMATIC_FONT_AXES
axes
)
{
{
FIXME
(
"%p, %d.
\n
"
,
iface
,
axes
);
struct
dwrite_textlayout
*
layout
=
impl_layout_from_IDWriteTextFormat3
(
iface
);
return
IDWriteTextLayout4_SetAutomaticFontAxes
(
&
layout
->
IDWriteTextLayout4_iface
,
axes
);
return
E_NOTIMPL
;
}
}
static
const
IDWriteTextFormat3Vtbl
dwritetextformat3_layout_vtbl
=
static
const
IDWriteTextFormat3Vtbl
dwritetextformat3_layout_vtbl
=
...
@@ -5036,6 +5044,7 @@ static HRESULT layout_format_from_textformat(struct dwrite_textlayout *layout, I
...
@@ -5036,6 +5044,7 @@ static HRESULT layout_format_from_textformat(struct dwrite_textlayout *layout, I
{
{
struct
dwrite_textformat
*
textformat
;
struct
dwrite_textformat
*
textformat
;
IDWriteTextFormat1
*
format1
;
IDWriteTextFormat1
*
format1
;
IDWriteTextFormat3
*
format3
;
UINT32
len
;
UINT32
len
;
HRESULT
hr
;
HRESULT
hr
;
...
@@ -5125,6 +5134,13 @@ static HRESULT layout_format_from_textformat(struct dwrite_textlayout *layout, I
...
@@ -5125,6 +5134,13 @@ static HRESULT layout_format_from_textformat(struct dwrite_textlayout *layout, I
layout
->
format
.
optical_alignment
=
DWRITE_OPTICAL_ALIGNMENT_NONE
;
layout
->
format
.
optical_alignment
=
DWRITE_OPTICAL_ALIGNMENT_NONE
;
}
}
hr
=
IDWriteTextFormat_QueryInterface
(
format
,
&
IID_IDWriteTextFormat3
,
(
void
**
)
&
format3
);
if
(
hr
==
S_OK
)
{
layout
->
format
.
automatic_axes
=
IDWriteTextFormat3_GetAutomaticFontAxes
(
format3
);
IDWriteTextFormat3_Release
(
format3
);
}
return
IDWriteTextFormat_GetFontCollection
(
format
,
&
layout
->
format
.
collection
);
return
IDWriteTextFormat_GetFontCollection
(
format
,
&
layout
->
format
.
collection
);
}
}
...
@@ -5833,16 +5849,22 @@ static HRESULT WINAPI dwritetextformat3_GetFontAxisValues(IDWriteTextFormat3 *if
...
@@ -5833,16 +5849,22 @@ static HRESULT WINAPI dwritetextformat3_GetFontAxisValues(IDWriteTextFormat3 *if
static
DWRITE_AUTOMATIC_FONT_AXES
WINAPI
dwritetextformat3_GetAutomaticFontAxes
(
IDWriteTextFormat3
*
iface
)
static
DWRITE_AUTOMATIC_FONT_AXES
WINAPI
dwritetextformat3_GetAutomaticFontAxes
(
IDWriteTextFormat3
*
iface
)
{
{
FIXME
(
"%p.
\n
"
,
iface
);
struct
dwrite_textformat
*
format
=
impl_from_IDWriteTextFormat3
(
iface
);
return
DWRITE_AUTOMATIC_FONT_AXES_NONE
;
TRACE
(
"%p.
\n
"
,
iface
);
return
format
->
format
.
automatic_axes
;
}
}
static
HRESULT
WINAPI
dwritetextformat3_SetAutomaticFontAxes
(
IDWriteTextFormat3
*
iface
,
DWRITE_AUTOMATIC_FONT_AXES
axes
)
static
HRESULT
WINAPI
dwritetextformat3_SetAutomaticFontAxes
(
IDWriteTextFormat3
*
iface
,
DWRITE_AUTOMATIC_FONT_AXES
axes
)
{
{
FIXME
(
"%p, %d.
\n
"
,
iface
,
axes
);
struct
dwrite_textformat
*
format
=
impl_from_IDWriteTextFormat3
(
iface
);
return
E_NOTIMPL
;
TRACE
(
"%p, %d.
\n
"
,
iface
,
axes
);
format
->
format
.
automatic_axes
=
axes
;
return
S_OK
;
}
}
static
const
IDWriteTextFormat3Vtbl
dwritetextformatvtbl
=
static
const
IDWriteTextFormat3Vtbl
dwritetextformatvtbl
=
...
@@ -5948,6 +5970,7 @@ HRESULT create_textformat(const WCHAR *family_name, IDWriteFontCollection *colle
...
@@ -5948,6 +5970,7 @@ HRESULT create_textformat(const WCHAR *family_name, IDWriteFontCollection *colle
This
->
format
.
trimmingsign
=
NULL
;
This
->
format
.
trimmingsign
=
NULL
;
This
->
format
.
collection
=
collection
;
This
->
format
.
collection
=
collection
;
This
->
format
.
fallback
=
NULL
;
This
->
format
.
fallback
=
NULL
;
This
->
format
.
automatic_axes
=
DWRITE_AUTOMATIC_FONT_AXES_NONE
;
IDWriteFontCollection_AddRef
(
collection
);
IDWriteFontCollection_AddRef
(
collection
);
*
format
=
(
IDWriteTextFormat
*
)
&
This
->
IDWriteTextFormat3_iface
;
*
format
=
(
IDWriteTextFormat
*
)
&
This
->
IDWriteTextFormat3_iface
;
...
...
dlls/dwrite/tests/layout.c
View file @
2a74ed80
...
@@ -5732,6 +5732,96 @@ todo_wine {
...
@@ -5732,6 +5732,96 @@ todo_wine {
IDWriteFactory_Release
(
factory
);
IDWriteFactory_Release
(
factory
);
}
}
static
void
test_automatic_font_axes
(
void
)
{
DWRITE_AUTOMATIC_FONT_AXES
axes
;
IDWriteTextLayout4
*
layout4
=
NULL
;
IDWriteTextFormat3
*
format3
;
IDWriteTextLayout
*
layout
;
IDWriteTextFormat
*
format
;
IDWriteFactory
*
factory
;
HRESULT
hr
;
factory
=
create_factory
();
hr
=
IDWriteFactory_CreateTextFormat
(
factory
,
L"Tahoma"
,
NULL
,
DWRITE_FONT_WEIGHT_NORMAL
,
DWRITE_FONT_STYLE_NORMAL
,
DWRITE_FONT_STRETCH_NORMAL
,
16
.
0
f
,
L"en-us"
,
&
format
);
ok
(
hr
==
S_OK
,
"Failed to create text format, hr %#x.
\n
"
,
hr
);
hr
=
IDWriteFactory_CreateTextLayout
(
factory
,
L"a"
,
1
,
format
,
1000
.
0
f
,
1000
.
0
f
,
&
layout
);
ok
(
hr
==
S_OK
,
"Failed to create text layout, hr %x.
\n
"
,
hr
);
IDWriteTextLayout_QueryInterface
(
layout
,
&
IID_IDWriteTextLayout4
,
(
void
**
)
&
layout4
);
IDWriteTextLayout_Release
(
layout
);
if
(
!
layout4
)
{
win_skip
(
"Text layout does not support variable fonts.
\n
"
);
IDWriteFactory_Release
(
factory
);
IDWriteTextFormat_Release
(
format
);
return
;
}
hr
=
IDWriteTextFormat_QueryInterface
(
format
,
&
IID_IDWriteTextFormat3
,
(
void
**
)
&
format3
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
axes
=
IDWriteTextFormat3_GetAutomaticFontAxes
(
format3
);
ok
(
axes
==
DWRITE_AUTOMATIC_FONT_AXES_NONE
,
"Unexpected automatic axes %u.
\n
"
,
axes
);
hr
=
IDWriteTextFormat3_SetAutomaticFontAxes
(
format3
,
DWRITE_AUTOMATIC_FONT_AXES_OPTICAL_SIZE
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
hr
=
IDWriteTextFormat3_SetAutomaticFontAxes
(
format3
,
DWRITE_AUTOMATIC_FONT_AXES_OPTICAL_SIZE
+
1
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
IDWriteTextFormat3_Release
(
format3
);
axes
=
IDWriteTextLayout4_GetAutomaticFontAxes
(
layout4
);
ok
(
axes
==
DWRITE_AUTOMATIC_FONT_AXES_NONE
,
"Unexpected automatic axes %u.
\n
"
,
axes
);
hr
=
IDWriteTextLayout4_SetAutomaticFontAxes
(
layout4
,
DWRITE_AUTOMATIC_FONT_AXES_OPTICAL_SIZE
+
1
);
ok
(
hr
==
E_INVALIDARG
,
"Unexpected hr %#x.
\n
"
,
hr
);
hr
=
IDWriteTextLayout4_SetAutomaticFontAxes
(
layout4
,
DWRITE_AUTOMATIC_FONT_AXES_OPTICAL_SIZE
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
IDWriteTextLayout4_Release
(
layout4
);
/* Out of range values allow for formats, but not for layouts. */
hr
=
IDWriteFactory_CreateTextLayout
(
factory
,
L"a"
,
1
,
format
,
1000
.
0
f
,
1000
.
0
f
,
&
layout
);
ok
(
hr
==
S_OK
,
"Failed to create text layout, hr %x.
\n
"
,
hr
);
hr
=
IDWriteTextLayout_QueryInterface
(
layout
,
&
IID_IDWriteTextLayout4
,
(
void
**
)
&
layout4
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
axes
=
IDWriteTextLayout4_GetAutomaticFontAxes
(
layout4
);
ok
(
axes
==
DWRITE_AUTOMATIC_FONT_AXES_OPTICAL_SIZE
+
1
,
"Unexpected automatic axes %u.
\n
"
,
axes
);
hr
=
IDWriteTextLayout4_QueryInterface
(
layout4
,
&
IID_IDWriteTextFormat3
,
(
void
**
)
&
format3
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
axes
=
IDWriteTextFormat3_GetAutomaticFontAxes
(
format3
);
ok
(
axes
==
DWRITE_AUTOMATIC_FONT_AXES_OPTICAL_SIZE
+
1
,
"Unexpected automatic axes %u.
\n
"
,
axes
);
hr
=
IDWriteTextLayout4_SetAutomaticFontAxes
(
layout4
,
DWRITE_AUTOMATIC_FONT_AXES_OPTICAL_SIZE
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
axes
=
IDWriteTextFormat3_GetAutomaticFontAxes
(
format3
);
ok
(
axes
==
DWRITE_AUTOMATIC_FONT_AXES_OPTICAL_SIZE
,
"Unexpected automatic axes %u.
\n
"
,
axes
);
hr
=
IDWriteTextFormat3_SetAutomaticFontAxes
(
format3
,
DWRITE_AUTOMATIC_FONT_AXES_OPTICAL_SIZE
+
1
);
ok
(
hr
==
E_INVALIDARG
,
"Unexpected hr %#x.
\n
"
,
hr
);
IDWriteTextFormat3_Release
(
format3
);
IDWriteTextLayout_Release
(
layout
);
IDWriteTextLayout4_Release
(
layout4
);
IDWriteTextFormat_Release
(
format
);
IDWriteFactory_Release
(
factory
);
}
START_TEST
(
layout
)
START_TEST
(
layout
)
{
{
IDWriteFactory
*
factory
;
IDWriteFactory
*
factory
;
...
@@ -5783,6 +5873,7 @@ START_TEST(layout)
...
@@ -5783,6 +5873,7 @@ START_TEST(layout)
test_line_spacing
();
test_line_spacing
();
test_GetOverhangMetrics
();
test_GetOverhangMetrics
();
test_tab_stops
();
test_tab_stops
();
test_automatic_font_axes
();
IDWriteFactory_Release
(
factory
);
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