Page 1 of 1

[Done] Printer bug in V4.40

Posted: Tue Jan 12, 2010 5:03 pm
by dangerfreak
This little program works fine with PB version 4.31 (windows x86, windows xp and windows 7), but it doesn't with version 4.40:

; ---------------------------------------------------------
Define printer.l
LoadFont(0,"Courier New",48)
printer=PrintRequester()
If StartPrinting("Document")
If StartDrawing(PrinterOutput())
DrawingFont(FontID(0))
DrawText(100,100,"PB4.40 (Windows X86) doesn't print this text, just a black rectangle")
DrawText(100,100,"However, PB4.31 works fine. Must be a bug in V4.40.")
StopDrawing()
StopPrinting()
EndIf
EndIf
; ---------------------------------------------------------

Independent of the printer or the operating system, version 4.40 just prints a black rectangle.

Re: Printer bug in V4.40

Posted: Tue Jan 12, 2010 6:28 pm
by Marco2007
....seems like the default backcolor is black, 'cause this works:

Code: Select all

Define printer.l
LoadFont(0,"Courier New",48)
printer=PrintRequester()
If StartPrinting("Document")
  If StartDrawing(PrinterOutput()) 
  BackColor(#White)
  DrawingFont(FontID(0)) 
  DrawText(100,100,"PB4.40 (Windows X86) doesn't print this text, just a black rectangle")
  DrawText(100,100,"However, PB4.31 works fine. Must be a bug in V4.40.") 
  StopDrawing()
  EndIf 
StopPrinting()  
EndIf

Re: Printer bug in V4.40

Posted: Tue Jan 12, 2010 7:08 pm
by dangerfreak
Cool, you are right, that's the solution. Thanks a lot!

Re: Printer bug in V4.40

Posted: Tue Jan 12, 2010 7:51 pm
by Rook Zimbabwe
ABBKlaus also has written a few interesting tools to help with printer use: http://www.purebasicpower.de/?PrinterLib

I use this in my application! It is incredibly helpful! :D

Re: Printer bug in V4.40

Posted: Tue Jan 19, 2010 12:02 am
by harkon
So, does anyone know why this would have changed from version 4.3 to version 4.4? Seems to me that, for a printer anyway, the default backcolor should always be assumed white :?

Re: Printer bug in V4.40

Posted: Tue Jan 19, 2010 12:27 am
by Rook Zimbabwe
The actual change log is probably somewhere in the PB website but in PB4.4 you see this:

Result = DrawText(x, y, Text$ [, FrontColor [, BackColor]])

Same as 4.3

WOW that was incredibally unhelpful... sorry...
(I really though it would be different since the notices about the remod of the draw system have been all over!) :D

I can only assume the system populated frontcolro as black since that would be a 0 value and backcolor as 0 since likewise that would be a 0 value and if you do not specify any value those are set at 0 as a default.

Re: Printer bug in V4.40

Posted: Tue Jan 19, 2010 12:35 am
by harkon
That's probably a safe assumption, or it'll be something of that nature. The problem comes in where old code gets broken with the update to a new version. Silly stuff like this can take hours to find and debug.

Anyway, I know it's a lot of work for the development team and I do appreciate it, but stuff gets really frustrating.

/rant

I think it wise to stick to ABBKlaus' PrinterLib for printing.

Re: Printer bug in V4.40

Posted: Tue Jan 19, 2010 12:51 am
by netmaestro
2DDrawing is completely overhauled for v4.40. Here is the relevant doc:
PB Doc for DrawingMode() wrote: #PB_2DDrawing_Transparent

If this flag is set then the background will be transparent with the DrawText() command

Re: Printer bug in V4.40

Posted: Tue Jan 19, 2010 4:19 pm
by harkon
Thanks.

I understand the complete overhaul part, and I did not intend to throw stones at the development team. It is clear to me that changing something of this magnitude is not accomplished without a great deal of effort on their part. It would have been great if it could have been done without breaking existing code, but I understand that this is not always easy or even possible, and sometimes things just get overlooked. Such is life I suppose. :wink: Setting the transparent flag should avoid trouble for printing then. :)

Re: Printer bug in V4.40

Posted: Tue Jan 19, 2010 5:29 pm
by Demivec
harkon wrote:So, does anyone know why this would have changed from version 4.3 to version 4.4? Seems to me that, for a printer anyway, the default backcolor should always be assumed white :?
From what I understand, historically the backcolor was always supposed to be black, it just had been left uncorrected for so long (I was unable to find a source quote to confirm this).

Re: Printer bug in V4.40

Posted: Tue Jan 19, 2010 6:39 pm
by harkon
That would explain it. Thanks.

Re: Printer bug in V4.40

Posted: Sun Jan 31, 2010 10:14 am
by Little John
I just stumbled across the same problem.
netmaestro wrote:2DDrawing is completely overhauled for v4.40. Here is the relevant doc:
PB Doc for DrawingMode() wrote: #PB_2DDrawing_Transparent

If this flag is set then the background will be transparent with the DrawText() command
Wouldn't it be better to make #PB_2DDrawing_Transparent the default background setting for DrawText()? I think this is what most people probably are expecting intuitively.

Regards, Little John

Re: Printer bug in V4.40

Posted: Sun Jan 31, 2010 8:42 pm
by freak
fixed.

Re: [Done] Printer bug in V4.40

Posted: Sun Jan 31, 2010 9:23 pm
by blueznl
Fixed means in this case... ?

Re: [Done] Printer bug in V4.40

Posted: Sun Jan 31, 2010 10:02 pm
by freak
The default FrontColor is now white, as it is with the other subsystems.