Author Topic: Spaces between text characters  (Read 2071 times)

Offline XanthorXIII

  • Mr. Polyvector
  • ***
  • Posts: 197
    • View Profile
Spaces between text characters
« on: 2010-Aug-08 »
Hello,
While writing a test program, I noticed that when printing to the screen that the text had a lot of spaces between the letters. Is this due to the font that I am using? I'm currently using the default but can change to another if there is one that works better.
Thanks.

XanthorXIII
Owlcat has wise

Offline Nobiag

  • Mr. Drawsprite
  • **
  • Posts: 58
    • View Profile
Re: Spaces between text characters
« Reply #1 on: 2010-Aug-08 »
As far as i know this is due to the bitmap font system. Glbasic doesn't use real font files, it uses picture files like bitmap or png with the letters in it and gives every character the same pixel space. I hate this too, because good looking text is very important for a clean, polished look i think. I once wrote a function that splits text into single characters and then i defined a width value for every letter, but thats hard and tedious work and you have to do it for every font individually...

Edit: Also i don't know if you lose performance when using a print command for every single character. Maybe a function that only gives W, M, G more space and I,l,t less space is enough for the start, since it would probably be an improvement for every font.
« Last Edit: 2010-Aug-08 by Nobiag »

MrTAToad

  • Guest
Re: Spaces between text characters
« Reply #2 on: 2010-Aug-08 »
You usually use a font whereby each character uses as much space as possible, which reduces any spaces between characters.  Fixedsys is good for this.

Alternatively, Moru has a proportional font system.

Offline Moru

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 1792
    • View Profile
    • Homepage
Re: Spaces between text characters
« Reply #3 on: 2010-Aug-08 »
Downloadable on my homepage... There is also proportional spacing possible with the DDGUI library if you use that.

Offline XanthorXIII

  • Mr. Polyvector
  • ***
  • Posts: 197
    • View Profile
Re: Spaces between text characters
« Reply #4 on: 2010-Aug-08 »
Thanks for the excellent advice. I will look into fixing that.

Owlcat has wise

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10758
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Re: Spaces between text characters
« Reply #5 on: 2010-Aug-09 »
Code: (glbasic) [Select]
DDGui_UpdateFont(TRUE);
DDGui_PrintIntern(text$, x,y)

There's other libraries here. Search for "kerning"

Offline okee

  • Dr. Type
  • ****
  • Posts: 324
    • View Profile
Re: Spaces between text characters
« Reply #6 on: 2010-Aug-10 »
I've found that courier new created in the font creator to a size of 96 x 96
and with cleartype winxp ticked works great.
Android: Samsung Galaxy S2 -  ZTE Blade (Orange San Francisco) - Ainol Novo 7 Aurora 2
IOS: 2 x Ipod Touch (1G)