textwidth

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
User avatar
l3whmg
Posts: 694
Joined: Mon Feb 23, 2009 8:46 pm
Location: Italy
Contact:

textwidth

Post by l3whmg »

Hello Rathinagiri,
I'm using a post because my PM box remain in Outbox: I do not know why.

Thank you for your quick response, forgive the delay in my reply, but I was a little busy with the operations for the elections in Italy.

I tried your function but it returns strange values :? . So I tried to emulate your source code: my function is called L3W_TEXTSIZE.

I'm not able to write in C :evil: , so for this reason, I have followed this method: I copied your code and added some things.

The values returned by this function seem more realistic :o (but not necessarily correct ;) ).

In any case, during printing, the strings are not juxtaposed or superimposed. This made me :shock: .

You want to see what my mind has given birth and tell me what you think?

My intention is to get the width of the text, to know which column will begin the next text.

Thank you for your attention.
Attachments
stampa.zip
(2.46 KiB) Downloaded 268 times
Luigi from Italy
www.L3W.it
User avatar
Rathinagiri
Posts: 5482
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: textwidth

Post by Rathinagiri »

Hi Luigi,

In line number 117, you have to replace this.

" nRetLen := ROUND( GetTextWidth( NIL, xString, xFontName)*0.072/72*25.4*xFontSize,2 )"

I don't use any device context of HMG in GridPrint.

The different between yours (with the selected printer device context) and mine (with no device context) is, mine shows always (in any printer) the same width for a given string at a given fontsize in a given font. Where as, yours shows different width for different printers!

I think Roberto can suggest the best one!

FYI, I am using the above method in many printers and GridPrint is working fine.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
l3whmg
Posts: 694
Joined: Mon Feb 23, 2009 8:46 pm
Location: Italy
Contact:

Re: textwidth

Post by l3whmg »

Hi Rathinagiri,
many thanks for you replay and I understand your POV :mrgreen:

Only one question about my solution: is there difference about "width" if I introduce, before calculating, a createfont function with parameters (fontname, fontsize, bold, italic, etc.)?

Best regards!
Luigi from Italy
www.L3W.it
User avatar
l3whmg
Posts: 694
Joined: Mon Feb 23, 2009 8:46 pm
Location: Italy
Contact:

Re: textwidth

Post by l3whmg »

Hi Rathinagiri,
I'm very s....d :oops:. Answer to my question is YES, because there is FontSize!
Best Regards
Luigi from Italy
www.L3W.it
Post Reply