WebCanvas DrawString Issue in Cloud

Hello together,

i make my first steps with WE and Cloud and have a Problem with WebCanvas. I have an picture Property"PicBuffer" and create this Picture with this code in a method:

PicBuffer = new Picture (me.width, me.height)


PicBuffer.Graphics.DrawString(“test”, 20,160)

In the Paint EvenHAndler of my WebCanvas i do:

If me.PicBuffer<>nil then

End If

The Problem is that the test String is not painted to the picture in Cloud, but the Rectangle is drawn!
In Standallone it works fine. There the Text is drawn. So… can it be that the Fonts in Cloud have to be specified in a way i don’t see???

Can anyone confirm this with cloud?

Using the DrawString in the WebCanvas Paint Event works also fine! Only “drawing” a String directly to the picture doesn’t work!

Thanks Björn

Ok, i’ve found out with fonts.count that there are no fonts available on XOJO Cloud Servers… but why does the drawstring work in the paint method directly?

Because the drawing is taking place in two different places.

In the example you gave above, you’re drawing a picture on the server (where there are no fonts) and then sending the whole image to the canvas.

If you draw directly onto the supplied WebGraphics object, those commands are sent to the browser and the drawing is done in an HTML5 canvas object using the fonts that are available on the user’s computer.

Thanks a lot for your reply Greg… Does this mean that this is not a server side process and WebGraphics object is completely “drawn” at the client side?

Yes. When drawing on a webcanvas, your instructions are converted to javascript commands. The really cool part is that behind the scenes, we diff the new script with the previous one and only send the info that has changed. It makes redraws significantly faster if you’re drawing a lot of stuff.

Thats really cool… thanks for this informations

@Greg O’Lone , do you have any instructions on how to install fonts on a Xojo Cloud server ?

It should work if you enable SFTP, log-in using a FTP client and copy the fonts to the Fonts folder.

The Fonts directory is not directly accessible via SFTP right now, but that will be corrected tonight. After that, a “Fonts” folder will appear on the server next to Shared_Documents, certs, logs, etc…