-
Monospace font width/height
I want to use Monospace truetype fonts in my script. Couple questions:
1. How to determine font width for the given point size? For different fonts, when I set a point size for instance 25 I get different width and height(neither of them is 25). Do I have to experimentally check the width and height? Then second question.
2. If I experimentally determine font width and height for given point size, can I make sure that everywhere (whatever resolution and DPI is) my flash file is played, the width will take he same width in pixels?
3. How to determine char kerning for the monospace font, is it always 1 pixel?
Thanks
-
1. Point size does not correlate to pixel size (25 points is 2 and a twelfth picas, roughly .35 inches, and you're using 96dpi flash on a 72dpi monitor).
You'll need to check it out manually...and make sure you compile the swf, you'll usually see a difference from the editor to the final movie.
2. Yes, as long as you are embedding the characters.
3. The letterspacing on a monospace should always be the same.
-
I would start by embedding your font into your flash project.
I do believe there is a kern tool in the embedding function
setting your font size should look something like this
mytext_txt.text.font = 15;
mytext_txt.text.bold = 15;
There is a Dent in my desk where i keep Banging my Head.
-
Originally Posted by neznein9
1. Point size does not correlate to pixel size (25 points is 2 and a twelfth picas, roughly .35 inches, and you're using 96dpi flash on a 72dpi monitor).
You'll need to check it out manually...and make sure you compile the swf, you'll usually see a difference from the editor to the final movie.
2. Yes, as long as you are embedding the characters.
3. The letterspacing on a monospace should always be the same.
Thanks for prompt and professional answers!
1. What is the actual formula for converting font point size to pixel? I didn't know flash is using different DPI setting from monitor. Is it always 96? In display setting of my video settings it is 96.
2. Yep
3. So experimentally it is 1 pixel for couple tested monospace fonts.
-
Originally Posted by D Ape
I would start by embedding your font into your flash project.
I do believe there is a kern tool in the embedding function
setting your font size should look something like this
mytext_txt.text.font = 15;
mytext_txt.text.bold = 15;
It is embedded, however the font size as explained above is far not the pixel size neither of height nor of width.
Thanks anyway!
-
72 points = 6 picas = 1 inch
Points and picas are used for definite sizing. For instance, a newspaper column may be 144 points wide.
A second unit of measure, ems and ens, is used as a ratio of the font's size. If you pick a 48pt font, one em is 48 points, one en is 24points. This shows up a lot in css so that a design can scale well.
The third measurement is pixels. Unfortunately pixels dont really work out as a direct measurement of anything. You can have a 20" and a 23" monitor both using the same resolution...obviously the pixel size is different.
So there really isn't a good way to set px size in flash other than guess and check. If you are trying to line things up, you can always look at the textField.textWidth property to get a handle on how the field is rendering. Sorry this isnt a good solution to your question but I hope it helps.
-
neznein9
The size of font in points is referring to height or width? I guess formula is missing something called character pitch in order to convert points to pixels and "72 points = 6 picas = 1 inch" is not enough for that.
However my task is simple - I need to draw bounding rectangle(for instance 100 pixel width rectangle) with text using predefined monospace font. I want to make sure that ALWAYS certain amount of the characters will exactly fit this rectangle no matter on which monitor/resolution/font dpi setting... I assume that this will be true if my monospace font(embedded to movie), with 25 point size, will always produce let's say 9 pixel width chars. Does it make sense?
-
I will try to simplify my question
Can I make sure that for the given monospace font point size in actionscript I will have the same width/kerning in pixels for characters, no matter on which resolution/dpi the movie will be played?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|