Words are not horizontally aligned in word-by-word display

Hi everyone!
I am trying to present the words in sentences word-by word at the centre of the screen. it works well but I noticed that the centred words are not horizontally aligned because the text bounds are different for words (e.g, “one” and “fog” have different heights) so when display words at the centre, it looks like the words are jumping around.
So how I can fix the problem to make the words are aligned at the letter bottom line?
I am also attching the current function for drawing centred text here.
Many thanks in advance!

function drawcenteredtext_dot(w,str,x,y,color,textsize)

str=double(str);
oldsize=Screen('TextSize',w,textsize);
drect=Screen('TextBounds',w,str);

sx=x-drect(3)/2;
sy=y-drect(4)/2;
Screen('DrawText',w,str,sx,sy,color);
Screen('TextSize',w,oldsize);

I’m not sure what you mean by not horizontally aligned, given that only one word is shown in each image as far as I understand your task, but if you meant “not vertically at the same height”, ie. it is jumping up and down a bit depending on the word and the height of the letters in it, that is what functions like DrawFormattedText() are for, cfe. DrawFormattedTextDemo.m. Or use of the ‘yPositionIsBaseline’ flag in Screen DrawText to make sure that y position specifies the vertical baseline position of the text, instead of the top position of the tallest glyph.