You've already forked lazarus-ccr
richmemo: adding support for super and sub script into manually loading RTF. patch by Vladimir Rybant. (source: 783938acdd
)
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7283 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -451,6 +451,11 @@ begin
|
|||||||
rtfFontSize: prm.fnt.Size:=round(aparam/2);
|
rtfFontSize: prm.fnt.Size:=round(aparam/2);
|
||||||
rtfUnderline: if aparam=0 then Exclude(prm.fnt.Style,fsUnderline) else Include(prm.fnt.Style, fsUnderline);
|
rtfUnderline: if aparam=0 then Exclude(prm.fnt.Style,fsUnderline) else Include(prm.fnt.Style, fsUnderline);
|
||||||
rtfNoUnderline: Exclude(prm.fnt.Style, fsUnderline);
|
rtfNoUnderline: Exclude(prm.fnt.Style, fsUnderline);
|
||||||
|
|
||||||
|
rtfSuperScript: prm.fnt.VScriptPos:=vpSuperscript;
|
||||||
|
rtfSubScript : prm.fnt.VScriptPos:=vpSubScript;
|
||||||
|
rtfNoSuperSub : prm.fnt.VScriptPos:=vpNormal;
|
||||||
|
|
||||||
rtfHighlight: begin
|
rtfHighlight: begin
|
||||||
prm.fnt.HasBkClr := (aparam>0) and (aparam<=high(HColor));
|
prm.fnt.HasBkClr := (aparam>0) and (aparam<=high(HColor));
|
||||||
if prm.fnt.HasBkClr then begin
|
if prm.fnt.HasBkClr then begin
|
||||||
@ -720,6 +725,7 @@ var
|
|||||||
isbold : Boolean;
|
isbold : Boolean;
|
||||||
isitalic : Boolean;
|
isitalic : Boolean;
|
||||||
isuline : Boolean;
|
isuline : Boolean;
|
||||||
|
issupersub: Boolean;
|
||||||
isColor : integer;
|
isColor : integer;
|
||||||
|
|
||||||
pm : TParaMetric;
|
pm : TParaMetric;
|
||||||
@ -796,6 +802,7 @@ begin
|
|||||||
rng:=root;
|
rng:=root;
|
||||||
isbold:=false;
|
isbold:=false;
|
||||||
isitalic:=false;
|
isitalic:=false;
|
||||||
|
issupersub:=false;
|
||||||
iscolor:=0;
|
iscolor:=0;
|
||||||
while Assigned(rng) do begin
|
while Assigned(rng) do begin
|
||||||
u:=ARich.GetUText(rng.textStart, rng.textLength);
|
u:=ARich.GetUText(rng.textStart, rng.textLength);
|
||||||
@ -826,6 +833,20 @@ begin
|
|||||||
if isitalic then RtfOut('\i0');
|
if isitalic then RtfOut('\i0');
|
||||||
isitalic:=false;
|
isitalic:=false;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
if rng.font.VScriptPos=vpSuperScript then begin
|
||||||
|
RtfOut('\super');
|
||||||
|
issupersub:=true;
|
||||||
|
end;
|
||||||
|
if rng.font.VScriptPos=vpSubScript then begin
|
||||||
|
RtfOut('\sub');
|
||||||
|
issupersub:=true;
|
||||||
|
end;
|
||||||
|
if rng.font.VScriptPos=vpNormal then begin
|
||||||
|
if issupersub then RtfOut('\nosupersub');
|
||||||
|
issupersub:=false;
|
||||||
|
end;
|
||||||
|
|
||||||
RtfOut(' ');
|
RtfOut(' ');
|
||||||
|
|
||||||
i:=1;
|
i:=1;
|
||||||
|
@ -335,6 +335,7 @@ const
|
|||||||
rtfBackColor = 21;
|
rtfBackColor = 21;
|
||||||
rtfGray = 22;
|
rtfGray = 22;
|
||||||
rtfHighlight = 23;
|
rtfHighlight = 23;
|
||||||
|
rtfNoSuperSub = 24;
|
||||||
|
|
||||||
rtfPictAttr = 13;
|
rtfPictAttr = 13;
|
||||||
rtfMacQD = 0;
|
rtfMacQD = 0;
|
||||||
@ -469,7 +470,7 @@ type
|
|||||||
---------------------------------------------------------------------}
|
---------------------------------------------------------------------}
|
||||||
|
|
||||||
const
|
const
|
||||||
rtfKey : Array [0..284] of TRTFKey =
|
rtfKey : Array [0..287] of TRTFKey =
|
||||||
(
|
(
|
||||||
( rtfKMajor: RTFSPECIALCHAR; rtfKMinor : rtfCURHEADPICT; rtfKStr : 'chpict'; rtfKhash : 0),
|
( rtfKMajor: RTFSPECIALCHAR; rtfKMinor : rtfCURHEADPICT; rtfKStr : 'chpict'; rtfKhash : 0),
|
||||||
( rtfKMajor: rtfSpecialChar; rtfKMinor: rtfCurHeadDate; rtfKstr : 'chdate'; rtfkHash : 0),
|
( rtfKMajor: rtfSpecialChar; rtfKMinor: rtfCurHeadDate; rtfKstr : 'chdate'; rtfkHash : 0),
|
||||||
@ -529,6 +530,9 @@ const
|
|||||||
( rtfKMajor: rtfCharAttr; rtfKMinor: rtfNoUnderline; rtfKstr : 'ulnone'; rtfkHash : 0),
|
( rtfKMajor: rtfCharAttr; rtfKMinor: rtfNoUnderline; rtfKstr : 'ulnone'; rtfkHash : 0),
|
||||||
( rtfKMajor: rtfCharAttr; rtfKMinor: rtfSuperScript; rtfKstr : 'up'; rtfkHash : 0),
|
( rtfKMajor: rtfCharAttr; rtfKMinor: rtfSuperScript; rtfKstr : 'up'; rtfkHash : 0),
|
||||||
( rtfKMajor: rtfCharAttr; rtfKMinor: rtfSubScript; rtfKstr : 'dn'; rtfkHash : 0),
|
( rtfKMajor: rtfCharAttr; rtfKMinor: rtfSubScript; rtfKstr : 'dn'; rtfkHash : 0),
|
||||||
|
( rtfKMajor: rtfCharAttr; rtfKMinor: rtfSuperScript; rtfKstr : 'super'; rtfkHash : 0),
|
||||||
|
( rtfKMajor: rtfCharAttr; rtfKMinor: rtfSubScript; rtfKstr : 'sub'; rtfkHash : 0),
|
||||||
|
( rtfKMajor: rtfCharAttr; rtfKMinor: rtfNoSuperSub; rtfKstr : 'nosupersub'; rtfkHash : 0),
|
||||||
( rtfKMajor: rtfCharAttr; rtfKMinor: rtfRevised; rtfKstr : 'revised'; rtfkHash : 0),
|
( rtfKMajor: rtfCharAttr; rtfKMinor: rtfRevised; rtfKstr : 'revised'; rtfkHash : 0),
|
||||||
( rtfKMajor: rtfCharAttr; rtfKMinor: rtfForeColor; rtfKstr : 'cf'; rtfkHash : 0),
|
( rtfKMajor: rtfCharAttr; rtfKMinor: rtfForeColor; rtfKstr : 'cf'; rtfkHash : 0),
|
||||||
( rtfKMajor: rtfCharAttr; rtfKMinor: rtfBackColor; rtfKstr : 'cb'; rtfkHash : 0),
|
( rtfKMajor: rtfCharAttr; rtfKMinor: rtfBackColor; rtfKstr : 'cb'; rtfkHash : 0),
|
||||||
|
Reference in New Issue
Block a user