Jon Bradley escreveu: > > On Jan 9, 2008, at 8:35 AM, Frederico Garcia wrote: > >> Does anyone know how to make flash render fonts the same way for screen >> display and printing? I've tried embedding fonts, changing the settings >> for flashType and fontAntiAliasType but I just can't get fonts to >> display the same way. This is causing a lot of trouble since I can' get >> lineMetrics to give me accurate values. > > Good luck. Long response follows. > > Flash renders the line height of all text with an > incorrect (always) leading value. This is major apparent as you change > the font size of the text in the field. > > If you set the leading of a text field, that leading is not used for > all point sizes of text. I can only surmise that's because the > developers failed to use just the point size of the type to set > default leading value. > > The line height issue is not a bug - it's just straight up wrong. > > First the problems you will run into: > > 1. Leading of text is never right - the line heights vary within one > field (?!). It adds in some weird ass measure including the ascent and > descent (which varies as well). > > 2. Changing the font size and setting the leading to the same value > will lead you to madness. The leading of the field will change at > certain point sizes (sometimes more than 30% larger/smaller) - even if > you force a certain leading. > > 3. If you scale your text field, your character spacing AND individual > character baselines shift - they are not all aligned on the same > baseline. Imagine a word where groupings of the characters are shifted > down 4-5 pixels (again, [EMAIL PROTECTED]). If the text field is rotated 0.01 > radians, the character spacing issue is fixed but the baseline issue > is not (wtf). > > #1 and #2 can be fixed. #3 is a bug in the font rendering in Flash. I > do not know how to fix this issue completely. Big prize to whoever can > figure that out. > > Now, to fix #1 and #2 and match the way Photoshop renders line heights: > > Photoshop renders text with a leading of 120% of the FONT SIZE. It > uses the max ascent and descent of the entire font outline with that > leading - rather than a dynamically adjusted ascent and descent, which > is what the player does. > > This process will render a text field almost identically to Photoshop: > > 1. Get the line metrics from every line of text > 2. Find the average line height (fun) > 3. Get the difference between what Flash, in it's confused mind, > thinks the leading should be and what you want it to be (== font size > *1.2) > 4. Set the leading of a new text format object to this resulting > number minus the ascent and descent measurements of the text format in > question. > > This whole thing has annoyed me for years. What is driving me crazy > right now is the #3 problem I listed above (using embedded fonts). > > cheers, > > jon > > > > __________ NOD32 2769 (20080107) Information __________ > > This message was checked by NOD32 antivirus system. > http://www.eset.com Hi Jon,
Thanks for the quick reply. You can see my posts on flexReport and PrintTextArea to see what I'm trying to do. Printing is killing me. People (specially in organizations) do like to print stuff, and more they do like to see what they are about to print before they waste paper. And I really don't like to waste countless hours every single time I want to print more than a few lines of text. Now I'm trying to develop a reusable solution to prevew and print reports and the only (major) feature missing is printing multiple pages of text. Would you bother to take a look at PrintTextArea (http://www.kemelyon.com/printtextarea/) and see if you can give me some help? In the meanwhile I'll try to make good use of your tips :) Regards, Frederico Garcia

