Click here to Skip to main content
15,891,513 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to understand or more over figure it out how it works.

Here is an example what I am trying to achieve:

A printing area with height 5mm and width 20mm.
Now my target is to print a text that will stretched enough to fill 5mm and 20mm area.

I need to create a function or set of functions that will help me to determine the proper height and width of a font.

Any suggestion?
Posted

1 solution

My first idea would be to select an appropriate font according to the height of your box and render the text into a memory bitmap. It probably has not the desired width, as you can't influence the aspect ratio of the font. Then in a second step compute the required horizontal stretching/compression factor and stretchblt the memory bitmap into your display area.
 
Share this answer
 
Comments
Mohibur Rashid 22-Nov-13 5:21am    
Not a good idea but I will keep in mind, i wrote a set of functions, they work fine with display but fail with printer. Not the suggested way. Its just a way of setting font width and see if it match the width

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