'function SSTextLeft (ACanvas: TCanvas; ARect: TRect; const S: string): integer;
var i, h, h3: integer; sup, sub: boolean; begin with ACanvas, ARect do begin h:= textHeight('H'); h3:= h div 3; brush.Style:= bsClear; moveTo(Left +1, Top +1); i:= 1; while i < Length(s) +1 do begin if s[i] = '^' then begin Inc(i); font.Height:= MulDiv(font.Height, 8, 10); textOut(penPos.X, penPos.Y -h3, s[i]); moveTo(penPos.X +1, penPos.Y +h3); font.Height:= h; Inc(i); end else if s[i] = '_' then begin Inc(i); font.Height:= MulDiv(font.Height, 8, 10); textOut(penPos.X, penPos.Y +h3, s[i]); moveTo(penPos.X +1, penPos.Y -h3); font.Height:= h; Inc(i); end else begin textOut(penPos.X, penPos.Y, s[i]); Inc(i); moveTo(penPos.X +1, penPos.Y); end; end;// while end; sup:= Pos('^', S) > 0; sub:= Pos('_', S) > 0; if sup and sub then result:= MulDiv(h, 5, 3) else if sup or sub then result:= h +h3 else result:= h; end;// SSTextLeft
"
source share