Dylan Smith : richedit: Fixed bug preventing bold from being set with EM_SETCHARFORMAT.

Alexandre Julliard julliard at winehq.org
Thu Jun 26 14:50:55 CDT 2008


Module: wine
Branch: master
Commit: cb1d7becf9057e87b736f4590b89b27409f86ee7
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=cb1d7becf9057e87b736f4590b89b27409f86ee7

Author: Dylan Smith <dylan.ah.smith at gmail.com>
Date:   Wed Jun 25 11:47:37 2008 -0400

richedit: Fixed bug preventing bold from being set with EM_SETCHARFORMAT.

Previously bold needed to be set by setting CFM_WEIGHT in the
CHARFORMAT2 structure, and then setting the appropriate wWeight value.
This approach isn't even supported in version 3.0 of the richedit
control. Now bold can be set/unset properly for Windows or Wine using
CFE_BOLD in dwEffects and with CFM_BOLD set in the dwMask flag.

---

 dlls/riched20/style.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/dlls/riched20/style.c b/dlls/riched20/style.c
index b483be0..66e45f5 100644
--- a/dlls/riched20/style.c
+++ b/dlls/riched20/style.c
@@ -221,6 +221,15 @@ ME_Style *ME_ApplyStyle(ME_Style *sSrc, CHARFORMAT2W *style)
       s->fmt.bUnderlineType = (style->dwEffects & CFM_UNDERLINE) ?
           CFU_CF1UNDERLINE : CFU_UNDERLINENONE;
   }
+  if (style->dwMask & CFM_BOLD && !(style->dwMask & CFM_WEIGHT))
+  {
+      s->fmt.wWeight = (style->dwEffects & CFE_BOLD) ? FW_BOLD : FW_NORMAL;
+  } else if (style->dwMask & CFM_WEIGHT && !(style->dwMask & CFM_BOLD)) {
+      if (style->wWeight > FW_NORMAL)
+          s->fmt.dwEffects |= CFE_BOLD;
+      else
+          s->fmt.dwEffects &= ~CFE_BOLD;
+  }
   return s;
 }
 




More information about the wine-cvs mailing list