[flexcoders] Annotating a PieChart

2009-07-14 Thread tphipps
Has anyone played with the PolarDataCanvas canvas object to annotate Pie 
Charts? There are plenty of examples in the Live Docs and elsewhere on the web 
on how to annotate Bar and Column Charts (using a CartesianDataCanvas), but 
none that I can find using PieCharts.

Assuming that a valid NameField assigned to the chart's PieSeries is Yellow, 
is it as simple as the following code?

var columnLabel:Label = new Label();
columnLabel.setStyle(fontWeight, bold);
columnLabel.setStyle(color, 0x66);
columnLabel.text = Hello
annotationCanvas.addDataChild(columnLabel,'Yellow');

When called, this causes the chart to re-draw, but nothing appears inside the 
Yellow wedge.

I know that I could use labelPosition=inside to accomplish something similar, 
but I already have callout labels and need an inner label in addition.

Thanks!
Toby



[flexcoders] Re: htmlText truncation when changing from embedded to device font

2009-07-02 Thread tphipps
Tim,

Thanks for the detailed reply. Unfortunately, this only fixes half the 
problem... With your recommended changes in place, the size of the TextArea now 
restores after a brief flicker, but the HTML formatting of the content is still 
lost.

Even if I reassign the HTML text to the TextArea inside your updateTextSize 
function so it happens after the font change is complete, only the raw text 
appears, and the formatting (even non-font-dependent formatting such as br/, 
li etc.) is lost. I read and appreciate your point about the bold face text 
requiring an embedded bold font, but even the non font-dependent formatting (as 
above) is lost.

Any ideas on how to restore the formatting after the font change?

Thanks again,
Toby

--- In flexcoders@yahoogroups.com, Tim Hoff timh...@... wrote:

 
 I'll let the engineers let you know why this is happening.  But, you can
 get it to work with the following steps (hack):
 
 1)  Remove height=200 from the test Text control.
 
 2) Add this function:
 
 private function updateTextSize():void
 {
   test.invalidateSize();
 }
 
 3) On the ComboBox change event, execute callLater(updateTextSize);
 
 Note: If you use embedded fonts, a boldface font must be available for 
 b/b to work.
 
 -TH
 
 --- In flexcoders@yahoogroups.com, tphipps toby.phipps@ wrote:
 
  Hi all,
 
  I've seeing some strange behaviour with a mx:Text component using
 htmlText.
 
  It seems that when the fontFamily of the text component is changed at
 runtime from an embedded font to a device font (or vice versa), the
 content is truncated, and the HTML formatting lost. However, when
 changing from one device font to another (or one embedded font to
 another), it works just fine.
 
  Take this example (view source enabled but without the actual font
 files included - any OTF should work fine):
 http://dev.nx.sg/lab/fontchange/FontChange.html
 
  This app initializes the text component with some htmlText using a
 device font (_sans in this case). Once loaded, try changing the font
 to another device font (e.g. Courier New or Myriad) with the dropdown.
 Everything's fine. Now change to an embedded font, and note the
 truncation and loss of formatting.
 
  The reverse happens if I initalize the field with an embedded font -
 changing to another embedded font works fine but changing to a device
 font ends up truncating again.
 
  Anyone got any ideas how to make this work?
 
  Thanks,
  Toby.
 





[flexcoders] htmlText truncation when changing from embedded to device font

2009-06-21 Thread tphipps
Hi all,

I've seeing some strange behaviour with a mx:Text component using htmlText. 

It seems that when the fontFamily of the text component is changed at runtime 
from an embedded font to a device font (or vice versa), the content is 
truncated, and the HTML formatting lost.  However, when changing from one 
device font to another (or one embedded font to another), it works just fine.

Take this example (view source enabled but without the actual font files 
included - any OTF should work fine): 
http://dev.nx.sg/lab/fontchange/FontChange.html

This app initializes the text component with some htmlText using a device font 
(_sans in this case). Once loaded, try changing the font to another device 
font (e.g. Courier New or Myriad) with the dropdown. Everything's fine. Now 
change to an embedded font, and note the truncation and loss of formatting.

The reverse happens if I initalize the field with an embedded font - changing 
to another embedded font works fine but changing to a device font ends up 
truncating again.

Anyone got any ideas how to make this work?

Thanks,
Toby.




[flexcoders] Flash Player 10 device font anti-aliasing with Flex

2009-04-20 Thread tphipps

I've been hankering to try Flash Player 10's new anti-alias support for
device fonts, and finally got around to it today. Unfortunately, I can't
seem to get it to work from Flex.

I've compiled a simple test app with both Flex SDK 3.3 and the preview
of Gumbo 4.0.0.4904 both targetted for Flash Player 10 (as per the
instructions here:
http://opensource.adobe.com/wiki/display/flexsdk/Targeting+Flash+Player+\
10
http://opensource.adobe.com/wiki/display/flexsdk/Targeting+Flash+Player\
+10 ) and got identical results for both. Anti-aliasing embedded fonts
works as normal, but device fonts appear with their normal blockiness.
I've tried on XP, Vista and Windows 7 with FF and IE all with the latest
FP 10 install. With Windows native ClearType enabled, the device fonts
look a little better (as the OS is doing the anti-aliasing) but still
nowhere near as good as the embedded font. With Windows ClearType
disabled, the device fonts look as blocky as ever and the embedded font
looks grea.

I'm really interested to see if anyone else has tried this.

A test app (with View Source enabled) is here:
http://dev.nx.sg/lab/flex3fp10/LongTextTest.html
http://dev.nx.sg/lab/flex3fp10/LongTextTest.html

To try it out, make sure you have Flash Player 10 installed and:

1. If on Windows, turn off ClearType to prevent Windows from doing any
anti-aliasing for you and confusing the issue (via Control Panel -
Display)

2. Open the link above and choose a sans-serif device font from the
dropdown list (if you have Myriad Pro installed locally - choose it) and
size the font around 10pt to see the difference clearly.

3. Compare the first and second blocks of text. Both are in the device
font selected but the first has fonAntiAliasType=advanced and the second
doesn't. You'll see that they are identical in all respects.

3. Compare the first two blocks to the third block which is the embedded
font - the anti-aliasing is clearly present on the third block and
absent from the others (or of less quality on the others if you have
ClearType still enabled)

4. Just to prove that the app is targetted correctly to Flash Player 10,
click on each block of text and watch it rotate in 3D space. As an
aside, note that after rotating, the device fonts become anti-aliased
but VERY badly, and inconsistently across the width of the text.

Anyone else played with this? I'd really like to get it working so that
I can go back to using deving fonts for my applications...

Thanks,
Toby.