How do I convert old vga fonts to drawstring font?

General discussion for topics related to the FreeBASIC project or its community.
Post Reply
lassar
Posts: 306
Joined: Jan 17, 2006 1:35

How do I convert old vga fonts to drawstring font?

Post by lassar »

I have some vga 8x16 fonts, that I want to convert to drawstring fonts.

I can convert them easy enough to bitmap fonts.

They will need to be anti-aliased, and then converted to drawstring fonts.

Any idea how I can anti-alias them, and then convert them to drawstring fonts?
counting_pine
Site Admin
Posts: 6323
Joined: Jul 05, 2005 17:32
Location: Manchester, Lancs

Re: How do I convert old vga fonts to drawstring font?

Post by counting_pine »

Here are a couple of potentially useful posts/threads about custom fonts:
viewtopic.php?p=104790#p104790
https://freebasic.net/forum/viewtopic.php?f=9&t=25355

The wiki gives a simple example of generating/using one with the built-in character set: KeyPgDrawString
I don't know about antialiasing - I wouldn't have thought that would apply to VGA fonts. But as best I can recall, transparency is achieved using palette entry 0, or magenta (&hffff00ff), depending on the bit depth.
caseih
Posts: 2157
Joined: Feb 26, 2007 5:32

Re: How do I convert old vga fonts to drawstring font?

Post by caseih »

I don't think an 8x16 font can be antialiased! It would look terrible.

I don't know what drawstring is, but if it can work with TrueType fonts, here are a couple of TrueType versions of the classic IBM 8x16 font that I've used for years. Should do what you want:
http://laemeur.sdf.org/fonts/
https://www.dafont.com/nouveau-ibm.font
sancho3
Posts: 358
Joined: Sep 30, 2017 3:22

Re: How do I convert old vga fonts to drawstring font?

Post by sancho3 »

caseih wrote:I don't know what drawstring is,
Draw String is a FreeBASIC command that draws text on a graphic screen at pixel perfect location.
Here in the manual
It works natively with the built in system font but this is not very useful as the system font is small and can't be sized.
You can use a custom font with Draw String. In this context, the command essentially uses a bitmap image of each font.

It takes a bit of work to convert a TTF font to be able to use it with Draw String.
There is a couple of FB tools that have been made that convert them for you.
Here is one that I used and it worked well. The links are dead, but the code is in the thread.
I cannot help with anti-aliasing.
caseih
Posts: 2157
Joined: Feb 26, 2007 5:32

Re: How do I convert old vga fonts to drawstring font?

Post by caseih »

Gotcha.
lassar
Posts: 306
Joined: Jan 17, 2006 1:35

Re: How do I convert old vga fonts to drawstring font?

Post by lassar »

I figured out how to improve the vga font using xbrz 2x scaler.

Does DrawString support transparency using alpha mode?
MrSwiss
Posts: 3910
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: How do I convert old vga fonts to drawstring font?

Post by MrSwiss »

lassar wrote:Does 'Draw String' support transparency using alpha mode?
Yes. For details see: FB-Manual
Post Reply