[open] Font size is smaller when experiment is run
I use a sketchpad to display a background image and some textual descriptions on top of it. It all looks nice in the development window, but once I actually run the experiment, all the text is smaller. The text fields appear at the correct location, but do not extend to same place to the right and to the bottom as they should. Is there a way to fix this issue?
I'm on Ubuntu 14.10, using the DejaVu Sans font (I need special characters from it) with the Expyriment back-end since I definitely care about millisecond precision. I tried changing the back-ends just to see if this issue will go away, but I couldn't run any of the other back-ends. The PsychoPy back-end showed an error associated with audio and Legacy could not find the DejaVu Sans.ttf file. In any case, I'd like to resolve the issue and stick to Expyriment.
Any hints are much appreciated.
Comments
Hi,
This is indeed a small bug: In the GUI the font size is specified in points, but during the experiment it is specified in pixels, as it should be.
This is just a visual glitch, so you can safely ignore the fact that the GUI shows the font to be slightly larger (on most systems) than it should be.
Could you provide some more info? What exactly did you do, and where did you place the font file?
Cheers,
Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!
Hi Sebastiaan
Thanks for looking into this.
Do you know if you'll be releasing a fix for this bug with the next maintenance release and if so when might that be? In my particular case, I need to carefully position some text and visual elements with respect to each other. It's quite hard to do so as I have to run the experiment over and over again just to see if things are at the right place, so I would really appreciate the ability to this in the GUI.
I haven't really done anything special for the fonts. The font file is in the default location in Ubuntu (/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf). I just selected "DejaVu Sans" in the general properties of my experiment, and it worked without a hitch with Expyriment. If I change the back-end to legacy in the general properties tab, I get this error message:
It seems like OpenSesame is trying to use the wrong file name (has an extra space). Is there something special that needs to be done before that font works with Legacy? In any case, as I mentioned I don't really want to use Legacy, but I'm willing to help diagnose this problem if you wish.
Cheers,
Mitko
Thanks for the error message. That does indeed look like another font-related bug.
I will include these fixes in 2.9.3, which I'll probably release somewhere in the next few weeks. These are actually the first new bugs that have been reported, and I generally wait until there's a bit more before building a new release. If you want to fix the size issue before then, you consider grabbing the latest snapshot from GitHub (the
heisenbergbranch). Even just replacing yourlibqtopensesame/misc/sketchpad_canvas.pycwith the updated file should do the trick:Cheers!
Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!
Hi Sebastiaan,
Thank you very much for the suggested fix. I replaced the python files and now the disparity between the GUI and the running experiment is greatly reduced. The current state is sufficient for my needs.
In case you want to dig deeper into this to achieve a perfect match between the sketchpad GUI and the rendering during a run, have a look at this image to see the differences that I am currently seeing:
The part on the top is the GUI and the one on the bottom is the running experiment in a window (running in a full screen has the same issue).
The little red lines are sketchpad arrows and as you can see, they are identically positioned in both cases. Relative to them, the text position/size does not quite match. I hope this helps.
Thanks for your support.
Cheers,
Mitko
Hi Mitko,
The GUI uses a different font engine than the back-ends, each of which in turn renders text slightly differently. I just tried it with a few different fonts, and, indeed, for some reason Deja Vu Sans is rendered much narrower during the experiment than in the GUI. Much more so than other fonts, which is weird. But as far as I can tell, it's a genuine difference between the font engines.
Cheers,
Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!