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
51d0f612
Commit
51d0f612
authored
Oct 26, 2012
by
Nikolay Sivov
Committed by
Alexandre Julliard
Oct 26, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dwrite: Added GetLocaleNameLength/GetLocaleName for text format and layout.
parent
fcae48a0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
63 additions
and
8 deletions
+63
-8
layout.c
dlls/dwrite/layout.c
+27
-8
layout.c
dlls/dwrite/tests/layout.c
+36
-0
No files found.
dlls/dwrite/layout.c
View file @
51d0f612
...
...
@@ -35,6 +35,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(dwrite);
struct
dwrite_textformat_data
{
WCHAR
*
family_name
;
WCHAR
*
locale
;
UINT32
locale_len
;
DWRITE_FONT_WEIGHT
weight
;
DWRITE_FONT_STYLE
style
;
...
...
@@ -114,6 +115,7 @@ static ULONG WINAPI dwritetextlayout_Release(IDWriteTextLayout *iface)
if
(
!
ref
)
{
release_format_data
(
&
This
->
format
);
heap_free
(
This
->
str
);
heap_free
(
This
);
}
...
...
@@ -289,15 +291,19 @@ static FLOAT WINAPI dwritetextlayout_GetFontSize(IDWriteTextLayout *iface)
static
UINT32
WINAPI
dwritetextlayout_GetLocaleNameLength
(
IDWriteTextLayout
*
iface
)
{
struct
dwrite_textlayout
*
This
=
impl_from_IDWriteTextLayout
(
iface
);
FIXME
(
"(%p): stub
\n
"
,
This
);
return
0
;
TRACE
(
"(%p)
\n
"
,
This
);
return
This
->
format
.
locale_len
;
}
static
HRESULT
WINAPI
dwritetextlayout_GetLocaleName
(
IDWriteTextLayout
*
iface
,
WCHAR
*
name
,
UINT32
size
)
{
struct
dwrite_textlayout
*
This
=
impl_from_IDWriteTextLayout
(
iface
);
FIXME
(
"(%p)->(%p %u): stub
\n
"
,
This
,
name
,
size
);
return
E_NOTIMPL
;
TRACE
(
"(%p)->(%p %u)
\n
"
,
This
,
name
,
size
);
if
(
size
<=
This
->
format
.
locale_len
)
return
E_NOT_SUFFICIENT_BUFFER
;
strcpyW
(
name
,
This
->
format
.
locale
);
return
S_OK
;
}
static
HRESULT
WINAPI
dwritetextlayout_SetMaxWidth
(
IDWriteTextLayout
*
iface
,
FLOAT
maxWidth
)
...
...
@@ -668,6 +674,7 @@ static const IDWriteTextLayoutVtbl dwritetextlayoutvtbl = {
HRESULT
create_textlayout
(
const
WCHAR
*
str
,
UINT32
len
,
IDWriteTextFormat
*
format
,
IDWriteTextLayout
**
layout
)
{
struct
dwrite_textlayout
*
This
;
UINT32
locale_len
;
*
layout
=
NULL
;
...
...
@@ -682,6 +689,13 @@ HRESULT create_textlayout(const WCHAR *str, UINT32 len, IDWriteTextFormat *forma
/* reference is not kept here, instead copy all underlying data */
IDWriteTextFormat_GetFontCollection
(
format
,
&
This
->
format
.
collection
);
/* locale name and length */
locale_len
=
IDWriteTextFormat_GetLocaleNameLength
(
format
);
This
->
format
.
locale
=
heap_alloc
((
locale_len
+
1
)
*
sizeof
(
WCHAR
));
IDWriteTextFormat_GetLocaleName
(
format
,
This
->
format
.
locale
,
locale_len
+
1
);
This
->
format
.
locale_len
=
locale_len
;
This
->
format
.
weight
=
IDWriteTextFormat_GetFontWeight
(
format
);
This
->
format
.
style
=
IDWriteTextFormat_GetFontStyle
(
format
);
This
->
format
.
stretch
=
IDWriteTextFormat_GetFontStretch
(
format
);
...
...
@@ -908,15 +922,19 @@ static FLOAT WINAPI dwritetextformat_GetFontSize(IDWriteTextFormat *iface)
static
UINT32
WINAPI
dwritetextformat_GetLocaleNameLength
(
IDWriteTextFormat
*
iface
)
{
struct
dwrite_textformat
*
This
=
impl_from_IDWriteTextFormat
(
iface
);
FIXME
(
"(%p): stub
\n
"
,
This
);
return
0
;
TRACE
(
"(%p)
\n
"
,
This
);
return
This
->
format
.
locale_len
;
}
static
HRESULT
WINAPI
dwritetextformat_GetLocaleName
(
IDWriteTextFormat
*
iface
,
WCHAR
*
name
,
UINT32
size
)
{
struct
dwrite_textformat
*
This
=
impl_from_IDWriteTextFormat
(
iface
);
FIXME
(
"(%p)->(%p %u): stub
\n
"
,
This
,
name
,
size
);
return
E_NOTIMPL
;
TRACE
(
"(%p)->(%p %u)
\n
"
,
This
,
name
,
size
);
if
(
size
<=
This
->
format
.
locale_len
)
return
E_NOT_SUFFICIENT_BUFFER
;
strcpyW
(
name
,
This
->
format
.
locale
);
return
S_OK
;
}
static
const
IDWriteTextFormatVtbl
dwritetextformatvtbl
=
{
...
...
@@ -964,6 +982,7 @@ HRESULT create_textformat(const WCHAR *family_name, IDWriteFontCollection *colle
This
->
ref
=
1
;
This
->
format
.
family_name
=
heap_strdupW
(
family_name
);
This
->
format
.
locale
=
heap_strdupW
(
locale
);
This
->
format
.
locale_len
=
strlenW
(
locale
);
This
->
format
.
weight
=
weight
;
This
->
format
.
style
=
style
;
This
->
format
.
size
=
size
;
...
...
dlls/dwrite/tests/layout.c
View file @
51d0f612
...
...
@@ -134,6 +134,41 @@ if (0) /* crashes on native */
IDWriteTextFormat_Release
(
format
);
}
static
void
test_GetLocaleName
(
void
)
{
static
const
WCHAR
strW
[]
=
{
's'
,
't'
,
'r'
,
'i'
,
'n'
,
'g'
,
0
};
static
const
WCHAR
ruW
[]
=
{
'r'
,
'u'
,
0
};
IDWriteTextLayout
*
layout
;
IDWriteTextFormat
*
format
;
WCHAR
buff
[
10
];
UINT32
len
;
HRESULT
hr
;
hr
=
IDWriteFactory_CreateTextFormat
(
factory
,
tahomaW
,
NULL
,
DWRITE_FONT_WEIGHT_NORMAL
,
DWRITE_FONT_STYLE_NORMAL
,
DWRITE_FONT_STRETCH_NORMAL
,
10
.
0
,
ruW
,
&
format
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
IDWriteFactory_CreateGdiCompatibleTextLayout
(
factory
,
strW
,
0
,
format
,
100
.
0
,
100
.
0
,
1
.
0
,
NULL
,
FALSE
,
&
layout
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
len
=
IDWriteTextLayout_GetLocaleNameLength
(
layout
);
ok
(
len
==
2
,
"got %u
\n
"
,
len
);
len
=
IDWriteTextFormat_GetLocaleNameLength
(
format
);
ok
(
len
==
2
,
"got %u
\n
"
,
len
);
hr
=
IDWriteTextLayout_GetLocaleName
(
layout
,
buff
,
len
);
ok
(
hr
==
E_NOT_SUFFICIENT_BUFFER
,
"got 0x%08x
\n
"
,
hr
);
hr
=
IDWriteTextLayout_GetLocaleName
(
layout
,
buff
,
len
+
1
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
!
lstrcmpW
(
buff
,
ruW
),
"got %s
\n
"
,
wine_dbgstr_w
(
buff
));
hr
=
IDWriteTextFormat_GetLocaleName
(
format
,
buff
,
len
);
ok
(
hr
==
E_NOT_SUFFICIENT_BUFFER
,
"got 0x%08x
\n
"
,
hr
);
hr
=
IDWriteTextFormat_GetLocaleName
(
format
,
buff
,
len
+
1
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
!
lstrcmpW
(
buff
,
ruW
),
"got %s
\n
"
,
wine_dbgstr_w
(
buff
));
IDWriteTextLayout_Release
(
layout
);
IDWriteTextFormat_Release
(
format
);
}
START_TEST
(
layout
)
{
HRESULT
hr
;
...
...
@@ -149,6 +184,7 @@ START_TEST(layout)
test_CreateTextLayout
();
test_CreateGdiCompatibleTextLayout
();
test_CreateTextFormat
();
test_GetLocaleName
();
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