I am using a Flex Application,It can load external font swfs,Now I am using TLFTextField,Eventhough I set a embedFonts = true, It still taking the device font,How to stop it.
In adobe Documentation it is mentioned that, TLFTextField takes fall back font if embedded font is not available.
Use DF4 instead of DF3 while embedding fonts using AnimateCC or flash. Also use TextLayoutFormat instead of TextFormat
Related
I have been building my games using FlashDevelop with Flex SDK compiler all the time, but now I need ASC 2.0 with adobe air. So I have migrated to it. But one problem came out, which I just can't find a solution for. I need to embed TTF fonts, which I used to always add additional compiler option -managers=flash.fonts.AFEFontManager for. In this new AIR SDK all I get is the next warning:
command line
Warning: 'compiler.fonts.managers' is not fully supported.
And of course fonts do not embed.
Is there a solution for it?
Here's how I embed them
[Embed(source = "VERDANA.TTF", fontName = "verdana")]
private static var Verdana: Class;
Well, the answer to this is that Adobe (for some unknown reason) have cut font pretranscoding out of ASC 2.0, so all fonts must be pretranscoded now to be able to embedded into code. The easiest way is to use Adobe Flash pro, to embed font and pack it as SWC. Then attach it to your project somewhow, and register font via Font.registerFont(Arial); (or some other class you have attached to it). Bingo! Now you can use it.
The second, more complicated, but cheaper way is to use fontswf utility from adobe
Details can be found here http://www.bytearray.org/?p=4789 and here: http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf69084-7f5f.html (at the bottom of the page)
I have e learning books in flash file(.swf format) and i want to make it responsive.Can any one suggest a solution for this.please refer the link flash file
If you open the raw swf files in a browser, you can see that they are already responsive by default: http://rtpublishers.com/data/Hindi/Book1/pages/page1.swf
So, you need to change the way the Flash is embedded in your html page. Where you are using fixed 1300 x 900 pixels dimensions, use percentages instead.
In your Flash file, you can set the stage scaleMode = StageScaleMode.EXACT_FIT as explained here:
http://help.adobe.com/en_US/ActionScript/3.0_ProgrammingAS3/WS0D75B487-23B9-402d-A52D-CB3C4CEB9EE4.html
If there are parts of the Flash that you want to scale differently depending on stage size, you can listen to the stage RESIZE event, and respond accordingly.
I'm porting my AIR app to iPad. I'm using embeded fonts in textfields in my app. But when user starts editing text (after double click the textfield.type is set TextFieldType.INPUT), the text is geting huge... Embeded font is DejaVuSans. When I do textfield.embedFonts=false the huge font problem disappears. I'm not even trying to ask why the font can get huge (looks like it's specific for my app). The question is a bit more simplier. When I set textfield.embedFonts to false Times font is used. But I need DejaVuSans. Heres the question: how is called in flash player (so that I can do textFormat.font=NAME) and where are all available fontfaces are listed?
Thank you in advance!
No fonts are built into Flash Player or AIR. Besides embedding fonts yourself, you can use the fonts that are installed on a user's computer (and some fonts are available on almost all OS'es like Verdana and Times).
You can get a list of all fonts on the user's machine via the enumerateFonts method of Font like this:
(copied from http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/text/Font.html#enumerateFonts%28%29)
var allFonts:Array = Font.enumerateFonts(true);
from the manual:
enumerateDeviceFonts:Boolean (default = false) — Indicates whether you want to limit the list to only the currently available embedded fonts. If this is set to true then a list of all fonts, both device fonts and embedded fonts, is returned. If this is set to false then only a list of embedded fonts is returned.
I have replaced all TextField objects with TextLayout as I require the functionality it offers. When using TextLayoutFormat I try to embolden text using "this._textLayoutFormat.fontWeight = FontWeight.BOLD;"
Adobe have said you can only embolden text when using device fonts:
"Applies only to device fonts (fontLookup property is set to flash.text.engine.FontLookup.DEVICE)."
This seems crazy to me! Does anyone know of a work around?
You have to embed your font twice: once with a normal weight "myFont" and once with fontWeight=bold "myBoldFont", then you should be able to switch from normal to bold by changing the fontName of your TextField. I do agree, this is stupid.
I have a problem with doing proper font embedding in a actionscript 3 project (flash CS4, not flex).
I followed this Adobe guide to do font embedding:
http://www.adobe.com/devnet/flash/quickstart/embedding_fonts/
the guide tells to set the Textfield.embedFonts property to true. if I do so and try to display a text with another font in this textfield, then nothing is displayed - that's fine, i expect it like this.
But now I have this particular problem:
i embed the font "Arial" in Regular style and create two input Textfields on the stage. one of them i set the embedFonts property to true (as described in the guide) the other i leave as is. Now I publish the thing as swf and try to enter the following (Turkish) string into the textfield
Yeni Yılın Barış ve Mutluluk Getirmesini Dileriz.
now the problem is, that the untouched textfield displays the string correctly - but the one with embedFonts set to true is missing some of the letters (for example ş is not displayed). But the Arial font does have this letter since it is displayed correctly in static - so why does it not render correctly when i set this property (as told in the guide)?
in my final app there shall be a single textField, but multiple embedded fonts and a way to switch between them (for example the user must be able to choose another font for entering chinese text).
can someone tell me how to do it properly?
thanks!
Embedding fonts in Flash is not as straight forward as it should be, and there are a bunch of special cases... One way to ensure that you are embedding the correct characters of your font is enabling "Generate size report" in the Flash Publish Settings.... there you will see all characters of all fonts that are being embedded. The only exception is that fonts embedded using the [EMBED tag do not show there.
Adding the font to the library doesn't embed the whole set of characters of that font (Arial for instance is about 8mb)... it only embeds a subset of them... I'm not sure if its always the standard occidental Latin set, or if it depends on the computer language.
You can extend this set manually using any textfield in your movie (with the "Character embedding..." dialog) as long as you use the actual Library Font name (it shows in the font list with an asterisc at the end... in your case it would be "Arial*").
You can also use the [EMBED tag with the unicodeRange to declare de character set, but bare in mind that the fonts you declare there wont be available in the Flash IDE during editing time... you need to set them at runtime with ActionScript (TextFormat, StyleSheet, etc...), which is not very practical when working with Flash.
I use the system fonts, and avoid the embedded ones like Arial.
public function get availableFonts(): Array
{
var font: Font = null;
var allFonts: Array = Font.enumerateFonts(true).sortOn("fontName", Array.CASEINSENSITIVE);
var embeddedFonts: Array = Font.enumerateFonts(false);
var excludeList: Object = {}
for each(font in embeddedFonts)
{
excludeList[font.fontName] = '';
}
var ourFonts: Array = [];
for each(font in allFonts)
{
if (!excludeList.hasOwnProperty(font.fontName))
{
ourFonts.push(font);
}
}
return ourFonts;
}
The list of fonts that this returns are going to have all their letters.
(wouldn't it be nice if ActionScript had some easier way of doing set difference built in?)
If you're looking for a more robust font loading solution that can load the different fonts at runtime, I've posted some code here (http://labs.tomasino.org/2009/07/16/flash-as3-runtime-font-manager/) and explanations of how to use it.