Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Font file formats  (Read 10011 times)

0 Members and 1 Guest are viewing this topic.

dunce

  • Jr. Member
  • **
  • Posts: 77
    • View Profile
Font file formats
« on: September 10, 2007, 01:32:57 pm »
SFML font tutorial says:
Quote
SFML is able to load any valid font file (TTF, CFF, PCF, BDF, and a lot more)

I don't manage to pre-load windows fonts *.fon. The files was produced out of *.ttf files with a conversion tool. In Windows I can use these files without problems, but SFML application renders the example string with the default font and ignores my efforts to use *.fon. If I use the original *.ttf font (mistral.ttf in this case), everything works fine.
Am I doing anything wrong? Is the *.fon font format supported?
Code: [Select]

.....
sf::String::PreloadFont("mistral.fon", 36.0f, L"ABCDE");
sf::String alphabet1;
alphabet1.SetFont("mistral.fon");
alphabet1.SetSize(36.0f);
alphabet1.SetLeft(10);
alphabet1.SetTop(160);
alphabet1.SetText("ABCDE");
.....
App.Draw(alphabet1);

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Font file formats
« Reply #1 on: September 10, 2007, 03:56:33 pm »
SFML internally uses the FreeType library, so it can load what FreeType can load.

From the FreeType features page :
Quote
   *  TrueType fonts (and collections)
    * Type 1 fonts
    * CID-keyed Type 1 fonts
    * CFF fonts
    * OpenType fonts (both TrueType and CFF variants)
    * SFNT-based bitmap fonts
    * X11 PCF fonts
    * Windows FNT fonts
    * BDF fonts (including anti-aliased ones)
    * PFR fonts
    * Type 42 fonts (limited support)
Laurent Gomila - SFML developer

dunce

  • Jr. Member
  • **
  • Posts: 77
    • View Profile
Font file formats
« Reply #2 on: September 11, 2007, 06:05:01 am »
I've tried to use BDF fonts. No success. :(  The text is rendered with the default font. I want to use my own bitmap fonts to avoid licensing issues. Free TrueType and OpenType fonts that I found have restrictions on commercial use. Has anyone used BDF fonts out-of-the-box with SFML or directly with FreeType2? It seems that I need some guidance.

 

anything