Solved

Subscript & SuperScript

Posted on 1998-04-22
1
803 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

710 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