Howdy, Stranger!

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

Supported by

rendering unicode symbols in sketchpad

edited August 2017 in OpenSesame

Hi all,

I need to render these 4 unicode symbols (or similar ones) in a sketchpad: a black circle, a star, a square, and a different start.

for example, in python I can use:
print(u'\u25CF')
for the black circle

However, when I try to represent a Unicode symbol (both loaded from a variable or a csv file) in a sketchpad it is not rendered correctly and I get always an empty square (something like []) indicating a problem in the encoding. I’ve tried to set the font to: mono, serif, arial, …

For example, if I put this line in the preparation phase of a inline script before the sketchpad (that has [mytext] as a pointer for the variable):

exp.set("mytext", u'\u25CF')

I get the empty square rendered in the sketchpad.

The only case that is working, is when I add the special characters in openoffice (openOffice>Insert>Special Character> Wingdings) as wingdings and then I set the sketchpad font to wingdings. Unfortunately, this generates a very "unstable" csv file: sometimes the changes stay, sometimes they disappear… a big mess!

Any solution? Of course, I could generate 4 images with these symbols, but I’m surprised that opensesame cannot render it correctly.

Thanks a lot for your help!

Best,

Diego

Comments

  • Hi Diego,

    Unicode is a standard that describes which visual characters correspond to which character codes. So it refers to something very specific, and not just to anything that is not a regular ASCII character.

    WingDings is not a Unicode font, which means that a character that is (say) a star with WingDings is something completely different with another font (or perhaps even undefined, in which case you get an empty square, a question mark, or some other placeholder character). Does that make sense?

    To be honest, I'm not entirely sure what happens if you try to use WingDings in OpenSesame. But I wouldn't go there, and just use bitmaps.

    Cheers,
    Sebastiaan

  • Hi Sebastiaan,

    the problem is that even using Unicode fonts (like u'\u25CF') gives me the same problem. I was using Wingdings as a possible solution to that.

    Cheers,

    Diego

  • edited August 2017

    Hi Diego,

    Right, 0x25CF is indeed a valid Unicode character (a filled circle). If you enter this into a sketchpad, for example by entering it as Python expression, and select a font that actually contains this character, then you will see it.

    If you don't see it, this means that the selected font simply doesn't contain the character. Most modern programs deal with this by falling back to another font that does contain the character, so you don't notice this. But the current font renderer used by OpenSesame doesn't do this. Does that make sense?

    So you need to specify a valid Unicode character and select a font that actually contains this character—that's all. In the case of the black circle, it is defined for example in Arial.

    Cheers,
    Sebastiaan

  • That's cool!

    Last question: if I want to pass the unicode value using a variable created in a previous inline script like:

    exp.set("mysymbol", u'\u25CF' ")

    if in the sketchpad I use the variable pointer [mysymbol], it will print on the screen just the code u'\u25CF' (without interpreting it). What am I doing wrong?

    Cheers,

    Diego

  • Your example is not syntactically valid Python, but if you fix the quotes it should work just fine. By the way, are you running an up-to-date version of OpenSesame? I'm asking because the exp.set() method of setting variables has been deprecated for a while now. (If not, I would update.)

    This should do the trick:

    var.mysymbol = u'\u25CF'
    
  • Awesome, thanks a lot!

    Yes, I'm using an old version because I know it works just fine. :)

    Thanks a lot for your help

    Diego

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 http://45.77.173.118/ 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