?
Solved

Font charset in D2

Posted on 1997-07-04
7
Medium Priority
?
505 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
[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
  • 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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 300 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

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…
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…
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…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses

650 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