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
Solved

Font charset in D2

Posted on 1997-07-04
7
487 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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
select query - oracle 16 100
Delphi: Connect to running MS Outlook 4 117
JAudiorecorder record freezing the app 29 74
Need Help Delphi 2010 CheckBox1 Stored value in memo 13 70
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…
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…
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…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

791 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