Width of single character on screen

Dear all,

I am on Win10, running PsychToolbox Version 3.0.16, Octave 5.1.

What I am trying to do is find out how wide in pixels a character for a monospaced font is on my screen, using Screen(‘TextBounds’).

I have tried the following:

[vm, vr] = Screen(‘OpenWindow’, const.mainScreen, visual.white);
window = Screen(‘MakeTexture’, vm, visual.white(1)*ones(vr(RectBottom),vr(RectRight)));
LetterRect = Screen(‘TextBounds’, window, ‘g’)
0.00000 0.00000 12.01562 16.00000
LetterRect = Screen(‘TextBounds’, window, ‘gh’)
0.00000 0.00000 25.81250 20.00000
LetterRect = Screen(‘TextBounds’, window, ‘ghj’)
0.00000 0.00000 36.18750 22.00000
LetterRect = Screen(‘TextBounds’, window, ‘g h’)
0.00000 0.00000 39.81250 20.00000

As far as I understand, with a monospaced font, the third value of the output divided by the number of characters should give the character width - which should be the same for all characters - but the numbers don’t add up correctly. Does this have something to do with the properties of the window I’m using?

I would appreciate any input on this issue.

Best,
Dario

I’m not completely sure, but i think that monospace only means that the xAdvance (fourth return param of TextBounds) is constant per character. An i could still be narrower than an m in terms of ink used.