How to make fonts in the game to look smooth?
by Milan Rancic · in Torque Game Builder · 07/29/2010 (3:00 pm) · 4 replies
What should i do to make system fonts that i am using in my game to look smooth? I just cant get it look smooth no matter what size i set them...
#2
www.torquepowered.com/community/forums/viewthread/116409
07/29/2010 (4:13 pm)
The only thing that truly worked for me was Bill Sims suggestion:www.torquepowered.com/community/forums/viewthread/116409
#3
07/30/2010 (8:02 am)
Ill try both approaches today. Thnx.
#4
I added this method directly to t2dTextObject class, so now every text on my scene looks perfectly smooth now without any further coding. thnx ;)
The only condition is that you must set camera size and working resolution to be proportional.
For eg. correct would be:
camera width/height = 100/75
design resolution = 800/600
incorrect:
camera width/height = 100/75
design resolution = 1440/900
08/11/2010 (12:01 pm)
For anyone who is interested, i am using this now:function t2dTextObject::onAddToScene( %textField ) {
// Scale between window height and camera height
%scene = sceneWindow2D;
%scale = getWord(%scene.getWindowExtents(), 3) / (getWord(%scene.getCurrentCameraArea(), 3) - getWord(%scene.getCurrentCameraArea(), 1) + 1);
// Rounded font height for curent screen resolution
%font_height = mFloor(%textField.lineHeight * %scale + 0.5);
// Adjusted line height of the current text object
%textField.lineHeight = %font_height / %scale;
%textField.removeAllFontSizes();
%textField.addFontSize(%font_height);
}I added this method directly to t2dTextObject class, so now every text on my scene looks perfectly smooth now without any further coding. thnx ;)
The only condition is that you must set camera size and working resolution to be proportional.
For eg. correct would be:
camera width/height = 100/75
design resolution = 800/600
incorrect:
camera width/height = 100/75
design resolution = 1440/900
brian_cbcbcb
I found this useful, but could not find the original coder to quote his name.
Otherwise, try to use font sizes that are already available in the font folder for nicer looking fonts.
function adjustFont(%this) { // Scale between window height and camera height %scale = getWord(sceneWindow2D.getWindowExtents(), 3) / (getWord(sceneWindow2D.getCurrentCameraArea(), 3) - getWord(sceneWindow2D.getCurrentCameraArea(), 1) + 1); // Rounded font height for curent screen resolution %font_height = mFloor(%this.lineHeight * %scale + 0.5); // Adjusted line height of the current text object %this.lineHeight = %font_height / %scale; %this.removeAllFontSizes(); %this.addFontSize(%font_height); }