Click here to Skip to main content
15,884,472 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Using drawtext function how can we draw a string with each character of same width.

For Eg:
Sushant |Mandhare
Prashant |ABCXYZP

if both the above strings are of same length,since width of each character is different im not getting the separator one below the other
Posted

1 solution

If you use a proportional font (which is the default and really, most of them) then you will see this effect. If you want the characters to line up on multiple lines without a lot of fuss, you need to use a non-proportional font, where each character is the same width. A couple of examples on Microsoft machines are "Courier" and "Lucida Console".

There are other solutions as well (eg. set and use tabs).
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900