Page 1 of 1

vectordrawing and font offset, bigdifferences

Posted: Fri Nov 28, 2025 11:15 am
by Mesa
I have a large difference in text offset calculation between the default font loaded with loadfont() and the default font from getgadgetfont(). Is that normal ?

pb630b4 x64 windows

See under:

Code: Select all

If OpenWindow(0, 0, 0, 400, 200, "VectorDrawing", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  CanvasGadget(0, 0, 0, 400, 200)
  
  LoadFont(0, "", 11)
  font=GetGadgetFont(#PB_Default)
  
  If StartVectorDrawing(CanvasVectorOutput(0))
    
    VectorSourceColor(RGBA(0, 0, 0, 180))
    Text$ = "ÎÇ"
    
    VectorFont(FontID(0))
    Debug VectorTextHeight(Text$, #PB_VectorText_Visible | #PB_VectorText_Offset)
    
    
    
    VectorFont(font) 
    Debug VectorTextHeight(Text$, #PB_VectorText_Visible | #PB_VectorText_Offset)
    ;===>big difference (not due to the size),  and also, with pb602x86 32b, i've got 0.0 
    
    StopVectorDrawing()
  EndIf
  
  Repeat
    Event = WaitWindowEvent()
  Until Event = #PB_Event_CloseWindow
EndIf

M.

Re: vectordrawing and font offset, bigdifferences

Posted: Fri Nov 28, 2025 11:47 am
by RASHAD
Hi Mesa
I think your approach to get the default font is not quit right

Code: Select all

If OpenWindow(0, 0, 0, 400, 200, "VectorDrawing", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  CanvasGadget(0, 0, 0, 400, 200)
  
;   FID = GetGadgetFont(#PB_Default)
;   fnt.LOGFONT    
;   GetObject_(FID,SizeOf(fnt),@fnt)
;   FName$ =  PeekS(@fnt\lfFaceName[0])
;   font = LoadFont(0,Fname$,11)

    sinfo.NONCLIENTMETRICS
    sinfo\cbSize = SizeOf(sinfo)
    SystemParametersInfo_(#SPI_GETNONCLIENTMETRICS,0,@sinfo,0)
    Fname$ = PeekS(@sinfo\lfCaptionFont\lfFaceName[0])
    font = LoadFont(0,Fname$,11)
    
  If StartVectorDrawing(CanvasVectorOutput(0))
    
    VectorSourceColor(RGBA(0, 0, 0, 180))
    Text$ = "ÎÇ"
    
    VectorFont(FontID(0))
    Debug VectorTextHeight(Text$, #PB_VectorText_Visible | #PB_VectorText_Offset)
    
    
    
    VectorFont(font) 
    Debug VectorTextHeight(Text$, #PB_VectorText_Visible | #PB_VectorText_Offset)
    ;===>big difference (not due to the size),  and also, with pb602x86 32b, i've got 0.0 
    
    StopVectorDrawing()
  EndIf
  
  Repeat
    Event = WaitWindowEvent()
  Until Event = #PB_Event_CloseWindow
EndIf