RICHEDIT20: subscript and superscript - preliminary support
Krzysztof Foltman
wdev at foltman.com
Sun Jun 12 03:27:27 CDT 2005
ChangeLog:
* added support for \ulnone (turning underline off)
* support for basic subscript and superscript
* untested support for text offset
Krzysztof
-------------- next part --------------
? 32.rtf
? supersub.rtf
? supersub2.rtf
Index: editor.c
===================================================================
RCS file: /home/wine/wine/dlls/riched20/editor.c,v
retrieving revision 1.28
diff -u -r1.28 editor.c
--- editor.c 23 May 2005 09:54:32 -0000 1.28
+++ editor.c 12 Jun 2005 08:10:51 -0000
@@ -321,11 +321,26 @@
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;
Index: paint.c
===================================================================
RCS file: /home/wine/wine/dlls/riched20/paint.c,v
retrieving revision 1.10
diff -u -r1.10 paint.c
--- paint.c 24 May 2005 10:10:54 -0000 1.10
+++ paint.c 12 Jun 2005 08:10:51 -0000
@@ -178,13 +178,23 @@
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);
Index: style.c
===================================================================
RCS file: /home/wine/wine/dlls/riched20/style.c,v
retrieving revision 1.5
diff -u -r1.5 style.c
--- style.c 11 May 2005 15:56:34 -0000 1.5
+++ style.c 12 Jun 2005 08:10:52 -0000
@@ -268,6 +268,8 @@
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;
More information about the wine-patches
mailing list