Forum

[Experimental] Proportional fonts

Discuss programming topics for the various GPL'd game engine sources.

Moderator: InsideQC Admins

[Experimental] Proportional fonts

Postby Teiman » Thu Jan 21, 2010 9:52 pm

This is a quick hack to make the normal quake font renders more like a "proportional font".


Image

Code: Select all

//Tei  crude proportional fonts
      switch(curr_char){
         case 'i':
         case 'I':
         case 'l':
         case 'L':
            overlap = 2;

            break;   
         case 'W':
         case 'M':
            break;

         default:
            overlap = 1;
            break;
      }   
//Tei crude proportional fonts
   
      // Draw the character but don't apply overall opacity, we've already done that
      // And don't update the glstate, we've done that also!
      Draw_CharacterBase(x-overlap, y, curr_char, scale, false, rgba, bigchar, false);//Tei added p.f.

      x += ((bigchar ? 64 : 8) * scale) + char_gap - overlap*2 ;//Tei added p.f.



Since the code is soo simplistic, the rendering is not correct, but still I think it shows potential. Theres probably out here some bitmap proportional font. It can be possible,, IMHO, to replace/make optional, a proportional font, or render the original quake font in a proportiona-ish way. That may make text's in quake more readable.
Teiman
 
Posts: 309
Joined: Sun Jun 03, 2007 9:39 am

Postby ceriux » Thu Jan 21, 2010 9:56 pm

i like this , pretty nice.
User avatar
ceriux
 
Posts: 2223
Joined: Sat Sep 06, 2008 3:30 pm
Location: Indiana, USA

Postby Team Xlink » Wed Feb 03, 2010 1:00 am

This seems overly useful.
Team Xlink
 
Posts: 368
Joined: Thu Jun 25, 2009 4:45 am
Location: Michigan

Postby Teiman » Wed Feb 03, 2010 7:09 pm

I agree. And is one thing that can be hardcoded, ...adding small finne tunning to achieve perfection.

It sould be disabled for things like centerprint. But can be used in console (no changes) and on menus (lots of changes, here ezQuake uses align=left, so you have to calcute the new width prior to render this thing... )

Anyway is just a hack. The proper thing to do is support one proportional image, or support windows TTF files (arial and such). TTF fonts would enhance quake usability a 4.899999993 %.
Teiman
 
Posts: 309
Joined: Sun Jun 03, 2007 9:39 am

Postby Chip » Wed Feb 03, 2010 7:58 pm

The support of TTF files combined with the power of CSQC would allow modders to place any kind of text on the screen, such as hints, variables, constants, without the need of images.
QuakeWiki
getButterfly - WordPress Support Services
Roo Holidays

Fear not the dark, but what the dark hides.
User avatar
Chip
 
Posts: 575
Joined: Wed Jan 21, 2009 9:12 am
Location: Dublin, Ireland

Postby Spirit » Wed Feb 03, 2010 8:05 pm

Darkplaces will have proper font support soon or it already has, I am not sure.
Improve Quaddicted, send me a pull request: https://github.com/SpiritQuaddicted/Quaddicted-reviews
Spirit
 
Posts: 1031
Joined: Sat Nov 20, 2004 9:00 pm

Postby Chip » Wed Feb 03, 2010 8:26 pm

Spirit wrote:Darkplaces will have proper font support soon or it already has, I am not sure.


:D I know, LordHavoc is working on it. I'm monitorizing his SVN changelog.

I guess he'll soon make an official release and announcement.
QuakeWiki
getButterfly - WordPress Support Services
Roo Holidays

Fear not the dark, but what the dark hides.
User avatar
Chip
 
Posts: 575
Joined: Wed Jan 21, 2009 9:12 am
Location: Dublin, Ireland

Postby Teiman » Wed Feb 03, 2010 8:59 pm

Image

It seems some HL based games use it for his graphics.
But... how you generate these ttf files? the vectorial tools like InkScape helps you create then?

/me Looking forward for the next version of DP :-)
Teiman
 
Posts: 309
Joined: Sun Jun 03, 2007 9:39 am

Postby Spike » Thu Feb 04, 2010 12:30 am

freetype2 isn't too hard a library to use, tbh.
its making use of it properly that takes time.
in svn builds of fte, set com_parseutf8 and it'll support utf-8 throughout, until it gets encoding errors from certain mods - chat is fine, depending upon player names.
^Ue100 upwards will show sbar images even without freetype2, just for the sake of it, but if you want truetype fonts, you'd need to get a freetype2 dll from somewhere.
Spike
 
Posts: 2892
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Postby FrikaC » Mon Feb 08, 2010 7:36 pm

Interesting side note: Qake has variable width (proportional) fonts and has had it for quite a while. It uses the same bitmap font approach as Quake, but loads a <fontname>.dat file as well, which is (iirc) 255 byte long binary file that says how many pixels wide each character in the font is.

It is the same .dat file exported from Bitmap Font Builder's export character widths menu option.
FrikaC
Site Admin
 
Posts: 1026
Joined: Fri Oct 08, 2004 11:19 pm

Postby mh » Mon Feb 08, 2010 7:46 pm

That sounds rather neat. :D I wonder how it all fits in with centering text on-screen?

I'll confess to a liking for Quake's old grungy non-proportional fonts however.
We had the power, we had the space, we had a sense of time and place
We knew the words, we knew the score, we knew what we were fighting for
User avatar
mh
 
Posts: 2292
Joined: Sat Jan 12, 2008 1:38 am

Postby c0burn » Mon Feb 08, 2010 8:01 pm

mh wrote:That sounds rather neat. :D I wonder how it all fits in with centering text on-screen?

I'll confess to a liking for Quake's old grungy non-proportional fonts however.


Guess you'd just need to calculate pixel width rather than number of characters. But you know this of course. :)
c0burn
 
Posts: 208
Joined: Fri Nov 05, 2004 12:48 pm
Location: Liverpool, England

Postby gnounc » Tue Aug 10, 2010 11:58 am

But... how you generate these ttf files? the vectorial tools like InkScape helps you create then?


http://fontforge.sourceforge.net/

sorry, didnt notice the question when the thread was new
User avatar
gnounc
 
Posts: 424
Joined: Mon Apr 06, 2009 6:26 am


Return to Engine Programming

Who is online

Users browsing this forum: No registered users and 1 guest