FONTS

  1. How can my app use MY FONTS? not user's
  2. Font Sites

How can my app use MY FONTS? not user's

From: choate@cswnet.com (Brad Choate)

>Can someone please tell me the neatest way to make sure my app uses
>fonts that I can provide, rather than the nearest font the user has
>installed on their system?  I have tried copying a #.ttf file into the
>users windows\system directory but the app still can't pick it up.

The following is some Delphi 1 code that I have used for successfully installing dynamic fonts that are only loaded while the application is running. You can place the font file(s) within the application directory. It will be installed when the form loads and unloaded once the form is destroyed. You may need to modify the code to work with Delphi 2 since it calls various Windows API calls that may or may not have changed. Where you see "..." in the code, that is just to identify that other code can be placed there.

Of course, substitute "MYFONT" for the name of your font file.


type
  TForm1=class( TForm )
      procedure FormCreate(Sender: TObject);
      procedure FormDestroy(Sender: TObject);
      ...
    private
      { Private declarations }
      bLoadedFont: boolean;
    public
      { Public declarations }
  end;

procedure TForm1.FormCreate(Sender: TObject);

  var
    sAppDir: string;
    sFontRes: string;

  begin
  sAppDir := Application.ExeName;
  sAppDir := copy( sAppDir, 1, rpos( '\', sAppDir ) );

  sFontRes := sAppDir + 'MYFONT.FOT';
  if not FileExists( sFontRes ) then
    begin
    sFontRes := sFontRes + #0;
    sFont := sAppDir + 'MYFONT.TTF' + #0;
    CreateScalableFontResource( 0, @sFontRes[ 1 ], @sFont[ 1 ], nil );
    end;

  sFontRes := sAppDir + 'MYFONT.FOT';
  if FileExists( sFontRes ) then
    begin
    sFontRes := sFontRes + #0;
    if AddFontResource( @sFontRes[ 1 ] ) = 0 then
      bLoadedFont := false
    else
      begin
      bLoadedFont := true;
      SendMessage( HWND_BROADCAST, WM_FONTCHANGE, 0, 0 );
      end;
    end;

  ...
  end;

procedure TForm1.FormDestroy(Sender: TObject);

  var
    sFontRes: string;

  begin
  if bLoadedFont then
    begin
    sFontRes := sAppDir + 'MYFONT.FOT' + #0;
    RemoveFontResource( @sFontRes[ 1 ] );
    SendMessage( HWND_BROADCAST, WM_FONTCHANGE, 0, 0 );
    end;
  end;

Font Sites

This does not really belong to the UDDF, but I use a font or two in my applications, so I wanted to add it here any way.

I'm still building this part, so the Free buttons are not all included yet.
The Font Empire http://fontempire.host4u.com
The Font Empire: many weird display ttf http://www.hyper-cities.com/fontempire/
free.jpg - 1.3 K Frontation http://users.skynet.be/micheyva/
http://www.ccse.net/~harris/
free.jpg - 1.3 K FA - PC ****MANY Truetype Links http://home1.gte.net/tiaralyn/pctt.htm
free.jpg - 1.3 K Create 8 ╖ Fonts http://thomas.simplenet.com/fonts/
free.jpg - 1.3 K Floor 13: TT font arch. Previews http://freespace.virgin.net/james.devlin/frame.htm
OMEGA Font Labs http://members.tripod.com/~DrNimbus/
Scriptorium Home Page http://ragnarokpress.com/scriptorium/
free.jpg - 1.3 K Brain Stew Font Archive http://home.industrynet.net/brainstew/archive.html
Vernalex Fonts (a few dozen ttf) http://www.geocities.com/TimesSquare/6864/fonts.html
Choose your font ! ...STYLEsolutions http://prinz.hannover.sgh-net.de/~mischulz/fonts.html
sokrates' useful links

sokratype main - food for your typewriter

http://www.datacomm.ch/sokrates/useful.html

http://www.datacomm.ch/sokrates/sokratype/fontsmain.html

fontastic! - overview http://rover.wiesbaden.netsurf.de/~kikita/font.htm
All Good Thing Typography - Redsun Home Page http://www.redsun.com/
free.jpg - 1.3 K Internet Font Archives http://www.ora.com/homepages/comp.fonts/ifa/index.htm
Softy TT editor http://home.iclweb.com/icl1/d.w.emmett/
Kemosabe's Font Source -- from a.b.f http://magnagraphics.com/fonts/
retype - typefaces by christopher houston http://users.iafrica.com/c/ch/chouston/
emerald city fontwerks http://www.speakeasy.org/~ecf/
http://freespace.virgin.net/james.devlin/
http://www.freeyellow.com/members2/neatcap/
RudynFluffy's World: some fonts http://www.geocities.com/SoHo/Studios/5424/
Robotic Attack Fonts - The Fonts http://www.sentex.net/~jmartz/attack/fonts.html
The Chankstore http://www.bitstream.net/chankstore/table.html
Chank: gas - monkies - tacos - fonts http://www.chank.com/fuelfonts/free.htm
Cheops Fonts: !original

Cheops Font Utilities

Font Garden

http://web.idirect.com/~experts/cheops/fonts.html

http://web.idirect.com/~experts/cheops/utils.html

http://web.idirect.com/~experts/font/index.html

ACiD Productions Home Page http://www.acid.org/apps/apps.html

http://www.acid.org/

Janda Web!: fonts, graphics http://www.geocities.com/~jandaweb/
gaston yagmourian : type: T1!, Dali-inspired, etc http://tausystems.com/gaston/type-index.html
http://www.mabb.com/library.htm
wonderweb free font site http://www.chez.com/wonderweb/typo/
> Font Links http://members.aol.com/JR9er/index.html


Please email me and tell me if you liked this page.