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
ef94a9fc
Commit
ef94a9fc
authored
Apr 24, 2019
by
Akihiro Sagawa
Committed by
Alexandre Julliard
Apr 24, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comctl32/edit: Implement EC_USEFONTINFO margins in the CJK case.
Signed-off-by:
Akihiro Sagawa
<
sagawa.aki@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
28400eff
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
5 deletions
+42
-5
edit.c
dlls/comctl32/edit.c
+42
-3
edit.c
dlls/comctl32/tests/edit.c
+0
-2
No files found.
dlls/comctl32/edit.c
View file @
ef94a9fc
...
...
@@ -2685,6 +2685,36 @@ static void EDIT_EM_SetLimitText(EDITSTATE *es, UINT limit)
es
->
buffer_limit
=
limit
;
}
static
BOOL
is_cjk
(
HDC
dc
)
{
const
DWORD
FS_DBCS_MASK
=
FS_JISJAPAN
|
FS_CHINESESIMP
|
FS_WANSUNG
|
FS_CHINESETRAD
|
FS_JOHAB
;
FONTSIGNATURE
fs
;
switch
(
GdiGetCodePage
(
dc
))
{
case
932
:
case
936
:
case
949
:
case
950
:
case
1361
:
return
TRUE
;
default:
return
(
GetTextCharsetInfo
(
dc
,
&
fs
,
0
)
!=
DEFAULT_CHARSET
&&
(
fs
.
fsCsb
[
0
]
&
FS_DBCS_MASK
));
}
}
static
int
get_cjk_fontinfo_margin
(
int
width
,
int
side_bearing
)
{
int
margin
;
if
(
side_bearing
<
0
)
margin
=
min
(
-
side_bearing
,
width
/
2
);
else
margin
=
0
;
return
margin
;
}
struct
char_width_info
{
INT
min_lsb
,
min_rsb
,
unknown
;
};
/* Undocumented gdi32 export */
extern
BOOL
WINAPI
GetCharWidthInfo
(
HDC
,
struct
char_width_info
*
);
/*********************************************************************
*
...
...
@@ -2714,9 +2744,18 @@ static void EDIT_EM_SetMargins(EDITSTATE *es, INT action,
/* The default margins are only non zero for TrueType or Vector fonts */
if
(
tm
.
tmPitchAndFamily
&
(
TMPF_VECTOR
|
TMPF_TRUETYPE
))
{
/* FIXME: figure out the CJK values. */
default_left_margin
=
width
/
2
;
default_right_margin
=
width
/
2
;
struct
char_width_info
width_info
;
if
(
is_cjk
(
dc
)
&&
GetCharWidthInfo
(
dc
,
&
width_info
))
{
default_left_margin
=
get_cjk_fontinfo_margin
(
width
,
width_info
.
min_lsb
);
default_right_margin
=
get_cjk_fontinfo_margin
(
width
,
width_info
.
min_rsb
);
}
else
{
default_left_margin
=
width
/
2
;
default_right_margin
=
width
/
2
;
}
GetClientRect
(
es
->
hwndSelf
,
&
rc
);
rc_width
=
!
IsRectEmpty
(
&
rc
)
?
rc
.
right
-
rc
.
left
:
80
;
...
...
dlls/comctl32/tests/edit.c
View file @
ef94a9fc
...
...
@@ -1686,7 +1686,6 @@ static void test_margins_default(const char* facename, UINT charset)
SendMessageA
(
hwnd
,
EM_SETMARGINS
,
EC_LEFTMARGIN
|
EC_RIGHTMARGIN
,
small_margins
);
SendMessageA
(
hwnd
,
EM_SETMARGINS
,
EC_LEFTMARGIN
|
EC_RIGHTMARGIN
,
MAKELONG
(
EC_USEFONTINFO
,
EC_USEFONTINFO
));
margins
=
SendMessageA
(
hwnd
,
EM_GETMARGINS
,
0
,
0
);
todo_wine_if
(
cjk
&&
expect
!=
MAKELONG
(
size
.
cx
/
2
,
size
.
cx
/
2
))
ok
(
margins
==
expect
,
"%s:%d: expected %d, %d, got %d, %d
\n
"
,
facename
,
charset
,
HIWORD
(
expect
),
LOWORD
(
expect
),
HIWORD
(
margins
),
LOWORD
(
margins
));
DestroyWindow
(
hwnd
);
...
...
@@ -1706,7 +1705,6 @@ static void test_margins_default(const char* facename, UINT charset)
SendMessageA
(
hwnd
,
EM_SETMARGINS
,
EC_LEFTMARGIN
|
EC_RIGHTMARGIN
,
small_margins
);
SendMessageA
(
hwnd
,
EM_SETMARGINS
,
EC_LEFTMARGIN
|
EC_RIGHTMARGIN
,
MAKELONG
(
EC_USEFONTINFO
,
EC_USEFONTINFO
));
margins
=
SendMessageA
(
hwnd
,
EM_GETMARGINS
,
0
,
0
);
todo_wine_if
(
cjk
&&
expect
!=
MAKELONG
(
size
.
cx
/
2
,
size
.
cx
/
2
))
ok
(
margins
==
expect
,
"%s:%d: expected %d, %d, got %d, %d
\n
"
,
facename
,
charset
,
HIWORD
(
expect
),
LOWORD
(
expect
),
HIWORD
(
margins
),
LOWORD
(
margins
));
DestroyWindow
(
hwnd
);
...
...
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