Solved

Subscript & SuperScript

Posted on 1998-04-22
1
794 Views
Last Modified: 2008-02-01
I got a problem here. I can set font in TRichEdit to Superscript or
Subscript, but don't know how to restore it to normal size.
So the question is:
1. How to restore superscript or subscript font to normal size (before it set)?
2. How to detect superscript or subcript font? I mean, if I block a font,
   and it's superscript or superscript then in my TMenuItem it will show
   checkmark.
Here's the program...

procedure TMainForm.SetFontText(IsSuperScript: boolean; SetToNormal: boolean);
var
  format: TCharFormat;
begin
  Editor.Perform(EM_GETCHARFORMAT, SCF_SELECTION, LongInt(@format));
  FillChar(format, sizeof(format), 0);
  with format do begin
    cbSize:= sizeof(format);
    dwMask:= CFM_OFFSET;
    if Not SetToNormal then begin
      if IsSuperScript then
        yOffset:= 60
      else
        yOffset:= -60;
    end else begin
      if IsSuperScript then begin { Procedure pemanggilnya = SuperScript }
        if SuperScript.Checked then begin
          yOffset:= 0;
          SuperScript.Checked:= false
        end;
      end else begin
        if SubScript.Checked then begin { Procedure pemanggilnya = SubScript }
          yOffset:= 0;
          SubScript.Checked:= false
        end;
      end;
    end;
  end;
  Editor.Perform(EM_SETCHARFORMAT, SCF_SELECTION, LongInt(@format));
end;

Thanks experts...

Daniel
0
Comment
Question by:daniel_c
1 Comment
 
LVL 8

Accepted Solution

by:
ZifNab earned 20 total points
ID: 1336310
Hi daniel_C,

Why not storing the font, before you change it to sub/super script? Or something like that?

Regards, Zif.


0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now