I am running rofi with a custom script I made which you can find here.
# Get memory status.
(sorry it's not cropped)
getoutput from the program manually:
Inserting the awk code like this:
z=0;
printf "Memory: [";
while(++z < $3/200000) printf " ";
printf "]\n";
and replacing $3 with $2 and ($3 - $2), it prints the correct number of spaces (in rofi and in the terminal). The first instance still prints the wrong amount
Rofi does nothing with the string and passes it directly to pango.
Is the alignment correct (when using same font/size) in programs like gedit?
Sorry for the late response. It does not show properly in gedit.

Then it sounds like an upstream pango bug and not a rofi issue as gedit also uses pango for rendering.
based on #977 assume this is fixed upstream. please let me know if not.
It seems pango switched rendering engine for fonts.
https://gitlab.gnome.org/GNOME/pango/issues/386 causing some issues.
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.