LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 03-15-2015, 08:27 PM   #1
jeremya
LQ Newbie
 
Registered: Mar 2015
Distribution: Raspbian, Slackware
Posts: 7

Rep: Reputation: Disabled
Converting classic Slackware fonts (.fnt) to TrueType fonts?


Back in Slackware 3.5 I fell in love with the rl.fnt font:
http://imgur.com/KfB2YQj.png

I recently re-discovered it while playing around with a LIVE CD archive I found online...

Nowadays I spend most of my time in Windows, but I'm falling back in love with Linux and I'd really like have this font... everywhere (Windows, Raspbian, Slackware 14+, etc).

So, I'd love to convert it (or be pointed to a conversion that's already been done...) to a monospace TrueType font. The crux of the issues is that I can't find an online converter anywhere that understands the .fnt format. Most websites even claim it's an archaic Windows bitmap font format (Windows doesn't recognize it anymore). I've verified that Windows recognizes .fon bitmap font files, but not .fnt (if it ever did...).

Any clue on how to get this to happen?

Caveats:
According to http://www.techrepublic.com/blog/win...ommand-prompt/, in order for the font to be recognized in Windows:

Code:
In addition to the monospaced criteria, Microsoft also specifies that the font for the Command Prompt:
  1. Cannot be an italic font
  2. Cannot have a negative A or C space
  3. Must be FF_MODERN if it is a TrueType font
  4. Must be OEM_CHARSET if it is not a TrueType font
Of course, I also want to use the font in Raspbian. I figure once I get it converted to a TTF, it should be trivial to get it working over there...

So, I'd also love to know how I can guarantee criteria 2 and 3. (1 and 4 are irrelevant).

Thanks in advance for the help!

About me:
I'm a developer who is getting "back into Linux" after a 20 year hiatus. Back in my college days (mid-90s) I spent most of my time in Slackware 3.5 (and, admittedly I spent most of that time in a telnet client playing MUDs, shell scripting, and abusing the university's dial-up access with auto-re-dialer scripts my roommate and I hacked together...). I dual-booted to Windows 95 when I wanted to play games. ;-)

Last edited by jeremya; 03-16-2015 at 11:14 AM.
 
Old 03-16-2015, 11:51 AM   #2
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-14.2.1.2 on Lenovo Thinkpad W520
Posts: 8,856

Rep: Reputation: Disabled
I don't think that will be easy. In case you didn't find it already the spec is here.

I tried to open it in fontforge but it does not recognize it:
Code:
This does not appear to be a Windows FNT for FON file
I downloaded it from this link. Not sure it's the same as yours but it was shipped in Slackware 2.1 and "setfont rl.fnt" works here (Slackware 14.1).

Last edited by Didier Spaier; 03-16-2015 at 11:55 AM.
 
1 members found this post helpful.
Old 03-16-2015, 12:32 PM   #3
jeremya
LQ Newbie
 
Registered: Mar 2015
Distribution: Raspbian, Slackware
Posts: 7

Original Poster
Rep: Reputation: Disabled
Thank you!

Excellent find on the Classic Windows FNT spec.

The older RL.FNT seems to be identical to the newer one. Same size, same hash:

Code:
C:\Users\Jeremy\Desktop> Get-FileHash .\2.1.rl.fnt

Algorithm       Hash                                                                   Path
---------       ----                                                                   ----
SHA256          9F089C1EB1000D44CE100DDB60262574C388AB391150BE0530AC2FCCDE211989       C:\Users\Jeremy\Desktop\2.1.rl.fnt


C:\Users\Jeremy\Desktop> Get-FileHash rl.fnt

Algorithm       Hash                                                                   Path
---------       ----                                                                   ----
SHA256          9F089C1EB1000D44CE100DDB60262574C388AB391150BE0530AC2FCCDE211989       C:\Users\Jeremy\Desktop\rl.fnt
Now all I need is a classic Slackware FNT spec and perhaps I can build a converter to the Windows .FNT format... which may still work "out-of-the-box" as a Raster/Bitmap-type font. Either way, once the RL.FNT is translated into a "proper" .FNT, most of the online converters should be able to translate it into a TTF...

So, any idea where to find the file format definition for the "classic" Slackware .FNT format?
 
Old 03-16-2015, 01:33 PM   #4
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-14.2.1.2 on Lenovo Thinkpad W520
Posts: 8,856

Rep: Reputation: Disabled
Found some interesting stuff (I think):

The README that explains where the fonts come from
The source zipped archive vfont2.zip
The script used to extract the fonts from the archive

EDIT. First link fixed, thanks bassmadrigal.

PS the man page included in vfont2.zip states that this font was created in 1989 for OS/2

Last edited by Didier Spaier; 03-16-2015 at 02:14 PM. Reason: PS added.
 
1 members found this post helpful.
Old 03-16-2015, 01:42 PM   #5
bassmadrigal
LQ Guru
 
Registered: Nov 2003
Location: West Jordan, UT, USA
Distribution: Slackware
Posts: 6,020

Rep: Reputation: 3687Reputation: 3687Reputation: 3687Reputation: 3687Reputation: 3687Reputation: 3687Reputation: 3687Reputation: 3687Reputation: 3687Reputation: 3687Reputation: 3687
Quote:
Originally Posted by Didier Spaier View Post
The README that explains where the fonts come from
Looks like you forgot the http:// at the beginning of the link, so it now shows http://www.linuxquestions.org/questions/mirrors.slackware.com instead of pointing to the correct link: README
 
2 members found this post helpful.
Old 03-16-2015, 02:12 PM   #6
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-14.2.1.2 on Lenovo Thinkpad W520
Posts: 8,856

Rep: Reputation: Disabled
...hit Quote instead of Edit, sorry...

Last edited by Didier Spaier; 03-16-2015 at 02:13 PM.
 
Old 03-16-2015, 02:13 PM   #7
jeremya
LQ Newbie
 
Registered: Mar 2015
Distribution: Raspbian, Slackware
Posts: 7

Original Poster
Rep: Reputation: Disabled
Thank you again!

It certainly explains the pedigree (I did see the SCRIPT before but realized it wasn't doing much but copying 4k chunks from another file).

However, it doesn't provide insight into the actual binary .FNT format being used... at least not in an actionable way.

I suppose whatever font processing & display code Slackware is using could give some hints. I'd rather not reverse-engineer the format from the code, but if I get bored/motivated enough I suppose I could resort to that.
 
Old 03-16-2015, 02:41 PM   #8
Diantre
Member
 
Registered: Jun 2011
Distribution: Slackware
Posts: 515

Rep: Reputation: 228Reputation: 228Reputation: 228
Quote:
Originally Posted by jeremya View Post
So, I'd love to convert it (or be pointed to a conversion that's already been done...) to a monospace TrueType font. The crux of the issues is that I can't find an online converter anywhere that understands the .fnt format. Most websites even claim it's an archaic Windows bitmap font format (Windows doesn't recognize it anymore). I've verified that Windows recognizes .fon bitmap font files, but not .fnt (if it ever did...).

Any clue on how to get this to happen?
I tried to convert rl.fnt to another format, but fontforge is unable to open this fnt file (Didier already mentioned this). It turns out that rl.fnt is a raw font!

Code:
$ file rl.fnt
rl.fnt: data
From the setfont manpage:

Code:
FONT FORMATS
       The standard Linux font format is the PSF font.  It has a header describing font  proper‐
       ties like character size, followed by the glyph bitmaps, optionally followed by a Unicode
       mapping table giving the Unicode value for each glyph.   Several  other  (obsolete)  font
       formats  are  recognized.   If  the input file has code page format (probably with suffix
       .cp), containing three fonts with sizes e.g. 8x8, 8x14 and 8x16, then one of the  options
       -8  or  -14  or  -16 must be used to select one.  Raw font files are binary files of size
       256*N bytes, containing bit images for each of 256 characters, one byte  per  scan  line,
       and N bytes per character (0 < N <= 32).  Most fonts have a width of 8 bits, but with the
       framebuffer device (fb) other widths can be used.
To perform the conversion you'll need psftools:

Code:
$ raw2psf rl.fnt rl.psf
$ file rl.psf
rl.psf: Linux/i386 PC Screen Font v2 data, 256 characters, no directory, 16x8
However, fontforge is unable to open this psf file. Luckily psftools has more conversion utilities:

Code:
$ psf2[TAB]
psf2bbc   psf2bsd   psf2inc   psf2raw   psf2wof   psf2xbm   
psf2bdf   psf2fnt   psf2pbms  psf2txt   psf2wyse  psf2zx
I tried converting rl.psf to bdf:

Code:
$ psf2bdf rl.psf rl.bdf
$ file rl.bdf
rl.bdf: X11 BDF font, ASCII text
Now this rl.bdf file can be opened with fontforge, and from there it can be manipulated and saved to different formats, including TTF. I'm no expert with fontforge, so I have no clue about the steps necessary to convert a bitmap font to another format. Here's some info from the fontforge website.

Hope that helps.
 
4 members found this post helpful.
Old 03-16-2015, 11:58 PM   #9
jeremya
LQ Newbie
 
Registered: Mar 2015
Distribution: Raspbian, Slackware
Posts: 7

Original Poster
Rep: Reputation: Disabled
Thank you very much, Diantre!

This should be most helpful... I'll report back once I make some progress.

[edit]:

Made some early progress just hacking around the .FNT file given the spec hint in the setfont MAN page you referenced...

I'm able to tease the glyphs out easily with a little script I wrote. Result sample:

Code:
----816:
        
        
        
        
  0000  
 0   00 
     0  
    0   
   000  
     00 
     00 
     00 
    00  
 000    
        
        


...
---1184:
        
        
   0000 
    00  
    00  
    00  
    00  
    00  
    00  
    00  
    00  
    00  
    00  
    0   
0000    
        


---1200:
And the code I whipped up to do the conversion (my Windows environment is still way more friendly for me, so I used Powershell):

Code:
param($font = "RO.FNT")
$f = [System.IO.File]::ReadAllBytes($font)
$sb = New-Object System.Text.StringBuilder
$charSize = $f.Length / 256

for($i = 0; $i -lt $f.Length; $i += $charSize) {
    write-host -f DarkGray $(("{0}:" -f $i).PadLeft(8,'-'))
    for($j = 0; $j -lt $charSize; $j++) {
        # convert byte at offset to binary string and pad with 0s
        $buf = [Convert]::ToString($f[$i + $j],2).PadLeft(8,'0')

        # convert 0s to space and 1s to 0 for easier viewing
        $buf = $buf -replace "0"," "
        $buf = $buf -replace "1","0"

        $sb.Append($buf) > $null
        $sb.AppendLine() > $null
    }

    write-host $sb.ToString()
    $sb.Clear() > $null
}
It's far from the end goal, but being able to read the bitmaps is a huge first step! Thanks again, everyone!

Last edited by jeremya; 03-17-2015 at 12:43 AM. Reason: adding interim progress
 
Old 03-17-2015, 10:16 AM   #10
1337_powerslacker
Member
 
Registered: Nov 2009
Distribution: Slackware64-current
Posts: 728
Blog Entries: 1

Rep: Reputation: 474Reputation: 474Reputation: 474Reputation: 474Reputation: 474
Quote:
Originally Posted by jeremya View Post
Back in Slackware 3.5 I fell in love with the rl.fnt font:
http://imgur.com/KfB2YQj.png
Jeremy, your post stirred up some nostalgia on my part so, armed with information others have posted on this thread, I decided to embark on an effort to utilize the old font in Konsole.The result of my effort is posted below.

For those interested, I have attached the file itself. Due to the restrictions of LQ, I've had to add the .txt extension to get it to upload, but once you've downloaded, do the following:

Code:
mv rl.otf.txt rl.otf
sudo cp rl.otf /usr/share/fonts/OTF/
cd /usr/share/fonts/OTF/
sudo mkfontdir .
sudo mkfontscale .
sudo fc-cache -f
Happy Slacking!

Regards,

Matt

P.S. The font option displayed in Konsole's font selection dialog box is 'psf', for a reason I have yet to fathom. Probably someone who is more familiar with fonts could post why this is happening.
Attached Thumbnails
Click image for larger version

Name:	font_rl.png
Views:	104
Size:	53.6 KB
ID:	17809  
Attached Files
File Type: txt rl.otf.txt (9.5 KB, 30 views)
 
1 members found this post helpful.
Old 03-17-2015, 06:44 PM   #11
jeremya
LQ Newbie
 
Registered: Mar 2015
Distribution: Raspbian, Slackware
Posts: 7

Original Poster
Rep: Reputation: Disabled
Very cool.

Might I inquire as to how you made the jump from fnt (or bdf, etc) to otf?
 
Old 03-17-2015, 07:48 PM   #12
1337_powerslacker
Member
 
Registered: Nov 2009
Distribution: Slackware64-current
Posts: 728
Blog Entries: 1

Rep: Reputation: 474Reputation: 474Reputation: 474Reputation: 474Reputation: 474
Quote:
Originally Posted by jeremya View Post
Very cool.

Might I inquire as to how you made the jump from fnt (or bdf, etc) to otf?
You may. I used the command:
Code:
 
raw2psf rl.fnt rl.psf
to convert the raw font to a psf file via the psftools package per Diantre's suggestions.
Then I used the command:
Code:
psf2bdf rl.psf rl.bdf
to convert it from a .psf file to a file .bdf file, one that fontforge could open.

In fontforge, I opened the file, went to Element --> Font Info, clicked on 'General' on the left side, change 'Em size' to a power of 2; in this case, 2^10, or 1024, then clicked OK.

To save, I went to File --> Generate Font. Where it says 'No Outline Font', I clicked on the drop-down menu and selected Open Type (CFF), renamed the file above the selection box to reflect the new extension, and clicked 'Generate'. Viola! an OpenType font I could drop right into /usr/share/fonts/OTF. Ran the commands to register the new font, and configured Konsole to use the font. Retro goodness!
 
3 members found this post helpful.
Old 03-17-2015, 09:38 PM   #13
jeremya
LQ Newbie
 
Registered: Mar 2015
Distribution: Raspbian, Slackware
Posts: 7

Original Poster
Rep: Reputation: Disabled
Awesome. Thank you very much for the blow-by-blow... and for sharing the OTF!
 
Old 03-18-2015, 07:49 AM   #14
1337_powerslacker
Member
 
Registered: Nov 2009
Distribution: Slackware64-current
Posts: 728
Blog Entries: 1

Rep: Reputation: 474Reputation: 474Reputation: 474Reputation: 474Reputation: 474
Converting classic Slackware fonts (.fnt) to TrueType fonts?

You're welcome. I most certainly enjoyed the challenge. It's why I run Slackware in the first place. Keeps the mind sharp, especially as I am getting older and forgetting things.

Last edited by 1337_powerslacker; 03-18-2015 at 11:17 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
truetype fonts wetnose23 Slackware 14 10-06-2008 07:39 AM
Installing Microsoft's TrueType core fonts in Slackware r_jensen11 Slackware 4 09-12-2004 06:54 PM
Fonts (.fnt for the console), need some new ones! onu Linux - General 1 02-12-2004 11:13 PM
Truetype fonts wonderpun Linux - Software 2 10-09-2002 11:47 AM
TrueType Fonts under X B_Balazs Linux - Newbie 1 07-25-2001 08:07 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 07:08 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration