Howdy, Stranger!

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

Supported by

Custom Fonts From The File Pool

Hi all,

I need to use a custom font for my experiment which I want to place in the File Pool so the experiment is portable and I don't need to ask the IT Department to get involved! However OpenSesame won't use any font I place in the File Pool.

I have made sure the font is TTF and have used the syntax from here, namely:

draw textline 0.0 0.0 "This will be inconsolata" font_family="inconsolata"

But still no joy. The font works fine when I install it and select it from the Font Selection Dialogue, so I know the font itself is fine, so it must be OpenSesame or my code! I have tried the same thing on both Windows and Mac, and have installed the latest version of OS to no avail.

The code in question is below, with a screenshot attached showing the File Pool contents.

draw textline center=1 color=Black font_bold=no font_family="Open" font_italic=no font_size=50 html=yes show_if=always text="Test using file pool font" x=0 y=-128 z_index=0

Any assistance would be really appreciated, I need to start running my experiment ASAP and this is the last thing in the way! 😥

Thanks all, Rich

Comments

  • Hi Rich,

    Thanks for bringing this to our attention. It's a bug that was introduced with the new text-rendering system in OpenSesame 3.2. We'll fix this in an upcoming maintenance release. But for now, you can register your font (from the file pool) with a script like the one below. This script needs to be put in the prepare phase of an inline_script item at the start of the experiment.

    from qtpy.QtGui import QFontDatabase
    from openexp._canvas._richtext import richtext
    
    font = 'test' # The name of the font in the pool, without .ttf
    
    # Register the font with OpenSesame
    fdb = QFontDatabase()
    font_id = fdb.addApplicationFont(pool[font + '.ttf'])
    print('font_id = {}'.format(font_id))
    font_families = fdb.applicationFontFamilies(font_id)
    print('font_families = {}'.format(font_families))
    richtext.font_substitutions.append((font_families[0], font))
    

    Hope this helps!

    Sebastiaan

  • Hi Sebastian, thank you for your help.

    I put that code in but the experiment crashes now, throwing a python error.

    If I comment out all lines from "fdb = ..." downwards then the experiment runs. But as soon as "fdb = ..." is allowed to run, python crashes.

    It's the same on Windows and Mac. Any idea how to get round this?

    Many thanks,

    Rich

  • I would also be interested in solving this issue.

    Thank you,

    Emma

  • Hi @Emma and @Richie ,

    If this crashes, then I suggest to, as a temporary workaround, either install the fonts on the systems that you will use, or render the text as bitmaps. That's not ideal, but it should be doable. And, as I said above, for the next maintenance release this issue should be fixed!

    Cheers!

    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 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