Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Adobe AIR Development

Reply
Highlighted
Developer
Posts: 43
Registered: ‎12-22-2010
My Device: Not Specified

Re: Embedding Fonts

Hi!

I tried both your exmaples and none worked.

In fact, the second one, which does not use lg, shows no test at all, let alone the embedded font.

Any idea?

I need to embed the font to be used in TFL and I've figured out it is not as eas as usual test embedding which I have done with CSS.

My main problem is that I am using arabic fonts which usual text elements do not render well so I have to resort to TFL.

BTW, I am testing on Playbook VM.

Any help? comment?

---------------------
a) If you like my response/post, please provide a Kudo (white star to the left).
b) If my post solved your problem please click on the Accept as Solution button.
----------------------
Regular Contributor
Posts: 86
Registered: ‎10-25-2010
My Device: Not Specified

Re: Embedding Fonts

TextField can not display embedAsCFF fonts, you will have to use TLF text classes TextFlow etc...

 

What is the code you are trying?

blog: http://renaun.com
twitter: @renaun
Developer
Posts: 43
Registered: ‎12-22-2010
My Device: Not Specified

Re: Embedding Fonts

Hi everyone,

I have tried all the above solutions and none worked on the simulator (though some works with the usual AIR) and finally I found the cause, at least in my case, and A solution.

So, the cuase is that actually FB will not embed the fonts in the swf files, no matter how hard you beg it.

The short solution for me was to use fontswf utility which is in the bin dir of the flex sdk. It basically embeds the font in an swf file for you, now embedding it works completely perfect and has eabled me to load multiple complex (like arabic) fonts to the simulator without a hitch.

 

In a nutshell, what you do is the following:

1. Take your .ttf file (should work with otf too, but I haven't tried). and run it againns fontswf:

 

flexsdk\bin\fontswf -a titr -o titr -4 titr.ttf

 

 

2. Embed it in you MXML like:

 

        @font-face {    
            src:url('assets\titr.swf');
            fontFamily: titr;
            fontWeight: normal;
            fontStyle: normal;
            embedAscff:true;
        }

 or if you are AS3 fan, like:

 

[Embed(source="assets\titr.swf", fontFamily="titr")];
private const titrFont:Class;

 

 

and there you go, you can use it in fontName/Family/Face properties.

 

One last point: if you are going to use it for MX components, i.e. some old and regular buttons, lists, etc. I think you are in trouble. For english fonts, actually the old styles described would work well and the ttf gets embeded, yet, complex scripts will only work in FTE enabled components and Adobe in general recomends using them. See the blow link for more details.

http://help.adobe.com/en_US/flex/using/WSda78ed3a750d6b8f-26a13bbf123c441239d-8000.html

 

 

---------------------
a) If you like my response/post, please provide a Kudo (white star to the left).
b) If my post solved your problem please click on the Accept as Solution button.
----------------------
Contributor
Posts: 10
Registered: ‎12-09-2010
My Device: Not Specified

Re: Embedding Fonts

Yeah, neither of the first two examples worked for me. I'll try your solution with the embedded SWF. I was hoping it would magically be resolved in the next SDK release but its looking like that may be cutting it too close to the deadline.

Developer
Posts: 71
Registered: ‎01-06-2011
My Device: Not Specified

Re: Embedding Fonts

Kefayati, I tried your solution, but the fontswf utility doesn't do anything when I use it, it just opens and closes instantly. I tried opening it normally, and then dragging my .ttf file onto it to start it, but neither worked. Am I using the utility wrong?

---
My Apps:
KeepUp (http://appworld.blackberry.com/webstore/content/26514?lang=en)
Developer
Posts: 157
Registered: ‎12-16-2010
My Device: Torch 9800, PlayBook
My Carrier: I carry it myself

Re: Embedding Fonts

Has anyone succesfully managed to embed a font? I need to change the angle of TextField (using TextField.rotation property) and as far as I understand the only way to achieve it is to embed the font. 

 

I've tired all the methods in this thread and elsewhere and cannot figure out how to embed. The fonts just dont show up (even when they are not rotated).

----------
If you find this post helpful please "like" it and accept as a solution.
Developer
Posts: 43
Registered: ‎12-22-2010
My Device: Not Specified

Re: Embedding Fonts

@tyrael: fontswf is a commandline tool, I hope you have figured it out. I have demonstrated how you should use it with an example above.

@ pepper: how do you know that the font is embedded or not? One other thing... why you are using TextField, you can try the spark equivalent of it, TextInput, I think it has a QNX version too...

---------------------
a) If you like my response/post, please provide a Kudo (white star to the left).
b) If my post solved your problem please click on the Accept as Solution button.
----------------------
Developer
Posts: 2,462
Registered: ‎11-04-2010
My Device: Bold 9700

Re: Embedding Fonts

man. i just tried some font embedding and i broke my entire workbench in flash builder. had to choose a new workbench and re-import all my projects. all my configurations for debugs are gone and so are my preferences Smiley Indifferent will not be attempting that again for a long time lol

J. Rab (Blog) (Twitter)
--
1. If you liked my post or found it useful please click on the thumbs up and provide a Like!
2. If my post solved your problem please click on the Accept as Solution button. Much appreciated!

Approved Apps: OnTrack | ssShots | Hangman
Developer
Posts: 409
Registered: ‎12-10-2010
My Device: PlayBook
My Carrier: N/A

Re: Embedding Fonts

[ Edited ]

not a solution, but this link might help:  Using embedded fonts

 

(scroll down to "Embedding fonts in ActionScript")

 

personally, i can't even embed my MyriadPro-Bold.oft font using Flash Builder 4.0.1 and QNX SDK without the following error:

 

 

Description Resource Path Location Type exception during transcoding: PlayBookTest.as	/PlayBookTest/src line 12 Flex Problem

 

 


PlayBook Applications:
Drop Swatch
Developer
Posts: 43
Registered: ‎12-22-2010
My Device: Not Specified

Re: Embedding Fonts

Has any of you people seriously tried my method?

Just embeding fonts as usual does not work on PB, it seems you have to include them in the swf the way i described above. Normal embedding techniques, like DarkIn has posted did not work, at least for me... though it is a good to read guide.

---------------------
a) If you like my response/post, please provide a Kudo (white star to the left).
b) If my post solved your problem please click on the Accept as Solution button.
----------------------