Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Subscript & SuperScript

Posted on 1998-04-22
1
Medium Priority
?
817 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 40 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

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…
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…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

715 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