In my current solution, I have resorted to some unconventional methods. Here's what I've been working on:
It's important to note that my solution relies on:
- Running the app as an administrator (which is essential)
- Softlinking the user's project font folder
Here are the key points:
- Webkit is unable to render fonts from a "file:///" url
I attempted using file:/// without success and converting SVG fonts to base64 also didn't work. Trying to manipulate stylesheets at runtime proved even more challenging, so I turned to command prompts for a solution. Currently, I'm executing this on Windows and it's functioning smoothly:
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();
};
Subsequently, I had to establish a soft link (mklink) from the user's project font folder to the application font directory to ensure accessibility at runtime.
WinDoExec(["mklink","/D","C:\\Program Files(x86)\\myapp\\Resources\\assets\\fonts\\userfonts","C:\\Users\\windowsuser\\projectAppFolder\\ProjectName\\Fonts"]);
By creating a soft link within the application, I successfully resolved the issue of loading custom fonts for the user's project during runtime...
Although my approach may seem unconventional, I strongly believe that having accessible URL paths for temporary objects (such as user's svg/ttf files) would greatly benefit developers. These paths could be utilized for storing and processing data without affecting the core system folders.
To the TideKit team, I kindly request the implementation of accessible URL paths for temporary objects to enhance the runtime capabilities of applications.
Thank you.