Go Back   Forums > Community Chatterbox > Tech Corner
Memberlist Forum Rules Search Today's Posts Mark Forums Read
Search Forums:
Click here to use Advanced Search

Reply
 
Thread Tools Display Modes
Old 10-11-2012, 10:14 AM   #1
Funkmaster5000
PRESS PLAY ON TAPE
 
Funkmaster5000's Avatar


 
Join Date: Jul 2009
Location: Weilmunster, Germany
Posts: 136
Default Font Pixelsize - Without counting?

Hey guys!

I'm currently working on a game, that involves ASCII Art. In the background I want to have my engine that does the math stuff: collisions, position changes etc.

Of course, the images (texts) differ in size (not in font size: number of chars), but use the same font.

Now I need to know how large a character is in pixels at a certain font size, so that I can define one constant to calculate with. I want to achieve that without counting the pixels manually on screen. Is there a formula or maybe information stored somewhere at the font data? Its Fixedsys.

I haven't found anything on the net so far.

Thanks in advance!
Funkmaster5000 is offline                         Send a private message to Funkmaster5000
Reply With Quote
Old 10-11-2012, 11:28 AM   #2
Tracker
Home Sweet Abandonia
 
Tracker's Avatar




 
Join Date: Jul 2009
Location: Hungary
Posts: 757
Default

lulz it depends on so many things, like whether the fonts are monospaced or not, and even then, what fonts you're using (Is it called Fixedsys?), and where... This has been an issue for me as well in programming. I don't believe the size of the characters is store anywhere, but we could say 12 point characters would be 8 pixels wide, since that is a power of 2 (don't ask why would that matter, I'm making educated guesses...). But that can only be applied to monospaced fonts, where every letter and character has the same width. The one I'm using right now is Times New Roman, where for example the letters I and O aren't equally wide. Courier New is an example of monospaced fonts, where I and O have the same width. Not sure if I understood your problem, but I tried to summarize my experiences.
__________________


Reverend Preacherbot: Wretched sinner unit! The path to Robot Heaven lies here, in the Good Book 3.0.
Bender: Hey. Do I preach at you when you're lying stoned in the gutter? No!
Tracker is offline                         Send a private message to Tracker
Reply With Quote
Old 10-11-2012, 12:56 PM   #3
florianix
Abandonia nerd
 
florianix's Avatar


 
Join Date: Nov 2011
Location: ,
Posts: 72
Default

I guess "Involving ASCII art" means "monospaced", am I correct?
Just a strong guess, but proportional fonts seem difficult to use with ASCII art...

If you are using an IDE using the DTP point system (wild guess), then I think the font size will also depend on the screen's dpi value since a DTP point is measured in inch or mm, but not in pixels.

Can you maybe give some more details about the programming environment and font you are using?

Hope you keep us informed about your game and your progress with it. ;-)
florianix is offline                         Send a private message to florianix
Reply With Quote
Old 10-11-2012, 01:50 PM   #4
Funkmaster5000
PRESS PLAY ON TAPE
 
Funkmaster5000's Avatar


 
Join Date: Jul 2009
Location: Weilmunster, Germany
Posts: 136
Default

Thanks for your replies!

The font is called "Fixedsys", which is, indeed, 8x8 pixels in standard size (and also a quite common one in ASCII Art, because it is regular).

I simply don't grasp the connection between font size and it's size in pixels. So font size 12 means 8x8 pixels; font size 24 equals 16x16? I don't think so...

I'm using Blitz3D, because I was quite advanced with QuickBasic, which unfortunatly became obsolete, because it's for DOS.
Funkmaster5000 is offline                         Send a private message to Funkmaster5000
Reply With Quote
Old 10-11-2012, 06:16 PM   #5
florianix
Abandonia nerd
 
florianix's Avatar


 
Join Date: Nov 2011
Location: ,
Posts: 72
Default

Quote:
Originally Posted by Funkmaster5000 View Post
Thanks for your replies!
The font is called "Fixedsys", which is, indeed, 8x8 pixels in standard size (and also a quite common one in ASCII Art, because it is regular).
So the distance between lines and chars (in pixels) is still missing...

Quote:
Originally Posted by Funkmaster5000 View Post
Thanks for your replies!
I simply don't grasp the connection between font size and it's size in pixels. So font size 12 means 8x8 pixels; font size 24 equals 16x16? I don't think so...
I think this is depending on the resolution (usually given in pixels per inch) of the display or printer.

That font size refers to "typographic points".

From http://en.wikipedia.org/wiki/Point_%28typography%29
(chapter "Current DTP point system"):

"The desktop publishing point (DTP point) is defined as 1/72 of the Anglo-Saxon compromise inch of 1959 (25.4 mm) which makes it 0.0138 inch or 0.3527 mm. Twelve points make up a pica, and six picas make an inch."

Long live the imperial units.

As a result, that gives the real size of the font on the display - independent of its pixel density.
florianix is offline                         Send a private message to florianix
Reply With Quote
Old 10-11-2012, 06:35 PM   #6
Funkmaster5000
PRESS PLAY ON TAPE
 
Funkmaster5000's Avatar


 
Join Date: Jul 2009
Location: Weilmunster, Germany
Posts: 136
Default

Quote:
Originally Posted by florianix View Post
So the distance between lines and chars (in pixels) is still missing...

"The desktop publishing point (DTP point) is defined as 1/72 of the Anglo-Saxon compromise inch of 1959 (25.4 mm) which makes it 0.0138 inch or 0.3527 mm. Twelve points make up a pica, and six picas make an inch."

Long live the imperial units.

As a result, that gives the real size of the font on the display - independent of its pixel density.
Holy...

What lines do you mean? I don't quite get it!
Funkmaster5000 is offline                         Send a private message to Funkmaster5000
Reply With Quote
Old 10-11-2012, 07:02 PM   #7
florianix
Abandonia nerd
 
florianix's Avatar


 
Join Date: Nov 2011
Location: ,
Posts: 72
Default

Quote:
Originally Posted by Funkmaster5000 View Post
Holy...

What lines do you mean? I don't quite get it!
With "So the distance between lines and chars (in pixels) is still missing..." I wanted to say:
Even if you know that the font is 8x8 pixels per letter - you still need to know the distance (in pixels) between two consecutive letters (horizontally) and the distance between two lines (vertically) in order to calculate the total height of some ASCII art comprising more than one column or row.

If there would be no additional few pixels between two lines, the letters of them would "stick together".

=>
  • vertical ASCII art size in pixels = (vertical number of pixels per letter * vertical number of letters) + (distance in pixels between two letters * (vertical number of letters -1) )
  • horizontal ASCII art size in pixels = (horizontal number of pixels per letter * horizontal number of letters) + (distance in pixels between two lines * (horizontal number of letters -1) )
florianix is offline                         Send a private message to florianix
Reply With Quote
Reply


Similar Threads
Thread Thread Starter Forum Replies Last Post
Final Fantasy: Endless Nova Font Issues sjdswanlund Troubleshooting 2 01-04-2009 03:10 PM
Rpg Maker 2000 Font Problem Emily Troubleshooting 2 04-02-2007 04:25 PM
Dosbox Font MrBackAlleySka Tech Corner 0 30-03-2005 12:48 AM
Font Sites JJXB Tech Corner 2 01-01-2005 10:37 PM
Download Counting Omuletzu Old Suggestions 21 25-08-2004 10:48 PM

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump
 


The current time is 11:24 PM (GMT)

 
Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.