- added support for \ulnone (turning underline off)
- support for basic subscript and superscript - untested support for text offset
This commit is contained in:
parent
78e95198cb
commit
b16f330197
|
@ -321,11 +321,26 @@ void ME_RTFCharAttrHook(RTF_Info *info)
|
|||
case rtfUnderline:
|
||||
fmt.dwMask = CFM_UNDERLINE;
|
||||
fmt.dwEffects = info->rtfParam ? fmt.dwMask : 0;
|
||||
fmt.bUnderlineType = CFU_CF1UNDERLINE;
|
||||
break;
|
||||
case rtfNoUnderline:
|
||||
fmt.dwMask = CFM_UNDERLINE;
|
||||
fmt.dwEffects = 0;
|
||||
break;
|
||||
case rtfStrikeThru:
|
||||
fmt.dwMask = CFM_STRIKEOUT;
|
||||
fmt.dwEffects = info->rtfParam ? fmt.dwMask : 0;
|
||||
break;
|
||||
case rtfSubScript:
|
||||
case rtfSuperScript:
|
||||
case rtfSubScrShrink:
|
||||
case rtfSuperScrShrink:
|
||||
case rtfNoSuperSub:
|
||||
fmt.dwMask = CFM_SUBSCRIPT|CFM_SUPERSCRIPT;
|
||||
if (info->rtfMinor == rtfSubScrShrink) fmt.dwEffects = CFE_SUBSCRIPT;
|
||||
if (info->rtfMinor == rtfSuperScrShrink) fmt.dwEffects = CFE_SUPERSCRIPT;
|
||||
if (info->rtfMinor == rtfNoSuperSub) fmt.dwEffects = 0;
|
||||
break;
|
||||
case rtfBackColor:
|
||||
fmt.dwMask = CFM_BACKCOLOR;
|
||||
fmt.dwEffects = 0;
|
||||
|
|
|
@ -178,13 +178,23 @@ void ME_DrawTextWithStyle(ME_Context *c, int x, int y, LPCWSTR szText, int nChar
|
|||
HDC hDC = c->hDC;
|
||||
HGDIOBJ hOldFont;
|
||||
COLORREF rgbOld, rgbBack;
|
||||
int yOffset = 0, yTwipsOffset = 0;
|
||||
hOldFont = ME_SelectStyleFont(c->editor, hDC, s);
|
||||
rgbBack = ME_GetBackColor(c->editor);
|
||||
if ((s->fmt.dwMask & CFM_COLOR) && (s->fmt.dwEffects & CFE_AUTOCOLOR))
|
||||
rgbOld = SetTextColor(hDC, GetSysColor(COLOR_WINDOWTEXT));
|
||||
else
|
||||
rgbOld = SetTextColor(hDC, s->fmt.crTextColor);
|
||||
ExtTextOutW(hDC, x, y, 0, NULL, szText, nChars, NULL);
|
||||
if ((s->fmt.dwMask & s->fmt.dwEffects) & CFM_OFFSET) {
|
||||
yTwipsOffset = s->fmt.yOffset;
|
||||
}
|
||||
if ((s->fmt.dwMask & s->fmt.dwEffects) & (CFM_SUPERSCRIPT | CFM_SUBSCRIPT)) {
|
||||
if (s->fmt.dwEffects & CFE_SUPERSCRIPT) yTwipsOffset = s->fmt.yHeight/3;
|
||||
if (s->fmt.dwEffects & CFE_SUBSCRIPT) yTwipsOffset = -s->fmt.yHeight/12;
|
||||
}
|
||||
if (yTwipsOffset)
|
||||
yOffset = yTwipsOffset*GetDeviceCaps(hDC, LOGPIXELSY)/1440;
|
||||
ExtTextOutW(hDC, x, y-yOffset, 0, NULL, szText, nChars, NULL);
|
||||
if (width) {
|
||||
SIZE sz;
|
||||
GetTextExtentPoint32W(hDC, szText, nChars, &sz);
|
||||
|
|
|
@ -268,6 +268,8 @@ void ME_LogFontFromStyle(HDC hDC, LOGFONTW *lf, ME_Style *s)
|
|||
lf->lfUnderline = 1;
|
||||
if (s->fmt.dwEffects & s->fmt.dwMask & CFM_STRIKEOUT)
|
||||
lf->lfStrikeOut = 1;
|
||||
if (s->fmt.dwEffects & s->fmt.dwMask & (CFM_SUBSCRIPT|CFM_SUPERSCRIPT))
|
||||
lf->lfHeight = (lf->lfHeight*2)/3;
|
||||
/*lf.lfQuality = PROOF_QUALITY; */
|
||||
lf->lfPitchAndFamily = s->fmt.bPitchAndFamily;
|
||||
lf->lfCharSet = s->fmt.bCharSet;
|
||||
|
|
Loading…
Reference in New Issue