Inside3D!
     

[Experimental] Proportional fonts

 
Post new topic   Reply to topic    Inside3d Forums Forum Index -> Engine Programming
View previous topic :: View next topic  
Author Message
Teiman



Joined: 03 Jun 2007
Posts: 309

PostPosted: Thu Jan 21, 2010 9:52 pm    Post subject: [Experimental] Proportional fonts Reply with quote

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




Code:


//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.
Back to top
View user's profile Send private message
ceriux



Joined: 06 Sep 2008
Posts: 968
Location: Florida, USA

PostPosted: Thu Jan 21, 2010 9:56 pm    Post subject: Reply with quote

i like this , pretty nice.
_________________
QuakeDB - Quake ModDB Group
Back to top
View user's profile Send private message Yahoo Messenger
Team Xlink



Joined: 25 Jun 2009
Posts: 320

PostPosted: Wed Feb 03, 2010 1:00 am    Post subject: Reply with quote

This seems overly useful.
_________________
Anonymous wrote:
if it works, it works. if it doesn't, HAHAHA!
Back to top
View user's profile Send private message
Teiman



Joined: 03 Jun 2007
Posts: 309

PostPosted: Wed Feb 03, 2010 7:09 pm    Post subject: Reply with quote

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 %.
Back to top
View user's profile Send private message
Chip



Joined: 21 Jan 2009
Posts: 314
Location: Romania

PostPosted: Wed Feb 03, 2010 7:58 pm    Post subject: Reply with quote

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.
_________________
My Projects: Quake 1 Mods | OpenQuartz 2 | ChipQuake
Back to top
View user's profile Send private message Visit poster's website
Spirit



Joined: 20 Nov 2004
Posts: 476

PostPosted: Wed Feb 03, 2010 8:05 pm    Post subject: Reply with quote

Darkplaces will have proper font support soon or it already has, I am not sure.
_________________
Quake Maps
Back to top
View user's profile Send private message Visit poster's website
Chip



Joined: 21 Jan 2009
Posts: 314
Location: Romania

PostPosted: Wed Feb 03, 2010 8:26 pm    Post subject: Reply with quote

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


Very Happy I know, LordHavoc is working on it. I'm monitorizing his SVN changelog.

I guess he'll soon make an official release and announcement.
_________________
My Projects: Quake 1 Mods | OpenQuartz 2 | ChipQuake
Back to top
View user's profile Send private message Visit poster's website
Teiman



Joined: 03 Jun 2007
Posts: 309

PostPosted: Wed Feb 03, 2010 8:59 pm    Post subject: Reply with quote



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 Smile
Back to top
View user's profile Send private message
Spike



Joined: 05 Nov 2004
Posts: 944
Location: UK

PostPosted: Thu Feb 04, 2010 12:30 am    Post subject: Reply with quote

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.
_________________
What's a signature?
Back to top
View user's profile Send private message Visit poster's website
FrikaC
Site Admin


Joined: 08 Oct 2004
Posts: 947

PostPosted: Mon Feb 08, 2010 7:36 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message Send e-mail
mh



Joined: 12 Jan 2008
Posts: 909

PostPosted: Mon Feb 08, 2010 7:46 pm    Post subject: Reply with quote

That sounds rather neat. Very Happy 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.
_________________
DirectQ Engine - New release 1.8.666a, 9th August 2010
MHQuake Blog (General)
Direct3D 8 Quake Engines
Back to top
View user's profile Send private message Visit poster's website
c0burn



Joined: 05 Nov 2004
Posts: 158
Location: Liverpool, England

PostPosted: Mon Feb 08, 2010 8:01 pm    Post subject: Reply with quote

mh wrote:
That sounds rather neat. Very Happy 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. Smile
Back to top
View user's profile Send private message Visit poster's website AIM Address MSN Messenger
gnounc



Joined: 06 Apr 2009
Posts: 120

PostPosted: Tue Aug 10, 2010 11:58 am    Post subject: Reply with quote

Quote:
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
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Inside3d Forums Forum Index -> Engine Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2004 phpBB Group