hey guys
spent a couple of hours googleoogling around to find something to quickly
convert a string of special characters into a unicode range to no avail so
i've written a function to do it for me and i thought some of you dynamic
font embedders might appreciate it
[code]
package uk.co.thereceptacle.utils { import
flash.errors.IllegalOperationError; /** * text utilities * @author Allandt
Bik-Elliott * @version 1.0 */ public class TextUtils { // constructor public
function TextUtils() { throw new IllegalOperationError("TextUtils is a
static class and should not be instantiated"); } // methods /** * converts a
string of characters into a unicode range for font embedding * @param string
*/ public static function traceUnicodeRange(string:String):void { var
unicodeRange:String = ""; var ltr:String; for (var i:int = 0; i <
string.length; i++) { if (i > 0) unicodeRange += ", "; ltr =
string.charCodeAt(i).toString(16); ltr = addLeadingZeros(ltr); unicodeRange
+= "U+" + ltr.toUpperCase(); } trace(unicodeRange); } private static
function addLeadingZeros(ltr:String):String { if (ltr.length < 4) { ltr =
"0" + ltr; ltr = addLeadingZeros(ltr); } return ltr; } } }
[/code]
it's helped me out no end
best
a
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders