Solved

Font charset in D2

Posted on 1997-07-04
7
486 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
ID: 1338209
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
ID: 1338210
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
ID: 1338211
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
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

 
LVL 1

Expert Comment

by:Gabor
ID: 1338212
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
ID: 1338213
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
ID: 1338214
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
ID: 1338215
ok, i'll try
thanks
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
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…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

777 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