Author Topic: Font Support  (Read 3926 times)

igamealot

  • Guest
Font Support
« on: January 21, 2013, 12:53:02 PM »
Just read the latest blog. How does loading fonts work?
Fonts are what brought me here believe it or not.
Printing the Mattel Aquarius character ROM from 1982 is a thing of mine.


This is one of my versions of the font
Here is a new version from someone more font savvy. Well here's the whole page you may want to score more fonts.
Kreative Software Relay Fonts

Still haven't tested the font print with EGSL. My font and the font from Kreative don't actually print the character set correctly using the standard ascii access. For instance with code like
Code: [Select]
c=""
n=0
for i=1,255,1 do
n=n+
c=c..string.char(i).." "
-- new row
   if n==14 then
   c=c.."\r"
    n=0
end
end
print(c)
Should produce something like the image above, but a bunch of characters are missing or out of wack.
They exist in the character map, but not in their correct enumerations.

Anyway thats my font story.
(happy to see SDL go away btw)

So looks like font fixing is to come.
« Last Edit: January 21, 2013, 03:50:53 PM by igamealot »

Cybermonkey

  • Administrator
  • *****
  • Posts: 0
Re: Font Support
« Reply #1 on: January 21, 2013, 01:59:11 PM »
Just read the latest blog. How does loading fonts work?
(happy to see SDL go away btw)

So looks like font fixing is to come.
Who told that SDL is going away?  ??? I only said long ago that SDL_ttf support ended because of the amount of dependencies.
Hm, if you use "print" which is a built-in Lua function I can't change anything. That depends on you console I guess. The "normal" font of EGSL is the SDL_gfx built-in font.
Apart from that you can use bitmap (=pixel fonts!) which can be found here for example: http://cgi.algonet.se/htbin/cgiwrap?user=guld1&script=fonts.pl
Or the new SDL Monofonts, which look like the attached image. (Can be made out of each TTF-Font by yourself).

igamealot

  • Guest
Re: Font Support
« Reply #2 on: January 21, 2013, 04:12:06 PM »
Yeah right about the time I was going to post "support fonts in the IDE" is when I ran over and got it working in zeroBrane.

Monofont is that just a strip of the characters as a long image?
Or those pink lines at the top edge mean something?

Font Tools reviewed at mashable.

I used to have a tool for converting installed fonts to images.
I wonder if those images work with EGSL
« Last Edit: January 21, 2013, 04:35:32 PM by igamealot »

Cybermonkey

  • Administrator
  • *****
  • Posts: 0
Re: Font Support
« Reply #3 on: January 21, 2013, 04:56:59 PM »
The pink lines tell EGSL how broad a character is. Now to the bitmap fonts.
Let's say you've got this font:

All you have to do is tell EGSL the lines and rows and the fontface.
Code: [Select]
myfont = loadbmpfont ("font.gif", 10,5, "ACEGIBDFHJKMOQSLNPRTUWY02VXZ13468()579!:-,'  .ยด?  ")This is untested with the above font, though. Sometimes one has to "trim" the images.