I recently created a flash banner using haXe and swfmill. When embedding my font into a library, I wanted to include only used characters. The following code prints the set of glyphs for use in swfmill source file:
# We'll use string `s` as our starting point
s=u'Let\'s find out which chars make up this text!'
# This is a set of chars in `s`, sorted and re-assembled as a string
chars = ''.join(sorted(set(s)))
# We need to escape non-ascii chars
encoded_chars = chars.encode('ascii', 'xmlcharrefreplace')
# Result
print encoded_chars
Hope it helps someone.
No related posts.
I recently created a flash banner using (http://haxe.org/) and (http://swfmill.org/). When embedding my font into a library, I wanted to include only used characters. The following code prints the set of glyphs for use in swfmill source file:
# We'll use string `s` as our starting point
s=u'Let\'s find out which chars make up this text!'
# ...
Tags: flash, haxe, swfmill
This entry was posted
on Wednesday, March 4th, 2009 at 22:32 and is filed under Programming.
You can follow any responses to this entry through the RSS 2.0 feed.
Both comments and pings are currently closed.