[Done] Printer bug in V4.40

Just starting out? Need help? Post your questions and find answers here.
dangerfreak
User
User
Posts: 80
Joined: Tue Jan 12, 2010 4:56 pm

[Done] Printer bug in V4.40

Post 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.
Marco2007
Enthusiast
Enthusiast
Posts: 648
Joined: Tue Jun 12, 2007 10:30 am
Location: not there...

Re: Printer bug in V4.40

Post 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
PureBasic for Windows
dangerfreak
User
User
Posts: 80
Joined: Tue Jan 12, 2010 4:56 pm

Re: Printer bug in V4.40

Post by dangerfreak »

Cool, you are right, that's the solution. Thanks a lot!
User avatar
Rook Zimbabwe
Addict
Addict
Posts: 4322
Joined: Tue Jan 02, 2007 8:16 pm
Location: Cypress TX
Contact:

Re: Printer bug in V4.40

Post 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
Binarily speaking... it takes 10 to Tango!!!

Image
http://www.bluemesapc.com/
harkon
Enthusiast
Enthusiast
Posts: 217
Joined: Wed Nov 23, 2005 5:48 pm

Re: Printer bug in V4.40

Post 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 :?
Missed it by that much!!
HK
User avatar
Rook Zimbabwe
Addict
Addict
Posts: 4322
Joined: Tue Jan 02, 2007 8:16 pm
Location: Cypress TX
Contact:

Re: Printer bug in V4.40

Post 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.
Binarily speaking... it takes 10 to Tango!!!

Image
http://www.bluemesapc.com/
harkon
Enthusiast
Enthusiast
Posts: 217
Joined: Wed Nov 23, 2005 5:48 pm

Re: Printer bug in V4.40

Post 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.
Missed it by that much!!
HK
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Re: Printer bug in V4.40

Post 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
BERESHEIT
harkon
Enthusiast
Enthusiast
Posts: 217
Joined: Wed Nov 23, 2005 5:48 pm

Re: Printer bug in V4.40

Post 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. :)
Missed it by that much!!
HK
User avatar
Demivec
Addict
Addict
Posts: 4270
Joined: Mon Jul 25, 2005 3:51 pm
Location: Utah, USA

Re: Printer bug in V4.40

Post 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).
harkon
Enthusiast
Enthusiast
Posts: 217
Joined: Wed Nov 23, 2005 5:48 pm

Re: Printer bug in V4.40

Post by harkon »

That would explain it. Thanks.
Missed it by that much!!
HK
Little John
Addict
Addict
Posts: 4791
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Printer bug in V4.40

Post 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
freak
PureBasic Team
PureBasic Team
Posts: 5944
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Re: Printer bug in V4.40

Post by freak »

fixed.
quidquid Latine dictum sit altum videtur
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

Re: [Done] Printer bug in V4.40

Post by blueznl »

Fixed means in this case... ?
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
freak
PureBasic Team
PureBasic Team
Posts: 5944
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Re: [Done] Printer bug in V4.40

Post by freak »

The default FrontColor is now white, as it is with the other subsystems.
quidquid Latine dictum sit altum videtur
Post Reply