[PATCH 2/2 v6] riched20: Call ITextHost_TxGetCharFormat() for setting default charformat.

Huw Davies huw at codeweavers.com
Wed Jul 18 03:02:39 CDT 2018


On Tue, Jul 17, 2018 at 08:42:32PM +0800, Jactry Zeng wrote:
> Signed-off-by: Jactry Zeng <jzeng at codeweavers.com>
> ---
>  dlls/riched20/para.c         | 11 +++++++++-
>  dlls/riched20/tests/txtsrv.c | 41 +++++++++++++++++++++++++++++++++++-
>  2 files changed, 50 insertions(+), 2 deletions(-)
> 
> diff --git a/dlls/riched20/para.c b/dlls/riched20/para.c
> index f2a70e5746..c52fb87173 100644
> --- a/dlls/riched20/para.c
> +++ b/dlls/riched20/para.c
> @@ -35,7 +35,7 @@ static ME_DisplayItem *make_para(ME_TextEditor *editor)
>  void ME_MakeFirstParagraph(ME_TextEditor *editor)
>  {
>    ME_Context c;
> -  CHARFORMAT2W cf;
> +  CHARFORMAT2W cf, cf_tmp;
>    LOGFONTW lf;
>    HFONT hf;
>    ME_TextBuffer *text = editor->pBuffer;
> @@ -44,6 +44,7 @@ void ME_MakeFirstParagraph(ME_TextEditor *editor)
>    ME_Style *style;
>    int eol_len;
>    WCHAR cr_lf[] = {'\r','\n',0};
> +  CHARFORMATW *host_cf;
>  
>    ME_InitContext(&c, editor, ITextHost_TxGetDC(editor->texthost));
>  
> @@ -73,6 +74,14 @@ void ME_MakeFirstParagraph(ME_TextEditor *editor)
>    cf.bCharSet = lf.lfCharSet;
>    cf.lcid = GetSystemDefaultLCID();
>  
> +  if (ITextHost_TxGetCharFormat(editor->texthost, (const CHARFORMATW **)&host_cf) == S_OK)
> +  {
> +    ZeroMemory(&cf_tmp, sizeof(cf_tmp));
> +    cf_tmp.cbSize = sizeof(cf_tmp);
> +    cfany_to_cf2w(&cf_tmp, (CHARFORMAT2W *)host_cf);
> +    merge_cf2w(&cf, &cf_tmp);
> +  }
> +

You should be able to use ME_SetDefaultCharFormat() for this.

Huw.



More information about the wine-devel mailing list