Page 1 of 1

textwidth

Posted: Wed Mar 31, 2010 11:10 am
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.

Re: textwidth

Posted: Wed Mar 31, 2010 11:32 am
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.

Re: textwidth

Posted: Wed Mar 31, 2010 1:57 pm
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!

Re: textwidth

Posted: Wed Mar 31, 2010 4:14 pm
by l3whmg
Hi Rathinagiri,
I'm very s....d :oops:. Answer to my question is YES, because there is FontSize!
Best Regards