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
7f5f590d
Commit
7f5f590d
authored
Apr 25, 2019
by
Akihiro Sagawa
Committed by
Alexandre Julliard
Apr 25, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comctl32/edit: Implement WM_SETFONT margins in the CJK case.
Signed-off-by:
Akihiro Sagawa
<
sagawa.aki@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
640c92b8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
4 deletions
+28
-4
edit.c
dlls/comctl32/edit.c
+28
-2
edit.c
dlls/comctl32/tests/edit.c
+0
-2
No files found.
dlls/comctl32/edit.c
View file @
7f5f590d
...
...
@@ -3708,6 +3708,29 @@ static void EDIT_WM_SetFocus(HTHEME theme, EDITSTATE *es)
}
static
DWORD
get_font_margins
(
HDC
hdc
,
const
TEXTMETRICW
*
tm
)
{
ABC
abc
[
256
];
SHORT
left
,
right
;
UINT
i
;
if
(
!
(
tm
->
tmPitchAndFamily
&
(
TMPF_VECTOR
|
TMPF_TRUETYPE
)))
return
MAKELONG
(
EC_USEFONTINFO
,
EC_USEFONTINFO
);
if
(
!
is_cjk
(
hdc
))
return
MAKELONG
(
EC_USEFONTINFO
,
EC_USEFONTINFO
);
if
(
!
GetCharABCWidthsW
(
hdc
,
0
,
255
,
abc
))
return
0
;
left
=
right
=
0
;
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
abc
);
i
++
)
{
if
(
-
abc
[
i
].
abcA
>
right
)
right
=
-
abc
[
i
].
abcA
;
if
(
-
abc
[
i
].
abcC
>
left
)
left
=
-
abc
[
i
].
abcC
;
}
return
MAKELONG
(
left
,
right
);
}
/*********************************************************************
*
* WM_SETFONT
...
...
@@ -3723,6 +3746,7 @@ static void EDIT_WM_SetFont(EDITSTATE *es, HFONT font, BOOL redraw)
HDC
dc
;
HFONT
old_font
=
0
;
RECT
clientRect
;
DWORD
margins
;
es
->
font
=
font
;
EDIT_InvalidateUniscribeData
(
es
);
...
...
@@ -3732,6 +3756,7 @@ static void EDIT_WM_SetFont(EDITSTATE *es, HFONT font, BOOL redraw)
GetTextMetricsW
(
dc
,
&
tm
);
es
->
line_height
=
tm
.
tmHeight
;
es
->
char_width
=
tm
.
tmAveCharWidth
;
margins
=
get_font_margins
(
dc
,
&
tm
);
if
(
font
)
SelectObject
(
dc
,
old_font
);
ReleaseDC
(
es
->
hwndSelf
,
dc
);
...
...
@@ -3739,8 +3764,9 @@ static void EDIT_WM_SetFont(EDITSTATE *es, HFONT font, BOOL redraw)
/* Reset the format rect and the margins */
GetClientRect
(
es
->
hwndSelf
,
&
clientRect
);
EDIT_SetRectNP
(
es
,
&
clientRect
);
EDIT_EM_SetMargins
(
es
,
EC_LEFTMARGIN
|
EC_RIGHTMARGIN
,
EC_USEFONTINFO
,
EC_USEFONTINFO
,
FALSE
);
if
(
margins
)
EDIT_EM_SetMargins
(
es
,
EC_LEFTMARGIN
|
EC_RIGHTMARGIN
,
LOWORD
(
margins
),
HIWORD
(
margins
),
FALSE
);
if
(
es
->
style
&
ES_MULTILINE
)
EDIT_BuildLineDefs_ML
(
es
,
0
,
get_text_length
(
es
),
0
,
NULL
);
...
...
dlls/comctl32/tests/edit.c
View file @
7f5f590d
...
...
@@ -1703,7 +1703,6 @@ static void test_margins_default(const char* facename, UINT charset)
SendMessageA
(
hwnd
,
EM_SETMARGINS
,
EC_LEFTMARGIN
|
EC_RIGHTMARGIN
,
small_margins
);
SendMessageA
(
hwnd
,
WM_SETFONT
,
(
WPARAM
)
hfont
,
MAKELPARAM
(
TRUE
,
0
));
margins
=
SendMessageA
(
hwnd
,
EM_GETMARGINS
,
0
,
0
);
todo_wine_if
(
cjk
)
ok
(
margins
==
font_expect
,
"%s:%d: got %d, %d
\n
"
,
facename
,
charset
,
HIWORD
(
margins
),
LOWORD
(
margins
));
SendMessageA
(
hwnd
,
EM_SETMARGINS
,
EC_LEFTMARGIN
|
EC_RIGHTMARGIN
,
small_margins
);
SendMessageA
(
hwnd
,
EM_SETMARGINS
,
EC_LEFTMARGIN
|
EC_RIGHTMARGIN
,
MAKELONG
(
EC_USEFONTINFO
,
EC_USEFONTINFO
));
...
...
@@ -1722,7 +1721,6 @@ static void test_margins_default(const char* facename, UINT charset)
SendMessageA
(
hwnd
,
EM_SETMARGINS
,
EC_LEFTMARGIN
|
EC_RIGHTMARGIN
,
small_margins
);
SendMessageA
(
hwnd
,
WM_SETFONT
,
(
WPARAM
)
hfont
,
MAKELPARAM
(
TRUE
,
0
));
margins
=
SendMessageA
(
hwnd
,
EM_GETMARGINS
,
0
,
0
);
todo_wine_if
(
cjk
)
ok
(
margins
==
font_expect
,
"%s:%d: got %d, %d
\n
"
,
facename
,
charset
,
HIWORD
(
margins
),
LOWORD
(
margins
));
SendMessageA
(
hwnd
,
EM_SETMARGINS
,
EC_LEFTMARGIN
|
EC_RIGHTMARGIN
,
small_margins
);
SendMessageA
(
hwnd
,
EM_SETMARGINS
,
EC_LEFTMARGIN
|
EC_RIGHTMARGIN
,
MAKELONG
(
EC_USEFONTINFO
,
EC_USEFONTINFO
));
...
...
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