How do I convert old vga fonts to drawstring font?

For other topics related to the FreeBASIC project or its community.
lassar
Posts: 300
Joined: Jan 17, 2006 1:35
Contact:

How do I convert old vga fonts to drawstring font?

Postby lassar » Jul 02, 2018 3:43

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: 6166
Joined: Jul 05, 2005 17:32
Location: Manchester, Lancs

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

Postby counting_pine » Jul 02, 2018 13:05

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

The wiki gives a simple example of generating/using one with the built-in character set: /wiki/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: 1335
Joined: Feb 26, 2007 5:32

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

Postby caseih » Jul 02, 2018 14:01

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?

Postby sancho3 » Jul 02, 2018 23:50

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: 1335
Joined: Feb 26, 2007 5:32

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

Postby caseih » Jul 03, 2018 3:27

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

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

Postby lassar » Jul 03, 2018 11:36

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

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

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

Postby MrSwiss » Jul 03, 2018 11:40

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

Return to “Community Discussion”

Who is online

Users browsing this forum: Baidu [Spider] and 2 guests