PB 5.50b2 - vector fonts not scaled properly to printer

Post bugreports for the Windows version here
User avatar
DoubleDutch
Addict
Addict
Posts: 3220
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

PB 5.50b2 - vector fonts not scaled properly to printer

Post by DoubleDutch »

Vector fonts are not scaled properly when using pixel mode to printer.

Code: Select all

If PrintRequester()

  If StartPrinting("PureBasic Test")
  
    LoadFont(0, "Arial", 30)
    LoadFont(1, "Arial", 100)
  
    If StartVectorDrawing(PrinterVectorOutput(#PB_Unit_Pixel))  ; fonts are not scaled properly in unit_pixel mode.
      
      VectorFont(FontID(0))
      MovePathCursor(100, 100)
      DrawVectorText("PureBasic Printer Test")
      
      VectorFont(FontID(1))
      MovePathCursor(100, 400)
      DrawVectorText("PureBasic Printer Test 2")
      
      AddPathBox(200, 200, 100, 100)
      VectorSourceColor(RGBA(255, 0, 0, 255)) ; Draw a red box
      StrokePath(10)
        
      StopVectorDrawing()
    EndIf
    
    StopPrinting()
  EndIf
EndIf
If you use "StartVectorDrawing(PrinterVectorOutput(#PB_Unit_Pixel))" then the fonts are not scaled properly.

See:
Image

compared to this if you use "StartVectorDrawing(PrinterVectorOutput(#PB_Unit_Point))"...
Image

For images it works as you would expect:

Code: Select all

UsePNGImageEncoder()

CreateImage(0,1000,1000,32,RGB($ff,$ff,$ff))
	
LoadFont(0, "Arial", 30)
LoadFont(1, "Arial", 100)

If StartVectorDrawing(ImageVectorOutput(0,#PB_Unit_Pixel))  ; fonts are not scaled properly in unit_pixel mode.
  
  VectorFont(FontID(0))
  MovePathCursor(100, 100)
  DrawVectorText("PureBasic Printer Test")
  
  VectorFont(FontID(1))
  MovePathCursor(100, 400)
  DrawVectorText("PureBasic Printer Test 2")
  
  AddPathBox(200, 200, 100, 100)
  VectorSourceColor(RGBA(255, 0, 0, 255)) ; Draw a red box
  StrokePath(10)
    
  StopVectorDrawing()
EndIf

SaveImage(0,"pixelimage.png",#PB_ImagePlugin_PNG)
Here it is when drawn as pixels:
Image

Here it is when drawn as points:
Image
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
davido
Addict
Addict
Posts: 1890
Joined: Fri Nov 09, 2012 11:04 pm
Location: Uttoxeter, UK

Re: PB 5.50b2 - vector fonts not scaled properly to printer

Post by davido »

In the meantime you might like to look at this:
http://www.purebasic.fr/english/viewtop ... 81#p491081
DE AA EB
User avatar
DoubleDutch
Addict
Addict
Posts: 3220
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Re: PB 5.50b2 - vector fonts not scaled properly to printer

Post by DoubleDutch »

Thanks for the link. :)

I think this really is a bug though with the font scaling in pixel mode specifically to the printer. Does it happen for you too?
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
davido
Addict
Addict
Posts: 1890
Joined: Fri Nov 09, 2012 11:04 pm
Location: Uttoxeter, UK

Re: PB 5.50b2 - vector fonts not scaled properly to printer

Post by davido »

@DoubleDutch ,

To be honest, I'm not really sure.
I spent a few 'happy hours' trying to get the same output on different printers connected to both PC's and Macs, without much success. I put it down to my lack of understanding.
I was hoping Freak might share his views on the subject.
DE AA EB
User avatar
DoubleDutch
Addict
Addict
Posts: 3220
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Re: PB 5.50b2 - vector fonts not scaled properly to printer

Post by DoubleDutch »

I understand the scaling, etc - for pixel mode though the fonts seem to get their scale incorrectly when using the Printer output.
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
User avatar
DoubleDutch
Addict
Addict
Posts: 3220
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Re: PB 5.50b2 - vector fonts not scaled properly to printer

Post by DoubleDutch »

I discovered that the VectorFont command is actually at fault. If you set the scale value manually then all is ok:

Code: Select all

If PrintRequester()

  If StartPrinting("PureBasic Test")
  
    LoadFont(0, "Arial", 30)
    LoadFont(1, "Arial", 100)
  
    If StartVectorDrawing(PrinterVectorOutput(#PB_Unit_Pixel))  ; fonts are not scaled properly in unit_pixel mode.
      
      VectorFont(FontID(0),30) ; bug appears to be in getting the original font size? setting it manually to the same value works!
      MovePathCursor(100, 100)
      DrawVectorText("PureBasic Printer Test")
      
      VectorFont(FontID(1),100) ; bug appears to be in getting the original font size? setting it manually to the same value works!
      MovePathCursor(100, 400)
      DrawVectorText("PureBasic Printer Test 2")
      
      AddPathBox(200, 200, 100, 100)
      VectorSourceColor(RGBA(255, 0, 0, 255)) ; Draw a red box
      StrokePath(10)
        
      StopVectorDrawing()
    EndIf
    
    StopPrinting()
  EndIf
EndIf
So it looks like in pixel mode the scaling isn't done from the original font size value when printing to a printer = the actual bug!
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
Post Reply