Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

canvas.text html problem

Hi all,

i'm trying to enable html on canvas.text function but no success.

any suggestion how to resolve the problem?

(in attachment a brief experiment. Instruction canvas.text at line 63 of element instructions_js)

Michele M.


  • Hi Michele,

    I'm in no way an expert, but are you on a Mac by any chance? Have you seen this discussion:

    Maybe your issue is related?

    Buy Me A Coffee

  • hi eduard,

    thank you fr your replay, but i don't use a mac and reading the discussion it seems that the problem is in a "draw textline" inside a sketcpad, but in my case the problem is with canvas.text method inside a inline javascript.

    Best Regards,

    Michele M.

  • Hi Michele,

    Too bad, that was that a hunch, @Fab have you encountered anything like this before?


    Buy Me A Coffee

  • Hi @michele.marzocchi & @eduard ,

    Can't say I have encountered that issue before. I'm no expert on the programmatic use of the canvas, and I don't have the solution, but I think I might have an idea of what the source of the problem is, so hopefully someone else out there might know how to go about solving it... Might be a tough one to crack, though, 'cause it looks as if strings are processed differently when running the experiment within OS and when running it through OSWeb:

    Incidentally, for line breaks, when programming in Javascript you can use \n instead of <br> or <br/>.

    I tried the following change in your code, just to see whether the instructions can be displayed properly when the string sentence is defined directly in Javascript:

    function draw_instructions(c)
    textvar="Sentence with html tags\n\nsentence after double backslash n"
    c.text({text:textvar, font_size: 24, html:true}) //html **style args doesn't work

    That works when executing the experiment with OS (which does not solve the problem, of course, because it fails if you try to read the string from vars.instruction_sentence), but it does not work in OSWeb... So I think that the issue might be with passing of the information from vars.instruction_sentence as a string, at least in OS. In OSWeb, things seem to get a lot more complicated because no matter how I build the string, OSWeb seems to ignore the html tags altogether. It treats the string as al alphanumerical string regardless of contents (i.e., it does not parse it for known html tags). My guess is that this is reflecting the way OSWeb handles strings, but I have no further insights, unfortunately...



    Buy Me A Coffee

  • Thanks for looking into this @Fab. Well, then @sebastiaan to the rescue?

    Buy Me A Coffee

  • Hi @eduard , @michele.marzocchi , and @Fab ,

    Indeed, HTML is currently (OSWeb <= 1.4.11) not supported on Canvas objects in JavaScript. This is because of the way that text is rendered by OSWeb on Canvas objects and sketchpad items (using a library called PixiJS).

    However, what you can do is use an inline_html item, which for the purpose of instructions is usually also fine. The contents of an inline_html are shown as a regular web-page, and thus HTML tags will work.

    — Sebastiaan

Sign In or Register to comment.

agen judi bola , sportbook, casino, togel, number game, singapore, tangkas, basket, slot, poker, dominoqq, agen bola. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 50.000 ,- bonus cashback hingga 10% , diskon togel hingga 66% bisa bermain di android dan IOS kapanpun dan dimana pun. poker , bandarq , aduq, domino qq , dominobet. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 10.000 ,- bonus turnover 0.5% dan bonus referral 20%. Bonus - bonus yang dihadirkan bisa terbilang cukup tinggi dan memuaskan, anda hanya perlu memasang pada situs yang memberikan bursa pasaran terbaik yaitu Bola168. Situs penyedia segala jenis permainan poker online kini semakin banyak ditemukan di Internet, salah satunya TahunQQ merupakan situs Agen Judi Domino66 Dan BandarQ Terpercaya yang mampu memberikan banyak provit bagi bettornya. Permainan Yang Di Sediakan Dewi365 Juga sangat banyak Dan menarik dan Peluang untuk memenangkan Taruhan Judi online ini juga sangat mudah . Mainkan Segera Taruhan Sportbook anda bersama Agen Judi Bola Bersama Dewi365 Kemenangan Anda Berapa pun akan Terbayarkan. Tersedia 9 macam permainan seru yang bisa kamu mainkan hanya di dalam 1 ID saja. Permainan seru yang tersedia seperti Poker, Domino QQ Dan juga BandarQ Online. Semuanya tersedia lengkap hanya di ABGQQ. Situs ABGQQ sangat mudah dimenangkan, kamu juga akan mendapatkan mega bonus dan setiap pemain berhak mendapatkan cashback mingguan. ABGQQ juga telah diakui sebagai Bandar Domino Online yang menjamin sistem FAIR PLAY disetiap permainan yang bisa dimainkan dengan deposit minimal hanya Rp.25.000. DEWI365 adalah Bandar Judi Bola Terpercaya & resmi dan terpercaya di indonesia. Situs judi bola ini menyediakan fasilitas bagi anda untuk dapat bermain memainkan permainan judi bola. Didalam situs ini memiliki berbagai permainan taruhan bola terlengkap seperti Sbobet, yang membuat DEWI365 menjadi situs judi bola terbaik dan terpercaya di Indonesia. Tentunya sebagai situs yang bertugas sebagai Bandar Poker Online pastinya akan berusaha untuk menjaga semua informasi dan keamanan yang terdapat di POKERQQ13. Kotakqq adalah situs Judi Poker Online Terpercayayang menyediakan 9 jenis permainan sakong online, dominoqq, domino99, bandarq, bandar ceme, aduq, poker online, bandar poker, balak66, perang baccarat, dan capsa susun. Dengan minimal deposit withdraw 15.000 Anda sudah bisa memainkan semua permaina pkv games di situs kami. Jackpot besar,Win rate tinggi, Fair play, PKV Games