To use embed font in your Flash application you need to do next:
1. Declare font and show TTF font location
[Embed(source="../../../../../../assets/fonts/MyFont.ttf", fontFamily="MyFont",fontWeight="normal", mimeType="application/x-font-truetype", embedAsCFF="false")]
private var MyFont:Class;
take care about embedAsCFF=”false”. This is important part of code.
2. Create TextFormat object and use embed font it in.
var textFormat:TextFormat = new TextFormat();
textFormat.font = "MyFont"; // Here is font attached
textFormat.italic = false;
textFormat.color = 0x000000;
textFormat.size = 12;
textFormat.bold = false;
3. Create TextField object and start using TextFormat object BEFORE setting any text for TextField
var textField:TextField = new TextField();
textField.embedFonts = true;
textField.antiAliasType=AntiAliasType.ADVANCED;
textField.defaultTextFormat = textFormat;
textField.selectable = false;
textField.autoSize = TextFieldAutoSize.LEFT;
textField.text = "Here is text with embed font"
That’s all!
Please tell me if you know better solution, thanks.
Let me describe my task. I have installed Linux Ubuntu Server in my VirtualBox. I use this virtual machine for some experiments. I don’t want do some tasks on my physical PC.
To connect with this Virtual Machine I want to use SSH.
It can be done via forwarding physical PC port in Virtual Machine.
Here is how to do this. Run this commands in terminal:
I have Android project which is under Continuous Integration (CI) server. In my case it is Jenkins.
Then I run my tests I just can see JUnit output in Jenkins console.
If some unexpected error happens I can’t see logcat from Android emulator.
Here I want to show you how I grab logcat from Android emulator. Now If something strange happens I can see logcat from emulator.
I made it using BASH script which is bellow. This script grab logcat and periodically check logcat filesize AND can create new file for logcat if it is greater than 5MB. Script can add time postfix to file if new one file was created.
PLEASE, TELL ME IF YOU KNOW THE BETTER SOLUTION !!!
HERE the BACH script:
#!/bin/sh
LOGCATFILE=$1/logcat.out
touch $LOGCATFILE
adb -s $2 logcat -v time > $LOGCATFILE&
PID=$!
while true; do
FILESIZE=$(stat -c%s "$LOGCATFILE")
echo "Size of $LOGCATFILE = $FILESIZE bytes."
echo "PID = $PID"
if [ "$FILESIZE" -gt 5242880 ]
then
echo "$LOGCATFILE is too large = $FILESIZE bytes."
now=$(date +"%Y_%m_%d_%H_%M_%S")
NEWLOGFILENAME=/home/igor/logcat_$now.out
cp $LOGCATFILE $NEWLOGFILENAME
kill -9 $PID
adb -s $2 logcat -v time > $LOGCATFILE&
PID=$!
fi
sleep 10
done
To run just create file with executable permission and as parameter to script write path to dir with log SECOND parameter is your device name which you can get when run adb devices in your terminal
Example:
igor@igor-laptop:~$ adb devices
List of devices attached
HT10WPL00853 device
Recently I wrote some app which looks good on HTC Desire and looks bad on HTC Sansation. The application didn’t fill all screen (display) area. And I see some black parts of display when I run my application.
Here the screenshot:
To fix this I made some changes in Android Manifest file. I’ve added next code in manifest node.