Solved

Subscript & SuperScript

Posted on 1998-04-22
1
812 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses
Course of the Month8 days, 15 hours left to enroll

617 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