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
c5823e9c
Commit
c5823e9c
authored
Apr 11, 2019
by
Akihiro Sagawa
Committed by
Alexandre Julliard
Apr 11, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32: 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
8ba6c1f2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
5 deletions
+40
-5
edit.c
dlls/user32/edit.c
+38
-3
edit.c
dlls/user32/tests/edit.c
+2
-2
No files found.
dlls/user32/edit.c
View file @
c5823e9c
...
...
@@ -2841,6 +2841,32 @@ static void EDIT_EM_SetLimitText(EDITSTATE *es, UINT limit)
es
->
buffer_limit
=
limit
;
}
static
BOOL
is_cjk_charset
(
HDC
dc
)
{
switch
(
GdiGetCodePage
(
dc
))
{
case
932
:
case
936
:
case
949
:
case
950
:
case
1361
:
return
TRUE
;
default:
return
FALSE
;
}
}
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
*
);
/*********************************************************************
*
...
...
@@ -2870,9 +2896,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_charset
(
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/user32/tests/edit.c
View file @
c5823e9c
...
...
@@ -1632,7 +1632,7 @@ 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_charset
&&
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
);
...
...
@@ -1652,7 +1652,7 @@ 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_charset
&&
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