feathersui-starling
feathersui-starling copied to clipboard
Example themes: find way to load fonts at runtime in AssetManager version instead of [Embed] syntax
Is there a way to load the fonts embedded in 'BaseMetalWorksDesktopTheme.as' at runtime rather than having them compile into the application? I know they are fairly small but it kind of defeats the idea of using an Asset Manager.
You can't load TTF/OTF fonts in their native format at runtime, but I think the SDK has a command line tool to create a "font SWF" that stores them in the embedded format. I haven't tried, but it may be possible to load this SWF at runtime and register the fonts. If I find time, I'll experiment with this, I think.
Josh I believe that is what I did in the past on a non-starling project. In my case the loaded SWF would register the font itself , it might be doable through the theme if you use getDefinition from the ApplicationDomain of the SWF Loader but I have not tried this myself.
On Fri, May 6, 2016 at 10:26 AM, Josh Tynjala [email protected] wrote:
You can't load TTF/OTF fonts in their native format at runtime, but I think the SDK has a command line tool to create a "font SWF" that stores them in the embedded format. I haven't tried, but it may be possible to load this SWF at runtime and register the fonts. If I find time, I'll experiment with this, I think.
— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/BowlerHatLLC/feathers/issues/1366#issuecomment-217454317
Phillip Chertok
It's actually likely that I looked into using font SWFs in the past. I think one of my concerns was ease of use for people who check out the repo and use the source code directly. There's a lot of people doing it that way.
I'd prefer not to check a SWF into the repo so that it remains easy to copy or reference everything without configuration/building. Obviously, I would include the built SWF in a stable version, so maybe that's good enough. The SWF can be found, if needed.
I can understand the concern. I don't really see it being any different than the way that the example themes work now. Currently in your documentation you explicitly specify to the users which files need to be in the application directory if they want to use the Asset manager version of themes.
On Fri, May 6, 2016 at 10:59 AM, Josh Tynjala [email protected] wrote:
It's actually likely that I looked into using font SWFs in the past. I think one of my concerns was ease of use for people who check out the repo and use the source code directly. There's a lot of people doing it that way.
I'd prefer not to check a SWF into the repo so that it remains easy to copy or reference everything without configuration/building. Obviously, I would include the built SWF in a stable version, so maybe that's good enough. The SWF can be found, if needed.
— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/BowlerHatLLC/feathers/issues/1366#issuecomment-217465899
Phillip Chertok
It looks like SWFs created with fontswf don't automatically register their fonts on load and they don't expose any definitions in their application domain to allow me to do it manually at runtime. It seems to be in SWF tags that would need to be parsed at the ByteArray level.
I could export a font symbol from the library in Animate and build the SWF that way, but I'd rather do something that anyone can reproduce with free SDKs. I'm going to skip this one.