Page 1 of 2
PRINT Subsystem
Posted: Wed Oct 21, 2009 7:22 am
by mol
I want to conditionally print text in BOLD
I think, using
is not possible to parameterise to print text bolded or not.
So, I decided to use
_HMG_PRINTER_H_PRINT function, which I found in
hmg\include\i_print.ch[\b]
when BOLD/UNDERLINE are given as boolean parameter.
Code: Select all
#xcommand @ <Row> , <Col> PRINT [ DATA ] <cText> ;
[ <lfont : FONT> <cFontName> ] ;
[ <lsize : SIZE> <nFontSize> ] ;
[ <bold : BOLD> ] ;
[ <italic : ITALIC> ] ;
[ <underline : UNDERLINE> ] ;
[ <strikeout : STRIKEOUT> ] ;
[ <lcolor : COLOR> <aColor> ] ;
[ <align:CENTER,RIGHT> ] ;
=> ;
_HMG_PRINTER_H_PRINT ( _HMG_SYSDATA \[ 374 \] , <Row> , <Col> , <cFontName> , <nFontSize> , <aColor>\[1\] , <aColor>\[2\] , <aColor>\[3\] , <cText> , <.bold.> , <.italic.> , <.underline.> , <.strikeout.> , <.lcolor.> , <.lfont.> , <.lsize.> , <"align"> )
I 've get printed phrase, but without polish national characters
Where the the conversion is done?
Can sb. help me?
Maybe another idea for bold/non bold print?
PS. Finally I can use
Code: Select all
if lBold
@ prow, pcol print cText BOLD
else
@ prow, pcol print cText BOLD
endif
but, IMHO, it doesn't look good and extens source code twice
Re: PRINT Subsystem
Posted: Wed Oct 21, 2009 1:12 pm
by Roberto Lopez
mol wrote:I want to conditionally print text in BOLD
I think, using
is not possible to parameterise to print text bolded or not.
So, I decided to use
_HMG_PRINTER_H_PRINT function, which I found in
hmg\include\i_print.ch[\b]
when BOLD/UNDERLINE are given as boolean parameter.
Code: Select all
#xcommand @ <Row> , <Col> PRINT [ DATA ] <cText> ;
[ <lfont : FONT> <cFontName> ] ;
[ <lsize : SIZE> <nFontSize> ] ;
[ <bold : BOLD> ] ;
[ <italic : ITALIC> ] ;
[ <underline : UNDERLINE> ] ;
[ <strikeout : STRIKEOUT> ] ;
[ <lcolor : COLOR> <aColor> ] ;
[ <align:CENTER,RIGHT> ] ;
=> ;
_HMG_PRINTER_H_PRINT ( _HMG_SYSDATA \[ 374 \] , <Row> , <Col> , <cFontName> , <nFontSize> , <aColor>\[1\] , <aColor>\[2\] , <aColor>\[3\] , <cText> , <.bold.> , <.italic.> , <.underline.> , <.strikeout.> , <.lcolor.> , <.lfont.> , <.lsize.> , <"align"> )
I 've get printed phrase, but without polish national characters
Where the the conversion is done?
Can sb. help me?
Maybe another idea for bold/non bold print?
PS. Finally I can use
Code: Select all
if lBold
@ prow, pcol print cText BOLD
else
@ prow, pcol print cText BOLD
endif
but, IMHO, it doesn't look good and extens source code twice
Calling the command or the function should not make a difference regarding national characters.
The only difference is that the command is translated by Harbour preprocessor (the function is not).
I've 'propertized' most commands via alternate versions.
I must to do with print commands too.
I've put in my TODO list (I want to fine-tune 3.0 first).
Regards,
Roberto.
Re: PRINT Subsystem
Posted: Thu Oct 22, 2009 5:40 am
by mol
It's nice, you will work on it.
But now, where to place conversion to reach polish characters on printed page?
Re: PRINT Subsystem
Posted: Thu Oct 22, 2009 11:35 am
by Roberto Lopez
mol wrote:It's nice, you will work on it.
But now, where to place conversion to reach polish characters on printed page?
As I've said, the difference between the two situations you describe is that the command is translated by the Harbour preprocessor and the function not.
But I'm not really sure wich is the reason to that to happen.
I use Spanish language characters in commands and functions parameters and I haven't any problem with that...
Regards,
Roberto.
Re: PRINT Subsystem
Posted: Thu Oct 22, 2009 12:00 pm
by mol
I wanna put two lines of code and capture of screen from print preview to illustrate different effects:
Code: Select all
_HMG_PRINTER_H_PRINT ( _HMG_SYSDATA[ 374] , 250, 55 , "ARIAL CE", ;
12, 0,0,0,;
"Należność ogółem:",;
.t., .f., .t.,.f. ,BLACK , "ARIAL CE", 12, "RIGHT" )
@ 270, 55 print "Należność ogółem:";
FONT "ARIAL CE" ;
SIZE 12 ;
UNDERLINE BOLD ;
COLOR BLACK RIGHT
and print preview:
It's interesting, that size of these lines are different. Whre an error may be placed?
Marek
Re: PRINT Subsystem
Posted: Thu Oct 22, 2009 12:18 pm
by Roberto Lopez
mol wrote:I wanna put two lines of code and capture of screen from print preview to illustrate different effects:
Code: Select all
_HMG_PRINTER_H_PRINT ( _HMG_SYSDATA[ 374] , 250, 55 , "ARIAL CE", ;
12, 0,0,0,;
"Należność ogółem:",;
.t., .f., .t.,.f. ,BLACK , "ARIAL CE", 12, "RIGHT" )
@ 270, 55 print "Należność ogółem:";
FONT "ARIAL CE" ;
SIZE 12 ;
UNDERLINE BOLD ;
COLOR BLACK RIGHT
and print preview:
It's interesting, that size of these lines are different. Whre an error may be placed?
Marek
This is an interestiing puzzle, but I can't give you an aswer right now...
Could be you so kind to package it in a working small sample?
TIA.
Regards,
Roberto.
Re: PRINT Subsystem
Posted: Thu Oct 22, 2009 6:21 pm
by mol
I'll prepare a little sample tomorrow.
Best regards, Marek
Re: PRINT Subsystem
Posted: Fri Oct 23, 2009 8:52 am
by mol
Trying to resolve problem, I've prepared a sample.
It's very strange, but I get different results with different printers:
I've got a few printers istalled in my system:
LaserJet 2100 - generates strange characters in first printed lines
LaserJet P2015 - good
Xerox Phaser 6110MFP - good
PDFCreator - good
Samsung SPP2020 - good
I've changed driver of LaserJet 2100 - for LaserJet 1100 (MS) - and polish characters look good in the whole document.
If anyone use national characters and want to do some tests - please compile this code and try.
And last- size of printing lines is different - where the error may be placed?
Code: Select all
#include <minigui.ch>
***********************************
* Little test for printing national characters
* Marek Olszewski 2009.10.23
***********************************
function MAIN
local i
private cPrinter, aPrinters
SET LANGUAGE TO POLISH
aPrinters := aPrinters()
DEFINE WINDOW MainForm ;
AT 0,0 ;
WIDTH 500 ;
HEIGHT 300 ;
MAIN;
TITLE 'Testing printing national characters on different printers'
@ 20,70 LABEL L1 Value "Printer name"
@ 40,70 COMBOBOX PrinterNumber WIDTH 270 HEIGHT 200 ITEMS aPrinters On Enter TestPrint()
@ 100,70 CHECKBOX PrintPreview CAPTION "Preview on the screen" VALUE .T. WIDTH 200
@ 200, 380 BUTTON B_Cancel CAPTION "ESC - CANCEL" WIDTH 100 HEIGHT 28 ;
ACTION MainForm.Release
@ 200,200 BUTTON B_TestPrint Caption "&Test print" WIDTH 100 HEIGHT 28 ;
ACTION TestPrint()
END WINDOW
CENTER WINDOW MainForm
//set pointer to default printer
MainForm.PrinterNumber.Value := ascan(aPrinters, GetDefaultPrinter())
on key escape of MainForm action MainForm.Release
ACTIVATE WINDOW MainForm
return
*---------------
function TestPrint
local cPrinter
if MainForm.PrintPreview.Value == .t.
// preview on the screen
SELECT PRINTER aPrinters [ MainForm.PrinterNumber.Value ];
ORIENTATION PRINTER_ORIENT_PORTRAIT ;
PAPERSIZE PRINTER_PAPER_A4 ;
QUALITY PRINTER_RES_MEDIUM ;
PREVIEW
else
SELECT PRINTER aPrinters [ MainForm.PrinterNumber.Value ];
ORIENTATION PRINTER_ORIENT_PORTRAIT ;
PAPERSIZE PRINTER_PAPER_A4 ;
QUALITY PRINTER_RES_MEDIUM
endif
START PRINTDOC name "Testing polish characters"
START PRINTPAGE
_HMG_PRINTER_H_PRINT ( _HMG_SYSDATA[ 374] , 20, 105 , "ARIAL CE", ;
12, 0,0,0,;
"Here I try polish characters: ąćęłńóśżź ĄĆĘŁŃÓŚŻŹ via _HMG_PRITER_H_PRINT",;
.t., .f., .f.,.f. ,BLACK , ,, "CENTER")
@ 30, 105 print "Here I try polish characters: ąćęłńóśżź ĄĆĘŁŃÓŚŻŹ via @ prow,pcol PRINT";
FONT "ARIAL CE" ;
SIZE 12 ;
BOLD ;
COLOR BLACK ;
CENTER
END PRINTPAGE
END PRINTDOC
MainForm.PrinterNumber.SetFocus
return
*-----------------
Re: PRINT Subsystem
Posted: Fri Oct 23, 2009 12:56 pm
by Roberto Lopez
mol wrote:Trying to resolve problem, I've prepared a sample.
It's very strange, but I get different results with different printers:
I've got a few printers istalled in my system:
LaserJet 2100 - generates strange characters in first printed lines
LaserJet P2015 - good
Xerox Phaser 6110MFP - good
PDFCreator - good
Samsung SPP2020 - good
I've changed driver of LaserJet 2100 - for LaserJet 1100 (MS) - and polish characters look good in the whole document.
If anyone use national characters and want to do some tests - please compile this code and try.
And last- size of printing lines is different - where the error may be placed?
The important question is: With the original LaserJet 2100 driver and using print command (instead functions) the print is ok?
I want to know if the issue is related to a specific driver or the preprocessor.
Anyway, please, coonsider that _hmg_printer_* functions are INTERNAL and are not intended to be used directly, so if the commands works ok, there is no a true problem.
Regards,
Roberto.
Re: PRINT Subsystem
Posted: Fri Oct 23, 2009 1:02 pm
by Roberto Lopez
Roberto Lopez wrote:
Anyway, please, coonsider that _hmg_printer_* functions are INTERNAL and are not intended to be used directly, so if the commands works ok, there is no a true problem.
And, I'm working on 'propertization' of print commands.
I hope to be ready for the next test build.
Regards,
Roberto.