GetFontWidth
Width = GetFontWidth(FontIndex)
 
Parameters:

    FontIndex = The index identifier of the font you wish to query
Returns:

    Width = The max pixel width of this font
 

      The GetFontWidth function returns the pixel width of the selected font.



FACTS:


      * GetFontWidth returns the width of the widest character in this font.

      * If you want to calculate the length of a string in pixels see: GetTextWidth




Mini Tutorial:


      This example loads the windows Arial font as font #2, then displays all the information about this font.


  
; Load the "Arial" font as font 2, size 24, in the
; normal style
  LoadFont "Arial",2,24,0
  
; Set Font 2 at the current font.
  SetFont 2
  
; Display the information about the loaded font
  Print "Font Status:"+Str$(GetFontStatus(2))
  Print "Font Name:"+GetFontName$(2)
  Print "Font Size:"+Str$(GetFontSize(2))
  Print "Font Width:"+Str$(GetFontWidth(2))
  Print "Font Height:"+Str$(GetFontHeight(2))
  Print "Font Style:"+Str$(GetFontStyle(2))
  
; Display the screen and wait for a key top be pressed
  Sync
  WaitKey
  



This example would output.

  
  Font Status:1
  Font Name:Arial
  Font Size:24
  Font Width:56
  Font Height:24
  Font Style:0
  

 
Related Info: GetFontHeight | GetFontName$ | GetFontSize | GetFontStyle | GetFontType | GetTextWidth | LoadFont :
 


(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com