Greetings,
I am pulling out my hair, trying to get a specific font embedded within a Xojo web app. I would appreciate any help you could give. Here’s the background:
I have created an app that must render in Burmese, using a font named Padauk. I have had all of the labels and listbox items translated into Burmese, but when the app is deployed to our Xojo Cloud server and accessed by our testers, they tell me that the Burmese characters are unreadable… Bad Burmese or BB as they call it. The font is also unreadable on my own machine, where the font files are local. I am hoping to fix the problem by embedding the Padauk font in my web app, so every user will be using the same font.
In order to test the font-embedding technique, I created a small, light-weight app and I have followed some instructions from a posting by Michel Bujardet, to use a PageSource control in conjunction with loading the “.ttf” font into a WebFile control in the App.Open event. When I deploy the app, it hangs with a “Launching” screen. When I run the app locally in the Debugger, it fails with a lengthy error message, but I think the top two lines are related to the problem. It says:
[quote]Could not execute returned javascript: content is null
Source: var langdir = document.getElementsByTagName(‘body’)[0]; if(langdir) { langdir.removeAttribute(‘dir’); }
var langdir = document.getElementsByTagName(‘body’)[0]; if(langdir) { langdir.setAttribute(‘lang’,‘en’); }[/quote]
That is all I have to go on, and I have no clue about its meaning. Any thoughts about getting me to the next hurdle? I get the same result whether I use .ttf or .woff versions of the font.
Here’s the code as it stands (and fails):
App.Open Event (using a pragma directive to determine if it’s running in debug or on the cloud - this is for the debug):
#If TargetXojoCloud Then
dim f1 as folderitem = ExecutableFile.Parent.Child("Concord Concord_aux").Child("Padauk-Regular.ttf")
wf = Webfile.Open(f1)
#Else
dim f1 as folderitem
f1 = GetFolderItem("E:\\Don's Stuff\\XOJO Projects\\Concord\\Concord_aux\\Padauk-Regular.ttf", FolderItem.PathTypeShell)
wf = Webfile.Open(f1)
#EndIf
WebPage.PageSource.EditSource code:
Source = "<style>@font-face {"+EndOfLine
Source = Source + "font-family: Padauk; src: url("+app.wf.URL+");}" + EndOfLine
The app also has a WebStyle that points to one, and only one font, which is Padauk; the WebStyle name is PadaukStyle and both controls on the web page use this style.
There is one more piece of information that I can give: When running in the debugger, the value of the “Source” in the EditSource is:
[quote]/_files/8591-3724-8142-7809-8315/Padauk-Regular.ttf[/quote]
The deployed app resides here.
Sorry about the length of this posting - once again, I greatly appreciate your help.
Don