mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-14 19:25:39 +00:00
richedit: Handle missing colours in rtf colour table.
When a colour table entry is empty, then the default colour is used. For an incomplete colour table entry 0 is used for the missing colours. Previously the -1 value used internally for missing colours was being converted into white, where it should be using the default colour that is normally black. This bug could be seen by loading the following rich text into wordpad: {\rtf{\colortbl;;}\cf1 text}
This commit is contained in:
parent
1e5d72a630
commit
dde41d5c13
|
@ -422,7 +422,10 @@ void ME_RTFCharAttrHook(RTF_Info *info)
|
|||
else if (info->rtfParam != rtfNoParam)
|
||||
{
|
||||
RTFColor *c = RTFGetColor(info, info->rtfParam);
|
||||
fmt.crTextColor = (c->rtfCBlue<<16)|(c->rtfCGreen<<8)|(c->rtfCRed);
|
||||
if (c && c->rtfCBlue >= 0)
|
||||
fmt.crTextColor = (c->rtfCBlue<<16)|(c->rtfCGreen<<8)|(c->rtfCRed);
|
||||
else
|
||||
fmt.dwEffects = CFE_AUTOBACKCOLOR;
|
||||
}
|
||||
break;
|
||||
case rtfForeColor:
|
||||
|
@ -433,10 +436,11 @@ void ME_RTFCharAttrHook(RTF_Info *info)
|
|||
else if (info->rtfParam != rtfNoParam)
|
||||
{
|
||||
RTFColor *c = RTFGetColor(info, info->rtfParam);
|
||||
if (c)
|
||||
if (c && c->rtfCBlue >= 0)
|
||||
fmt.crTextColor = (c->rtfCBlue<<16)|(c->rtfCGreen<<8)|(c->rtfCRed);
|
||||
else
|
||||
fmt.crTextColor = 0;
|
||||
else {
|
||||
fmt.dwEffects = CFE_AUTOCOLOR;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case rtfFontNum:
|
||||
|
|
|
@ -990,18 +990,21 @@ static void ReadColorTbl(RTF_Info *info)
|
|||
break;
|
||||
}
|
||||
cp->rtfCNum = cnum++;
|
||||
cp->rtfCRed = cp->rtfCGreen = cp->rtfCBlue = -1;
|
||||
cp->rtfNextColor = info->colorList;
|
||||
info->colorList = cp;
|
||||
while (RTFCheckCM (info, rtfControl, rtfColorName))
|
||||
{
|
||||
switch (info->rtfMinor)
|
||||
{
|
||||
case rtfRed: cp->rtfCRed = info->rtfParam; break;
|
||||
case rtfGreen: cp->rtfCGreen = info->rtfParam; break;
|
||||
case rtfBlue: cp->rtfCBlue = info->rtfParam; break;
|
||||
}
|
||||
RTFGetToken (info);
|
||||
if (!RTFCheckCM (info, rtfControl, rtfColorName))
|
||||
cp->rtfCRed = cp->rtfCGreen = cp->rtfCBlue = -1;
|
||||
else {
|
||||
cp->rtfCRed = cp->rtfCGreen = cp->rtfCBlue = 0;
|
||||
do {
|
||||
switch (info->rtfMinor)
|
||||
{
|
||||
case rtfRed: cp->rtfCRed = info->rtfParam & 0xFF; break;
|
||||
case rtfGreen: cp->rtfCGreen = info->rtfParam & 0xFF; break;
|
||||
case rtfBlue: cp->rtfCBlue = info->rtfParam & 0xFF; break;
|
||||
}
|
||||
RTFGetToken (info);
|
||||
} while (RTFCheckCM (info, rtfControl, rtfColorName));
|
||||
}
|
||||
if (info->rtfClass == rtfEOF)
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue