Re: [Flashcoders] getTextExtent weirdness

2006-06-27 Thread erixtekila

Pixel-accurate
width is correctly returned every time. The same method can be used for
multiple entry fields, even with different typefaces or type styles as 
long

as those style parameters are passed to the auto-sized, off-stage
measurement field.
Do you mean those used with FlashType properties like antiAliasType, 
sharpness… ?





---
erixtekila
http://blog.v-i-a.net/

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


RE: [Flashcoders] getTextExtent weirdness

2006-06-27 Thread Ville Walveranta

Primarily the main formatting characteristics such as font name, size and
style if applicable; with embedded/bitmap fonts the style is what it is, of
course. Anti aliasing or sharpness likely are not going to make a big
difference in the width, and they do not apply anyway with bitmap fonts.

You could, of course, make multiple metrics fields, one for each
typeface/size/style you want to measure, but just as well there can be just
one off-stage field that is set to whatever style settings you want to
currently measure.

Ville

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of erixtekila
Sent: Tuesday, June 27, 2006 08:50
To: Flashcoders mailing list
Subject: Re: [Flashcoders] getTextExtent weirdness

 Pixel-accurate
 width is correctly returned every time. The same method can be used for
 multiple entry fields, even with different typefaces or type styles as 
 long
 as those style parameters are passed to the auto-sized, off-stage
 measurement field.
Do you mean those used with FlashType properties like antiAliasType, 
sharpness. ?


---
erixtekila
http://blog.v-i-a.net/

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] getTextExtent weirdness

2006-06-27 Thread erixtekila
Primarily the main formatting characteristics such as font name, 
size and
style if applicable; with embedded/bitmap fonts the style is what it 
is, of

course. Anti aliasing or sharpness likely are not going to make a big
difference in the width, and they do not apply anyway with bitmap 
fonts.


Try it on some fonts, you'll be amazed ;)



You could, of course, make multiple metrics fields, one for each
typeface/size/style you want to measure, but just as well there can be 
just

one off-stage field that is set to whatever style settings you want to
currently measure.


Isn't it a pain for dynamic apps ?
Hm, let me try.
Thanks.


---
erixtekila
http://blog.v-i-a.net/

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


RE: [Flashcoders] getTextExtent weirdness

2006-06-27 Thread Ville Walveranta

You may be right about sharpness/anti-aliasing :). I only used it with a
single font/style, but could see no reason for why I couldn't have defined
multiple formats and then pass a format id to the function that 1)
populates the metrics field, 2) applies the (appropriate) format, and 3)
returns the width of the auto-sized metrics field. 

Too bad the metrics functionality isn't working well.. this is a bit of a
kludge, but I guess works (just like removing whitespace from a string has
to be done in convoluted way in lack of RegEx in AS2). 

Ville

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of erixtekila
Sent: Tuesday, June 27, 2006 13:33
To: Flashcoders mailing list
Subject: Re: [Flashcoders] getTextExtent weirdness

 Primarily the main formatting characteristics such as font name, 
 size and
 style if applicable; with embedded/bitmap fonts the style is what it 
 is, of
 course. Anti aliasing or sharpness likely are not going to make a big
 difference in the width, and they do not apply anyway with bitmap 
 fonts.

Try it on some fonts, you'll be amazed ;)


 You could, of course, make multiple metrics fields, one for each
 typeface/size/style you want to measure, but just as well there can be 
 just
 one off-stage field that is set to whatever style settings you want to
 currently measure.

Isn't it a pain for dynamic apps ?
Hm, let me try.
Thanks.


---
erixtekila
http://blog.v-i-a.net/

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


RE: [Flashcoders] getTextExtent weirdness

2006-06-24 Thread Ville Walveranta

Responding again to my own posting... :-) 

I tried what I was thinking of below, and it works perfectly! Pixel-accurate
width is correctly returned every time. The same method can be used for
multiple entry fields, even with different typefaces or type styles as long
as those style parameters are passed to the auto-sized, off-stage
measurement field. 

Ville


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Ville
Walveranta
Sent: Thursday, June 22, 2006 13:23
To: 'Flashcoders mailing list'
Subject: RE: [Flashcoders] getTextExtent weirdness


I was recently working on a project where .getTextExtent() would have come
handy, but like for others, it did not work for me. I dropped the issue at
that time, but have been thinking of trying to create an auto-size field off
the stage with the same text style parameters as the textInput component,
then copy characters (from the input component as they're typed) to the
auto-sized field, then measure the width of the auto-sized field. If the
width exceeds the maximum allowed pixel-width, then disallow further typing
into the component. I think it should work... has anyone tried this?

Ville


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] getTextExtent weirdness

2006-06-23 Thread michal jaworski

i had this problem a while ago. the text would be rendred exactly the
same on all platforms buth the numbers returned from textExtend varied
depending on os, browser, i don't know what else. with a tendency to
cut off lines/letters on mac.
i came up with the following: took a largish block of text of length
(L), set the field width to the one i needed and counted how many rows
it would take in a static field (R). now C = L/R is an approximation
of how many letters fits in a row. you can measure H the height of a
single row in pixels on a static field too.
then to display your string textString you need field of
height=(Math.ceil(textString/C)+1)*H
i add one because it's approximate and i prefer to have some extra
space than cut off text. it works quite weel for strings tha occupy
more than 5 rows.
you can easily adapt is to measuring width of a single row of text too.
cheers,
michal


I've noticed a post about this in the archives, but it was described
as a
Mac issue and I'm getting it on a PC. I'm trying to use
TextFormat.getTextExtent() to do some image calculations, but I'm
getting enormous values. I suspect it's because my text includes
newline characters, but that's just a guess.

The docs say the function is deprecated, but the liveDocs
emphatically deny this. Anyone got any suggestions?

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] getTextExtent weirdness

2006-06-22 Thread Danny Kodicek



I've noticed a post about this in the archives, but it was described as a
Mac issue and I'm getting it on a PC. I'm trying to use 
TextFormat.getTextExtent() to do some image calculations, but I'm getting 
enormous values. I suspect it's because my text includes newline 
characters, but that's just a guess.


The docs say the function is deprecated, but the liveDocs emphatically 
deny this. Anyone got any suggestions?


I've found a few more posts in the archives about this. Everyone says, 
essentially, don't use it - and it looks like it won't solve my problem in 
any case, because it essentially returns the same values as field.textHeight 
/ textWidth.


Maybe someone can offer some alternative suggestions. I need to get a bitmap 
representing a menu. It will contain n lines of text, and needs to be 
resized automatically to the extent of the text. So far so simple. But the 
problem I'm having is that field.textWidth (and autosize too) crops the text 
too close, with the result that the top and bottom lines of text are both 
hard up against the edge of the image, so that the size of the image is not 
equal to n* the line height, as I need. And without getTextExtent I can't 
see any simple method for finding the height of the line - and in other 
circumstances I might not even know how many lines there are, although of 
course if I know the lineHeight I can get this by 
ceil(textHeight/lineHeight)


Thoughts welcome
Danny 


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] getTextExtent weirdness

2006-06-22 Thread janosch

Hello,

i always use textfield.autoSize, and it works fine.
But you have to be carefull, to set the correct styles to the textfield, 
before measuring.


Janosch




Danny Kodicek schrieb:



I've noticed a post about this in the archives, but it was described 
as a
Mac issue and I'm getting it on a PC. I'm trying to use 
TextFormat.getTextExtent() to do some image calculations, but I'm 
getting enormous values. I suspect it's because my text includes 
newline characters, but that's just a guess.


The docs say the function is deprecated, but the liveDocs 
emphatically deny this. Anyone got any suggestions?



I've found a few more posts in the archives about this. Everyone says, 
essentially, don't use it - and it looks like it won't solve my 
problem in any case, because it essentially returns the same values as 
field.textHeight / textWidth.


Maybe someone can offer some alternative suggestions. I need to get a 
bitmap representing a menu. It will contain n lines of text, and needs 
to be resized automatically to the extent of the text. So far so 
simple. But the problem I'm having is that field.textWidth (and 
autosize too) crops the text too close, with the result that the top 
and bottom lines of text are both hard up against the edge of the 
image, so that the size of the image is not equal to n* the line 
height, as I need. And without getTextExtent I can't see any simple 
method for finding the height of the line - and in other circumstances 
I might not even know how many lines there are, although of course if 
I know the lineHeight I can get this by ceil(textHeight/lineHeight)


Thoughts welcome
Danny
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com




___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


RE: [Flashcoders] getTextExtent weirdness

2006-06-22 Thread Ville Walveranta

I was recently working on a project where .getTextExtent() would have come
handy, but like for others, it did not work for me. I dropped the issue at
that time, but have been thinking of trying to create an auto-size field off
the stage with the same text style parameters as the textInput component,
then copy characters (from the input component as they're typed) to the
auto-sized field, then measure the width of the auto-sized field. If the
width exceeds the maximum allowed pixel-width, then disallow further typing
into the component. I think it should work... has anyone tried this?

Ville

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of janosch
Sent: Thursday, June 22, 2006 11:09
To: Flashcoders mailing list
Subject: Re: [Flashcoders] getTextExtent weirdness

Hello,

i always use textfield.autoSize, and it works fine.
But you have to be carefull, to set the correct styles to the textfield, 
before measuring.

Janosch


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com