Solved

Font charset in D2

Posted on 1997-07-04
7
481 Views
Last Modified: 2013-12-02
Is it possible to change font charset in D2? I know than in D3 TFont has this property, but I don't have one ;-(
0
Comment
Question by:xire
  • 3
  • 2
  • 2
7 Comments
 
LVL 3

Expert Comment

by:mheacock
Comment Utility
The charset is a unicode feature...the 32-bit character set.

I don't think that D2's TFont supports unicode, thus I don't
think it is possible.
0
 

Author Comment

by:xire
Comment Utility
Well, when I read about D2 new features unicode was noticed as as
new feature. Recently I checked D2 VCL sources and found that  charset is there, but it always is set to CHARSET_DEFAULT.
Any ideas?

0
 
LVL 3

Expert Comment

by:mheacock
Comment Utility
Ideas...I'll see if I can find some time to look at the source
for TFont...

In the meantime, maybe you can look too and tell me this...
what is the property CharSet defined as...or where...is
it protected?  Private?

If it is protected, you can derive a new class from TFont
and move CharSet to the public section, thus giving you access
to it...

I would suspect though that Delphi does not support unicode
in the TFont class.  I know Delphi 2 supports unicode in
its string types (widestring), but if they didn't add this
support to TFont, then you are out of luck...I would suggest
looking for a 3rd party component that supports it...or
derive a new component (as per above) or get Delphi 3.

0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 1

Expert Comment

by:Gabor
Comment Utility
I'm afraid you have to recompile your Delphi library, with your modified Graphics.pas unit. I've already made some modification on the original source, and after it I had to recompile... So it isn't so easy. It's worth more than 100 points.
0
 

Author Comment

by:xire
Comment Utility
Ok. How much do you want for information on how to recompile Delphi library? I alredy tried to do it but failed.
0
 
LVL 1

Accepted Solution

by:
Gabor earned 100 total points
Comment Utility
I was thinking and I found an easier way for you (maybe it isn't the easiest).

1. The next units have to be copied to your local dir from Delphi\Source\VCL.
     Dialogs
     Extctrls
     Graphics
     Printers
     Controls
     Menus
     Forms

2. Rename all these units to X... (ex. Graphics to XGraphics)!
   Don't forget to change the unit name (unit XGraphics ...)!

3. Add all these units to your project!

4. At 'Project options'->'Directories/Conditionals' add the following text to 'Unit Aliases'
   'Graphics=XGraphics;Controls=XControls;Forms=XForms;Printers=XPrinters;Menus=XMenus;Dialogs=XDialogs;Stdctrls=XStdctrls;Extctrls=XExtctrls'

5. Make the following modifications on XGraphics.pas!

  TFontData = record
    Handle: HFont;
    Height: Integer;
    Pitch: TFontPitch;
    Style: TFontStyles;
    Name: TFontName;
    CharSet: Integer;           {<-insert this field}
  end;
  ...
  {Add these methods to the protected part of TFont}
    function GetCharSet: Integer;
    procedure SetCharSet(cs: Integer);
  ...
  {Add this property to the published part of TFont}
    property CharSet: Integer read GetCharSet write SetCharSet;
  ...
  {At the implementation part / TFont part}
    var
      DefFontData: TFontData = (
        Handle: 0;
        Height: 0;
        Pitch: fpDefault;
        Style: [];
        Name: 'MS Sans Serif';
        CharSet: DEFAULT_CHARSET);      {<-insert this value}
    ...
    {Modify the TFont.GetHandle method}
    ...
            lfCharSet := Font.CharSet;
    ...
    {And the two methods}
    function TFont.GetCharSet: Integer;
    begin
      Result := FResource^.Font.CharSet;
    end;

    procedure TFont.SetCharSet(Value: Integer);
    var
      FontData: TFontData;
    begin
      GetData(FontData);
      FontData.CharSet := Value;
      SetData(FontData);
    end;

OK. I think this will be good for you.
Good luck!

0
 

Author Comment

by:xire
Comment Utility
ok, i'll try
thanks
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
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…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

728 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