0

I have tried for my app to load fonts on request. I tried to read fonts from the a project directory which is created by my app, and it reads all the info it needs.

First of all, I want to ask if there is a way to know if there is an app-storage:// like in adobe air, because THAT IS KILLING ME! I cannot create temporary files to be read on runtime by the app and place, for example, a style sheet with the new loaded fonts on runtime via JS.!

If there is one, please let me know!!!

Erick
  • 160
  • 8

1 Answers1

0

Now a very dirty solution. This is what I had done up to now:

Just to let know everybody, my solution relies on :

  1. run the app as administrator (a must to have)
  2. softlinking the user's project font folder.

now lets get the facts:

  • webkit cannot render fronts coming from a "file:///" url

I had tried using file:/// with no success, and neither converting the SVG fonts to base64 did the trick at all. Trying to do on runtime stylesheets was even worse, so looking for solutions I had to rely on command prompts. For now I'm running this on windows and works pearls:

var WinDoExec = function(cmdline){
    var echoCmd = ["C:\\Windows\\System32\\cmd.exe","/C"];
    echoCmd = $.merge(echoCmd,cmdline);
    console.log(echoCmd);
    var echo = Ti.Process.createProcess(echoCmd);

    echo.setOnReadLine(function(data) {
        console.log(data.toString());
    });
    echo.stdout.attach(echo.stdin);
    echo.launch();
};

so from here, I had to create a mklink (soft link on ntfs) from the user's project font folder to the application font directory, so it could be accessible on runtime.

WinDoExec(["mklink","/D","C:\\Program Files(x86)\\myapp\\Resources\\assets\\fonts\\userfonts","C:\\Users\\windowsuser\\projectAppFolder\\ProjectName\\Fonts"]);

with this, creating a soft link into the application in runtime fixes the issue of loading the custom fonts for the user's project into the runtime app...

I know this is kinda "abusive" with the program environment, but I really wish there was a way for the app to have a url accessible path (such storage url path or temporary url path) in order to process things on runtime. I could copy the fonts into the temporary url container folder and do my stuff without affecting the app system folder at all.

So if you guys on tidekit read this, please allow developers to have accessible url paths for temporary objects (like user's svg/ttf files) that I can copy there and use on runtime.

Thanks.

Erick
  • 160
  • 8