Skip to main content
February 28, 2011
Question

How to force device text to be rendered by adobe renderer

  • February 28, 2011
  • 3 replies
  • 1723 views

Hi all, This seems to be the best place to ask this question. The developers of TLF are very responsive and I am sure that is appreciated by many.

I am hosting SWF files in a parent SWF and the child SWF's can be developed in a way I do not have complete control over them.

I need to be able to force the adobe text renderer on those child SWF's if they happen to use device text.

I can do this already by enabling any filter in the parent SWF for the child SWF. The problem is that it can become very slow on some SWF files.

So question is how can I do this without using a filter in an efficient way ?

The reason this is a problem for me is because there is either a bug in Flash player or its just something in windows text renderer that causes the device text to always have full transparency when drawn in an offscreen bitmap. So device text becomes invisible. All text needs to be handled if it's in a TextField or TLF.

The parent SWF will be running in 10.1 or above.

Don

This topic has been closed for replies.

3 replies

Adobe Employee
February 28, 2011

I haven't spent much time in the code that does the bitmap rendering of text, so I'm not sure exactly how we're dealing with alpha, but we always use GDI to render device text.  In the normal case we render to the screen, in the filter case we render to an off screen bitmap.  There is no other mode via which the desktop player can render device text.

Adobe Employee
February 28, 2011

When you use a filter, we have the OS render the device text to a bitmap, and we then apply the filter to the bitmap.  So there's an extra step,

which explains the performance.  Can you expalin why you need to prevent child SWF from using device fonts?

February 28, 2011

I don't want to prevent the child SWF from using device text, but I need a work around for the alpha problem. I am drawing flash in an offscreen ARGB bitmap and if I allow the child to just draw normally and if it is using device text, that text will be completely transparent which leaves holes where the text is supposed to be.

It's a real problem since flash is being drawn transparently and there is no real way for me to provide a fixup for it. If I do not draw flash transparently, the problem still exist when I am drawing into a ARGB bitmap, but then I know I can just or in 0xff000000 for every pixel and fix it that way but then I do not have transparency where I want it...

I don't think I can deal with it in my own C++ code... since I need to draw it transparently... outside of renedering it twice and keeping track of every pixel that may be device text... dont think this would even work... but needless to say not something i want to  do as it also would slow everything down...

If filters are applied on a special case within the child SWF for just text, then that also fixes the problem and performance is better... Only thing is I have no idea who will be developing these SWF files and trying to document something like this is going to be a problem.

Don

Adobe Employee
February 28, 2011

Rather than using a filter, try using:

DisplayObject.cacheAsBitmap = true;

I'm told that we do have code in the player to solve this issue, but that it's only active for wmode=transparent.  Unless you can get that working in your container (hard) your best bet is to stick with the bitmap trick.

Adobe Employee
February 28, 2011

There is no way to force text which has specified device fonts to use embedded fonts. Could you please file a Jira bug about the transparency issue?

February 28, 2011

Hi Jeffrey,

Using a filter fixes the problem and forces the text to be rendered some other way. There is no embedded font so yeah its not using an embedded font, it is just rendered differently.

As mentioned, using a filter slows things down, so there is a way to fix the problem, just not a very good one...

So what process is being using when a filter is applied to draw device text ?  It's not the same...

EDIT: This is something I need to deal with right away so don't have time to wait for a bug fix but I will report it.

Don

February 28, 2011

If I apply a filter as follows:

filters = new GlowFilter (0,0,0,0,0);

Then the problem goes away but a new problem with performance comes up for some SWF's.

It could be there is some more efficient mechanism or some more efficient filter I could use until the problem is resolved.

The performance issue is not because of the text being rendered. It's because applying a filter like this to some SWF's even without text in them, slows things down.

Don