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
6ba2c25d
Commit
6ba2c25d
authored
Dec 25, 2015
by
Nikolay Sivov
Committed by
Alexandre Julliard
Dec 25, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dwrite: Store optical alignment property.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
3905ed8c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
96 additions
and
13 deletions
+96
-13
layout.c
dlls/dwrite/layout.c
+27
-13
layout.c
dlls/dwrite/tests/layout.c
+69
-0
No files found.
dlls/dwrite/layout.c
View file @
6ba2c25d
...
...
@@ -50,6 +50,7 @@ struct dwrite_textformat_data {
DWRITE_FLOW_DIRECTION
flow
;
DWRITE_LINE_SPACING_METHOD
spacingmethod
;
DWRITE_VERTICAL_GLYPH_ORIENTATION
vertical_orientation
;
DWRITE_OPTICAL_ALIGNMENT
optical_alignment
;
FLOAT
spacing
;
FLOAT
baseline
;
...
...
@@ -408,6 +409,15 @@ static HRESULT set_fontfallback_for_format(struct dwrite_textformat_data *format
return
S_OK
;
}
static
HRESULT
format_set_optical_alignment
(
struct
dwrite_textformat_data
*
format
,
DWRITE_OPTICAL_ALIGNMENT
alignment
)
{
if
((
UINT32
)
alignment
>
DWRITE_OPTICAL_ALIGNMENT_NO_SIDE_BEARINGS
)
return
E_INVALIDARG
;
format
->
optical_alignment
=
alignment
;
return
S_OK
;
}
static
struct
layout_run
*
alloc_layout_run
(
enum
layout_run_kind
kind
)
{
struct
layout_run
*
ret
;
...
...
@@ -3217,15 +3227,15 @@ static BOOL WINAPI dwritetextlayout2_GetLastLineWrapping(IDWriteTextLayout2 *ifa
static
HRESULT
WINAPI
dwritetextlayout2_SetOpticalAlignment
(
IDWriteTextLayout2
*
iface
,
DWRITE_OPTICAL_ALIGNMENT
alignment
)
{
struct
dwrite_textlayout
*
This
=
impl_from_IDWriteTextLayout2
(
iface
);
FIXME
(
"(%p)->(%d): stub
\n
"
,
This
,
alignment
);
return
E_NOTIMPL
;
TRACE
(
"(%p)->(%d)
\n
"
,
This
,
alignment
);
return
IDWriteTextFormat1_SetOpticalAlignment
(
&
This
->
IDWriteTextFormat1_iface
,
alignment
)
;
}
static
DWRITE_OPTICAL_ALIGNMENT
WINAPI
dwritetextlayout2_GetOpticalAlignment
(
IDWriteTextLayout2
*
iface
)
{
struct
dwrite_textlayout
*
This
=
impl_from_IDWriteTextLayout2
(
iface
);
FIXME
(
"(%p): stub
\n
"
,
This
);
return
DWRITE_OPTICAL_ALIGNMENT_NONE
;
TRACE
(
"(%p)
\n
"
,
This
);
return
IDWriteTextFormat1_GetOpticalAlignment
(
&
This
->
IDWriteTextFormat1_iface
)
;
}
static
HRESULT
WINAPI
dwritetextlayout2_SetFontFallback
(
IDWriteTextLayout2
*
iface
,
IDWriteFontFallback
*
fallback
)
...
...
@@ -3627,15 +3637,15 @@ static BOOL WINAPI dwritetextformat1_layout_GetLastLineWrapping(IDWriteTextForma
static
HRESULT
WINAPI
dwritetextformat1_layout_SetOpticalAlignment
(
IDWriteTextFormat1
*
iface
,
DWRITE_OPTICAL_ALIGNMENT
alignment
)
{
struct
dwrite_textlayout
*
This
=
impl_layout_form_IDWriteTextFormat1
(
iface
);
FIXME
(
"(%p)->(%d): stub
\n
"
,
This
,
alignment
);
return
E_NOTIMPL
;
TRACE
(
"(%p)->(%d)
\n
"
,
This
,
alignment
);
return
format_set_optical_alignment
(
&
This
->
format
,
alignment
)
;
}
static
DWRITE_OPTICAL_ALIGNMENT
WINAPI
dwritetextformat1_layout_GetOpticalAlignment
(
IDWriteTextFormat1
*
iface
)
{
struct
dwrite_textlayout
*
This
=
impl_layout_form_IDWriteTextFormat1
(
iface
);
FIXME
(
"(%p): stub
\n
"
,
This
);
return
DWRITE_OPTICAL_ALIGNMENT_NONE
;
TRACE
(
"(%p)
\n
"
,
This
);
return
This
->
format
.
optical_alignment
;
}
static
HRESULT
WINAPI
dwritetextformat1_layout_SetFontFallback
(
IDWriteTextFormat1
*
iface
,
IDWriteFontFallback
*
fallback
)
...
...
@@ -3969,11 +3979,14 @@ static HRESULT layout_format_from_textformat(struct dwrite_textlayout *layout, I
hr
=
IDWriteTextFormat_QueryInterface
(
format
,
&
IID_IDWriteTextFormat1
,
(
void
**
)
&
format1
);
if
(
hr
==
S_OK
)
{
layout
->
format
.
vertical_orientation
=
IDWriteTextFormat1_GetVerticalGlyphOrientation
(
format1
);
layout
->
format
.
optical_alignment
=
IDWriteTextFormat1_GetOpticalAlignment
(
format1
);
IDWriteTextFormat1_GetFontFallback
(
format1
,
&
layout
->
format
.
fallback
);
IDWriteTextFormat1_Release
(
format1
);
}
else
else
{
layout
->
format
.
vertical_orientation
=
DWRITE_VERTICAL_GLYPH_ORIENTATION_DEFAULT
;
layout
->
format
.
optical_alignment
=
DWRITE_OPTICAL_ALIGNMENT_NONE
;
}
return
IDWriteTextFormat_GetFontCollection
(
format
,
&
layout
->
format
.
collection
);
}
...
...
@@ -4563,15 +4576,15 @@ static BOOL WINAPI dwritetextformat1_GetLastLineWrapping(IDWriteTextFormat1 *ifa
static
HRESULT
WINAPI
dwritetextformat1_SetOpticalAlignment
(
IDWriteTextFormat1
*
iface
,
DWRITE_OPTICAL_ALIGNMENT
alignment
)
{
struct
dwrite_textformat
*
This
=
impl_from_IDWriteTextFormat1
(
iface
);
FIXME
(
"(%p)->(%d): stub
\n
"
,
This
,
alignment
);
return
E_NOTIMPL
;
TRACE
(
"(%p)->(%d)
\n
"
,
This
,
alignment
);
return
format_set_optical_alignment
(
&
This
->
format
,
alignment
)
;
}
static
DWRITE_OPTICAL_ALIGNMENT
WINAPI
dwritetextformat1_GetOpticalAlignment
(
IDWriteTextFormat1
*
iface
)
{
struct
dwrite_textformat
*
This
=
impl_from_IDWriteTextFormat1
(
iface
);
FIXME
(
"(%p): stub
\n
"
,
This
);
return
DWRITE_OPTICAL_ALIGNMENT_NONE
;
TRACE
(
"(%p)
\n
"
,
This
);
return
This
->
format
.
optical_alignment
;
}
static
HRESULT
WINAPI
dwritetextformat1_SetFontFallback
(
IDWriteTextFormat1
*
iface
,
IDWriteFontFallback
*
fallback
)
...
...
@@ -4654,6 +4667,7 @@ HRESULT create_textformat(const WCHAR *family_name, IDWriteFontCollection *colle
This
->
format
.
fontsize
=
size
;
This
->
format
.
stretch
=
stretch
;
This
->
format
.
textalignment
=
DWRITE_TEXT_ALIGNMENT_LEADING
;
This
->
format
.
optical_alignment
=
DWRITE_OPTICAL_ALIGNMENT_NONE
;
This
->
format
.
paralign
=
DWRITE_PARAGRAPH_ALIGNMENT_NEAR
;
This
->
format
.
wrapping
=
DWRITE_WORD_WRAPPING_WRAP
;
This
->
format
.
last_line_wrapping
=
TRUE
;
...
...
dlls/dwrite/tests/layout.c
View file @
6ba2c25d
...
...
@@ -4177,6 +4177,74 @@ static void test_SetLastLineWrapping(void)
IDWriteFactory_Release
(
factory
);
}
static
void
test_SetOpticalAlignment
(
void
)
{
static
const
WCHAR
strW
[]
=
{
'a'
,
0
};
DWRITE_OPTICAL_ALIGNMENT
alignment
;
IDWriteTextLayout2
*
layout2
;
IDWriteTextFormat1
*
format1
;
IDWriteTextLayout
*
layout
;
IDWriteTextFormat
*
format
;
IDWriteFactory
*
factory
;
HRESULT
hr
;
factory
=
create_factory
();
hr
=
IDWriteFactory_CreateTextFormat
(
factory
,
tahomaW
,
NULL
,
DWRITE_FONT_WEIGHT_NORMAL
,
DWRITE_FONT_STYLE_NORMAL
,
DWRITE_FONT_STRETCH_NORMAL
,
10
.
0
,
enusW
,
&
format
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
IDWriteTextFormat_QueryInterface
(
format
,
&
IID_IDWriteTextFormat1
,
(
void
**
)
&
format1
);
IDWriteTextFormat_Release
(
format
);
if
(
hr
!=
S_OK
)
{
win_skip
(
"SetOpticalAlignment() is not supported
\n
"
);
IDWriteFactory_Release
(
factory
);
return
;
}
alignment
=
IDWriteTextFormat1_GetOpticalAlignment
(
format1
);
ok
(
alignment
==
DWRITE_OPTICAL_ALIGNMENT_NONE
,
"got %d
\n
"
,
alignment
);
hr
=
IDWriteFactory_CreateTextLayout
(
factory
,
strW
,
1
,
(
IDWriteTextFormat
*
)
format1
,
1000
.
0
,
1000
.
0
,
&
layout
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
IDWriteTextLayout_QueryInterface
(
layout
,
&
IID_IDWriteTextLayout2
,
(
void
**
)
&
layout2
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
IDWriteTextLayout_Release
(
layout
);
IDWriteTextFormat1_Release
(
format1
);
alignment
=
IDWriteTextLayout2_GetOpticalAlignment
(
layout2
);
ok
(
alignment
==
DWRITE_OPTICAL_ALIGNMENT_NONE
,
"got %d
\n
"
,
alignment
);
hr
=
IDWriteTextLayout2_QueryInterface
(
layout2
,
&
IID_IDWriteTextFormat1
,
(
void
**
)
&
format1
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
alignment
=
IDWriteTextFormat1_GetOpticalAlignment
(
format1
);
ok
(
alignment
==
DWRITE_OPTICAL_ALIGNMENT_NONE
,
"got %d
\n
"
,
alignment
);
hr
=
IDWriteTextLayout2_SetOpticalAlignment
(
layout2
,
DWRITE_OPTICAL_ALIGNMENT_NO_SIDE_BEARINGS
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
IDWriteTextLayout2_SetOpticalAlignment
(
layout2
,
DWRITE_OPTICAL_ALIGNMENT_NO_SIDE_BEARINGS
+
1
);
ok
(
hr
==
E_INVALIDARG
,
"got 0x%08x
\n
"
,
hr
);
alignment
=
IDWriteTextFormat1_GetOpticalAlignment
(
format1
);
ok
(
alignment
==
DWRITE_OPTICAL_ALIGNMENT_NO_SIDE_BEARINGS
,
"got %d
\n
"
,
alignment
);
hr
=
IDWriteTextFormat1_SetOpticalAlignment
(
format1
,
DWRITE_OPTICAL_ALIGNMENT_NONE
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
IDWriteTextFormat1_SetOpticalAlignment
(
format1
,
DWRITE_OPTICAL_ALIGNMENT_NO_SIDE_BEARINGS
+
1
);
ok
(
hr
==
E_INVALIDARG
,
"got 0x%08x
\n
"
,
hr
);
alignment
=
IDWriteTextLayout2_GetOpticalAlignment
(
layout2
);
ok
(
alignment
==
DWRITE_OPTICAL_ALIGNMENT_NONE
,
"got %d
\n
"
,
alignment
);
IDWriteTextLayout2_Release
(
layout2
);
IDWriteTextFormat1_Release
(
format1
);
IDWriteFactory_Release
(
factory
);
}
START_TEST
(
layout
)
{
static
const
WCHAR
ctrlstrW
[]
=
{
0x202a
,
0
};
...
...
@@ -4226,6 +4294,7 @@ START_TEST(layout)
test_FontFallbackBuilder
();
test_SetTypography
();
test_SetLastLineWrapping
();
test_SetOpticalAlignment
();
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