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
b1094bc7
Commit
b1094bc7
authored
Jan 08, 2016
by
Nikolay Sivov
Committed by
Alexandre Julliard
Jan 09, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dwrite: Store locale name in lower case for text format.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
f8a228d2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
2 deletions
+35
-2
layout.c
dlls/dwrite/layout.c
+7
-1
layout.c
dlls/dwrite/tests/layout.c
+28
-1
No files found.
dlls/dwrite/layout.c
View file @
b1094bc7
/*
* Text format and layout
*
* Copyright 2012, 2014-201
5
Nikolay Sivov for CodeWeavers
* Copyright 2012, 2014-201
6
Nikolay Sivov for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
...
...
@@ -3923,7 +3923,11 @@ static HRESULT layout_format_from_textformat(struct dwrite_textlayout *layout, I
layout
->
format
.
locale
=
heap_strdupW
(
textformat
->
format
.
locale
);
layout
->
format
.
family_name
=
heap_strdupW
(
textformat
->
format
.
family_name
);
if
(
!
layout
->
format
.
locale
||
!
layout
->
format
.
family_name
)
{
heap_free
(
layout
->
format
.
locale
);
heap_free
(
layout
->
format
.
family_name
);
return
E_OUTOFMEMORY
;
}
if
(
layout
->
format
.
trimmingsign
)
IDWriteInlineObject_AddRef
(
layout
->
format
.
trimmingsign
);
...
...
@@ -4662,6 +4666,8 @@ HRESULT create_textformat(const WCHAR *family_name, IDWriteFontCollection *colle
This
->
format
.
family_len
=
strlenW
(
family_name
);
This
->
format
.
locale
=
heap_strdupW
(
locale
);
This
->
format
.
locale_len
=
strlenW
(
locale
);
/* force locale name to lower case, layout will inherit this modified value */
strlwrW
(
This
->
format
.
locale
);
This
->
format
.
weight
=
weight
;
This
->
format
.
style
=
style
;
This
->
format
.
fontsize
=
size
;
...
...
dlls/dwrite/tests/layout.c
View file @
b1094bc7
...
...
@@ -1999,7 +1999,7 @@ static void test_SetLocaleName(void)
static
const
WCHAR
eNuSW
[]
=
{
'e'
,
'N'
,
'-'
,
'u'
,
'S'
,
0
};
static
const
WCHAR
strW
[]
=
{
'a'
,
'b'
,
'c'
,
'd'
,
0
};
WCHAR
buffW
[
LOCALE_NAME_MAX_LENGTH
+
sizeof
(
strW
)
/
sizeof
(
WCHAR
)];
IDWriteTextFormat
*
format
;
IDWriteTextFormat
*
format
,
*
format2
;
IDWriteTextLayout
*
layout
;
DWRITE_TEXT_RANGE
range
;
IDWriteFactory
*
factory
;
...
...
@@ -2007,6 +2007,33 @@ static void test_SetLocaleName(void)
factory
=
create_factory
();
/* create format with mixed case locale name, get it back */
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_GetLocaleName
(
format
,
buffW
,
sizeof
(
buffW
)
/
sizeof
(
buffW
[
0
]));
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
!
lstrcmpW
(
buffW
,
enusW
),
"got %s
\n
"
,
wine_dbgstr_w
(
buffW
));
hr
=
IDWriteFactory_CreateTextLayout
(
factory
,
strW
,
4
,
format
,
1000
.
0
,
1000
.
0
,
&
layout
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
IDWriteTextLayout_QueryInterface
(
layout
,
&
IID_IDWriteTextFormat
,
(
void
**
)
&
format2
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
IDWriteTextFormat_GetLocaleName
(
format2
,
buffW
,
sizeof
(
buffW
)
/
sizeof
(
buffW
[
0
]));
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
!
lstrcmpW
(
buffW
,
enusW
),
"got %s
\n
"
,
wine_dbgstr_w
(
buffW
));
hr
=
IDWriteTextLayout_GetLocaleName
(
layout
,
0
,
buffW
,
sizeof
(
buffW
)
/
sizeof
(
buffW
[
0
]),
NULL
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
!
lstrcmpW
(
buffW
,
enusW
),
"got %s
\n
"
,
wine_dbgstr_w
(
buffW
));
IDWriteTextFormat_Release
(
format2
);
IDWriteTextLayout_Release
(
layout
);
IDWriteTextFormat_Release
(
format
);
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
);
...
...
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