Howdy, Stranger!

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

Supported by

Different custom fonts paired with stimuli

Hi everyone,

First, thank you for this great program. I am very new to it; so nowadays I am bothering the forum a lot, and it really helps, thank you for that too. But I still have some struggles...

So I went through all the documentation and discussions I could find for the custom fonts. I have two fonts that I want to use, they are in the file pool and I am able to pull one off for one condition. However, I need to present two different fonts for two different conditions. The thing is:

My sketchpad is able to take a picture paired with one font. In the other condition, it takes the different picture as it should, but the font doesn't change. I couldn't figure out how to tell the sketchpad and make it pull a "font" variable from the trial_sequence table. Can I do that? Ah, I also want to do the same thing with different colors. Also, this is going to be online experiment, so these fonts should be somehow embedded into it, so that everyone can see in their own computer... Would it work?

Best,

Hülya

Comments

  • Hi Hülya,

    Not sure why the sketchpad wouldn't be able to adjust the font on a trial by trial basis. Perhaps it helps if you embed the text that you want to show in html syntax? Normally this is more powerful and flexible that the standard Opensesame commands. See here for more info: https://osdoc.cogsci.nl/3.3/manual/stimuli/text/

    Eduard

    Buy Me A Coffee

  • Hi Eduard,

    Thank you so much for your answer!

    I am trying the HTML solutions in the link you sent...but probably since I am too new to that too, seems like I am doing something wrong. The code goes as follows: (I am trying to take that "font" variable from my loop table...)

    set duration 0

    set description "Displays stimuli"

    draw textline center=1 color="#000000" font_bold=no font_family="[font]" font_italic=no font_size=24 html=yes show_if=always text="[Intro]" x=-13 y=84 z_index=0

    <span style='font-family:"[font]";'>Font style</span>


    But then, when I say "apply" the span tag that I am trying to add magically disappears like I did no change at all (without giving an error). Probably I am doing something wrong while typing it...I would be very happy for the help!

    Best,

    Hülya

  • Hi,

    the line <span style='font-family:"[font]";'>Font style</span>has to be embedded in text, you can't just drop it in the script part of the sketchpad. So, if you replace the ">Font Style<" with ">[Intro]<" and copy then the entire line as value to the text keyword, it could work. Something like this:


    draw textline center=1 color="#000000" font_bold=no font_family="[font]" font_italic=no font_size=24 html=yes show_if=always text="<span style='font-family:"[font]";'>[Intro]</span>" x=-13 y=84 z_index=0


    Eduard

    Buy Me A Coffee

  • edited May 18

    Hi,

    Oh. Sorry that I needed to make you explain a very silly thing :')

    However now I am doing the exact same thing you suggested, and still no change. Might it be caused by my font files? They are .ttf , and they are both defined in the table with their extensions under their title. They are also in the file pool...

    NOOOO I did it!! I don't know how to delete the comment so I am editing it - Ok. Apparently I shouldn't have written their extensions in the table! I thought they would work like an image. Now it works! Thank you a bunch Eduard!

    Best,

    Hülya

  • Great! Cool.

    Buy Me A Coffee

  • Hi Eduard,

    Sorry to revive this. I am just having a simple problem: when running in browser, my colors or fonts does not work. They run smoothly in OpenSesame though. Should I translate the HTMLs to JavaScript somehow?

    Best,

    Hülya

  • Hi Hülya,

    Mh, that is annoying. Do you have an error message that goes with this? I doubt that you would need to translate html to javascript. My guess would be that the fonts are for some reason not available or something? If you have an error message or can provide more details on your experience, we might be able to pinpoint the issue.

    Eduard

    Buy Me A Coffee

  • Hi Eduard,

    Sorry for unresponsiveness!

    I was not getting any error... though yes you were right, I did not need to translate anything. I tried writing them again as variables and such and somehow it was fixed: maybe some kind of a typing error I have made.

    Thanks a lot,

    H

  • Hi Eduard,

    Sorry to revive. I am not sure if I should have asked this in JATOS title but the problem is with the fonts again. While they work in my computer, either with the JATOS link, or "Run in browser", or OpenSesame itself - they do not work in other computers. We checked one console and we have this error:

    "Refused to execute script from '.....' because its MIME type ('application/js') is not executable, and strict MIME type checking is enabled"

    I did a little bit of research and it seems like this might be due to browsers? I am not sure, I really don't know anything about HTMLs or JavaScripts. Can I do something about it beforehand, like an inline_java or something in the beginning?

    Best,

    H

  • Hi Hülya,

    I unfortunately don't know much about HTML or Javascript myself, but if this is browser specific, could you not require your participants to use specific browsers? @kri Have you seen this error before? Is it something that Jatos settings can help with?

    Thanks,

    Eduard

    Buy Me A Coffee

  • Hi Hülya, Hi Eduard,

    From how I understand the error message (and from what Google tells me) it means that you try to load and run a file that has a MIME type that is actually not executable. I'm not an expert in MIME types, but according to this list here (https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types) 'application/js' seems to not exist. I assume you want to run a JavaScript file and this should have the MIME type 'text/javascript'. Is this possible? Do you somewhere specify 'application/js'?

    Best,

    Kristian

    Buy Me A Coffee

  • Hi,

    Wow, @kri

    I honestly have no idea. I nenver specified any such thing in the experiment, and all the custom fonts I had were .ttf from Google Fonts. All the other kind of texts were written in sketchpad item, sometimes with HTML tags but as simple as a <br>. So honestly there is nothing I am trying to run as a js file, there is only one inline_javascript but this error comes when we tried with the fonts, and without them we didn't get any.

    @eduard , I don't think it is browser specific because we tried in many and couldn't succeed...

    Anyway, at last, I decided to get rid of the fonts but I thought you might be interested in such an error or things like that for future issues maybe...

    Thank you both!

    Best,

    H

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