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.
This commit is contained in:
Dylan Smith 2008-06-25 11:47:37 -04:00 committed by Alexandre Julliard
parent 60757ca6d5
commit cb1d7becf9

View File

@ -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;
}