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
113dd5d2
Commit
113dd5d2
authored
Apr 07, 2014
by
Nikolay Sivov
Committed by
Alexandre Julliard
Apr 07, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dwrite: Return default text format properties.
parent
7d258973
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
72 additions
and
12 deletions
+72
-12
layout.c
dlls/dwrite/layout.c
+43
-12
layout.c
dlls/dwrite/tests/layout.c
+29
-0
No files found.
dlls/dwrite/layout.c
View file @
113dd5d2
...
...
@@ -42,6 +42,15 @@ struct dwrite_textformat_data {
DWRITE_FONT_STYLE
style
;
DWRITE_FONT_STRETCH
stretch
;
DWRITE_PARAGRAPH_ALIGNMENT
paralign
;
DWRITE_READING_DIRECTION
readingdir
;
DWRITE_WORD_WRAPPING
wrapping
;
DWRITE_TEXT_ALIGNMENT
textalignment
;
DWRITE_FLOW_DIRECTION
flow
;
DWRITE_LINE_SPACING_METHOD
spacingmethod
;
FLOAT
spacing
;
FLOAT
baseline
;
FLOAT
size
;
IDWriteFontCollection
*
collection
;
...
...
@@ -699,6 +708,16 @@ static void layout_format_from_textformat(struct dwrite_textlayout *layout, IDWr
layout
->
format
.
style
=
IDWriteTextFormat_GetFontStyle
(
format
);
layout
->
format
.
stretch
=
IDWriteTextFormat_GetFontStretch
(
format
);
layout
->
format
.
size
=
IDWriteTextFormat_GetFontSize
(
format
);
layout
->
format
.
textalignment
=
IDWriteTextFormat_GetTextAlignment
(
format
);
layout
->
format
.
paralign
=
IDWriteTextFormat_GetParagraphAlignment
(
format
);
layout
->
format
.
wrapping
=
IDWriteTextFormat_GetWordWrapping
(
format
);
layout
->
format
.
readingdir
=
IDWriteTextFormat_GetReadingDirection
(
format
);
layout
->
format
.
flow
=
IDWriteTextFormat_GetFlowDirection
(
format
);
IDWriteTextFormat_GetLineSpacing
(
format
,
&
layout
->
format
.
spacingmethod
,
&
layout
->
format
.
spacing
,
&
layout
->
format
.
baseline
);
/* locale name and length */
locale_len
=
IDWriteTextFormat_GetLocaleNameLength
(
format
);
...
...
@@ -840,36 +859,36 @@ static HRESULT WINAPI dwritetextformat_SetLineSpacing(IDWriteTextFormat *iface,
static
DWRITE_TEXT_ALIGNMENT
WINAPI
dwritetextformat_GetTextAlignment
(
IDWriteTextFormat
*
iface
)
{
struct
dwrite_textformat
*
This
=
impl_from_IDWriteTextFormat
(
iface
);
FIXME
(
"(%p): stub
\n
"
,
This
);
return
DWRITE_TEXT_ALIGNMENT_LEADING
;
TRACE
(
"(%p)
\n
"
,
This
);
return
This
->
format
.
textalignment
;
}
static
DWRITE_PARAGRAPH_ALIGNMENT
WINAPI
dwritetextformat_GetParagraphAlignment
(
IDWriteTextFormat
*
iface
)
{
struct
dwrite_textformat
*
This
=
impl_from_IDWriteTextFormat
(
iface
);
FIXME
(
"(%p): stub
\n
"
,
This
);
return
DWRITE_PARAGRAPH_ALIGNMENT_NEAR
;
TRACE
(
"(%p)
\n
"
,
This
);
return
This
->
format
.
paralign
;
}
static
DWRITE_WORD_WRAPPING
WINAPI
dwritetextformat_GetWordWrapping
(
IDWriteTextFormat
*
iface
)
{
struct
dwrite_textformat
*
This
=
impl_from_IDWriteTextFormat
(
iface
);
FIXME
(
"(%p): stub
\n
"
,
This
);
return
DWRITE_WORD_WRAPPING_NO_WRAP
;
TRACE
(
"(%p)
\n
"
,
This
);
return
This
->
format
.
wrapping
;
}
static
DWRITE_READING_DIRECTION
WINAPI
dwritetextformat_GetReadingDirection
(
IDWriteTextFormat
*
iface
)
{
struct
dwrite_textformat
*
This
=
impl_from_IDWriteTextFormat
(
iface
);
FIXME
(
"(%p): stub
\n
"
,
This
);
return
DWRITE_READING_DIRECTION_LEFT_TO_RIGHT
;
TRACE
(
"(%p)
\n
"
,
This
);
return
This
->
format
.
readingdir
;
}
static
DWRITE_FLOW_DIRECTION
WINAPI
dwritetextformat_GetFlowDirection
(
IDWriteTextFormat
*
iface
)
{
struct
dwrite_textformat
*
This
=
impl_from_IDWriteTextFormat
(
iface
);
FIXME
(
"(%p): stub
\n
"
,
This
);
return
DWRITE_FLOW_DIRECTION_TOP_TO_BOTTOM
;
TRACE
(
"(%p)
\n
"
,
This
);
return
This
->
format
.
flow
;
}
static
FLOAT
WINAPI
dwritetextformat_GetIncrementalTabStop
(
IDWriteTextFormat
*
iface
)
...
...
@@ -891,8 +910,12 @@ static HRESULT WINAPI dwritetextformat_GetLineSpacing(IDWriteTextFormat *iface,
FLOAT
*
spacing
,
FLOAT
*
baseline
)
{
struct
dwrite_textformat
*
This
=
impl_from_IDWriteTextFormat
(
iface
);
FIXME
(
"(%p)->(%p %p %p): stub
\n
"
,
This
,
method
,
spacing
,
baseline
);
return
E_NOTIMPL
;
TRACE
(
"(%p)->(%p %p %p)
\n
"
,
This
,
method
,
spacing
,
baseline
);
*
method
=
This
->
format
.
spacingmethod
;
*
spacing
=
This
->
format
.
spacing
;
*
baseline
=
This
->
format
.
baseline
;
return
S_OK
;
}
static
HRESULT
WINAPI
dwritetextformat_GetFontCollection
(
IDWriteTextFormat
*
iface
,
IDWriteFontCollection
**
collection
)
...
...
@@ -1022,6 +1045,14 @@ HRESULT create_textformat(const WCHAR *family_name, IDWriteFontCollection *colle
This
->
format
.
style
=
style
;
This
->
format
.
size
=
size
;
This
->
format
.
stretch
=
stretch
;
This
->
format
.
textalignment
=
DWRITE_TEXT_ALIGNMENT_LEADING
;
This
->
format
.
paralign
=
DWRITE_PARAGRAPH_ALIGNMENT_NEAR
;
This
->
format
.
wrapping
=
DWRITE_WORD_WRAPPING_WRAP
;
This
->
format
.
readingdir
=
DWRITE_READING_DIRECTION_LEFT_TO_RIGHT
;
This
->
format
.
flow
=
DWRITE_FLOW_DIRECTION_TOP_TO_BOTTOM
;
This
->
format
.
spacingmethod
=
DWRITE_LINE_SPACING_METHOD_DEFAULT
;
This
->
format
.
spacing
=
0
.
0
;
This
->
format
.
baseline
=
0
.
0
;
if
(
collection
)
{
...
...
dlls/dwrite/tests/layout.c
View file @
113dd5d2
...
...
@@ -110,7 +110,14 @@ static void test_CreateGdiCompatibleTextLayout(void)
static
void
test_CreateTextFormat
(
void
)
{
IDWriteFontCollection
*
collection
,
*
syscoll
;
DWRITE_PARAGRAPH_ALIGNMENT
paralign
;
DWRITE_READING_DIRECTION
readdir
;
DWRITE_WORD_WRAPPING
wrapping
;
DWRITE_TEXT_ALIGNMENT
align
;
DWRITE_FLOW_DIRECTION
flow
;
DWRITE_LINE_SPACING_METHOD
method
;
IDWriteTextFormat
*
format
;
FLOAT
spacing
,
baseline
;
HRESULT
hr
;
hr
=
IDWriteFactory_CreateTextFormat
(
factory
,
tahomaW
,
NULL
,
DWRITE_FONT_WEIGHT_NORMAL
,
DWRITE_FONT_STYLE_NORMAL
,
...
...
@@ -131,6 +138,28 @@ if (0) /* crashes on native */
IDWriteFontCollection_Release
(
syscoll
);
IDWriteFontCollection_Release
(
collection
);
/* default format properties */
align
=
IDWriteTextFormat_GetTextAlignment
(
format
);
ok
(
align
==
DWRITE_TEXT_ALIGNMENT_LEADING
,
"got %d
\n
"
,
align
);
paralign
=
IDWriteTextFormat_GetParagraphAlignment
(
format
);
ok
(
paralign
==
DWRITE_PARAGRAPH_ALIGNMENT_NEAR
,
"got %d
\n
"
,
paralign
);
wrapping
=
IDWriteTextFormat_GetWordWrapping
(
format
);
ok
(
wrapping
==
DWRITE_WORD_WRAPPING_WRAP
,
"got %d
\n
"
,
wrapping
);
readdir
=
IDWriteTextFormat_GetReadingDirection
(
format
);
ok
(
readdir
==
DWRITE_READING_DIRECTION_LEFT_TO_RIGHT
,
"got %d
\n
"
,
readdir
);
flow
=
IDWriteTextFormat_GetFlowDirection
(
format
);
ok
(
flow
==
DWRITE_FLOW_DIRECTION_TOP_TO_BOTTOM
,
"got %d
\n
"
,
flow
);
hr
=
IDWriteTextFormat_GetLineSpacing
(
format
,
&
method
,
&
spacing
,
&
baseline
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
spacing
==
0
.
0
,
"got %f
\n
"
,
spacing
);
ok
(
baseline
==
0
.
0
,
"got %f
\n
"
,
baseline
);
ok
(
method
==
DWRITE_LINE_SPACING_METHOD_DEFAULT
,
"got %d
\n
"
,
method
);
IDWriteTextFormat_Release
(
format
);
}
...
...
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