Dear Sirs,
After applying your new PrintLen....
PrintLen on Test
Moderator: Rathinagiri
Re: PrintLen on Test
- Attachments
-
- the PrintLen value... Pixel ? mm ?
- testfontwidth on Microsoft XPS Document Writer.JPG (86.86 KiB) Viewed 4256 times
Just Hmg It !
Re: PrintLen on Test
Dear Masters,
Till now I am still struggling with the correct string width printed by the PRINT DATA command, Anyone pls help !
TIA....
best rgds,
Chang
Till now I am still struggling with the correct string width printed by the PRINT DATA command, Anyone pls help !
TIA....
best rgds,
Chang
Just Hmg It !
- dragancesu
- Posts: 926
- Joined: Mon Jun 24, 2013 11:53 am
- DBs Used: DBF, MySQL, Oracle
- Location: Subotica, Serbia
Re: PrintLen on Test
Each font is defined by the need to know the size, height and width character
example
PRIVATE cFontName: = "Courier", nFontSize: = 10, nFontHeight: = 5, nCharWidth = 2.5
and then it is easy
example
PRIVATE cFontName: = "Courier", nFontSize: = 10, nFontHeight: = 5, nCharWidth = 2.5
and then it is easy
Re: PrintLen on Test
Thanks Mr. Dragancesu,
According to the syntax, i provide fontname, fontsize, fontattribute( B, I or U).
I dont understand how to define the nFontHeight and nCharWidth that related to
fontname and fontsize. Can you pls give me some advise or sample ?
TIA
best rgds,
Chang
According to the syntax, i provide fontname, fontsize, fontattribute( B, I or U).
I dont understand how to define the nFontHeight and nCharWidth that related to
fontname and fontsize. Can you pls give me some advise or sample ?
TIA
best rgds,
Chang
Just Hmg It !
- dragancesu
- Posts: 926
- Joined: Mon Jun 24, 2013 11:53 am
- DBs Used: DBF, MySQL, Oracle
- Location: Subotica, Serbia
Re: PrintLen on Test
No table for it, print out and measure it
(might have but not looking)
when look:
Java have font functions https://docs.oracle.com/javase/tutorial ... gtext.html
but for display (pixel) and you need for print (mm)
(might have but not looking)
when look:
Java have font functions https://docs.oracle.com/javase/tutorial ... gtext.html
but for display (pixel) and you need for print (mm)
Re: PrintLen on Test
Dear Masters and Mr. Rathinagiri,
Thanks for the your printlen function.
I experimented and modified your printlen function,
and the result,
it works but not perfectly, esp with the fontsize 8, any suggestions ?
Thanks for the your printlen function.
I experimented and modified your printlen function,
Code: Select all
function printLen( cString, nFontsize, cFontname)
cCreateFont := _HMG_CREATEFONT( OpenPrinterGetDC(), cFontname, nFontSize )
nGetTextWidth := gettextwidth( OpenPrinterGetDC(), cString, cCreateFont )
nWidth := nGetTextWidth * 25.4 / 600
RETURN( ROUND( nWidth, 2))
*- return round( nGetTextWidth * 0.0254 * nFontsize, 2 )
Just Hmg It !
Re: PrintLen on Test
But on Epson L210 Color Printer, the formula should be :
nWidth := nGetTextWidth * 25.4 / 360
Now, my question is :
1. How to get the printer name selected ?
2. How the number 600 ( for HP LaserJet) or 360 ( Epson Color Printer) related to printer resolution ?
TIA
nWidth := nGetTextWidth * 25.4 / 360
Now, my question is :
1. How to get the printer name selected ?
2. How the number 600 ( for HP LaserJet) or 360 ( Epson Color Printer) related to printer resolution ?
TIA
Just Hmg It !