FontWidth.htm 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <html>
  2. <head>
  3. <title>Blitz3D Docs</title>
  4. <link rel=stylesheet href=../css/commands.css type=text/css>
  5. </head>
  6. <body>
  7. <h1>FontWidth()</h1>
  8. <h1>Parameters</h1>
  9. <table>
  10. <tr>
  11. <td>
  12. None.
  13. </td>
  14. </tr>
  15. </table>
  16. <h1>Description</h1>
  17. <table>
  18. <tr>
  19. <td>
  20. This returns the width, in pixels, of the currently selected font (using SetFont - previously loaded with LoadFont). This command returns the width of the WIDEST character of the font.
  21. </td>
  22. </tr>
  23. </table>
  24. <h1><a href=../2d_examples/FontWidth.bb>Example</a></h1>
  25. <table>
  26. <tr>
  27. <td>
  28. ; FontWidth()/FontHeight example <br />
  29. <br />
  30. ; enable graphics mode <br />
  31. Graphics 800,600,16 <br />
  32. <br />
  33. ; Set global on font variable <br />
  34. Global fntArial <br />
  35. <br />
  36. ;Load fonts to a file handle variables <br />
  37. fntArial=LoadFont("Arial",13,False,False,False) <br />
  38. <br />
  39. ; set the font and print sizes <br />
  40. SetFont fntArial <br />
  41. Text 400,0,"The font width of the widest character is:"+ FontWidth(),True,False <br />
  42. Text 400,30,"The height of the font is:"+ FontHeight(),True,False <br />
  43. <br />
  44. ; Standard 'wait for ESC' from user <br />
  45. While Not KeyHit(1) <br />
  46. Wend <br />
  47. <br />
  48. ; Clear all the fonts from memory! <br />
  49. FreeFont fntArial <br />
  50. </td>
  51. </tr>
  52. </table>
  53. <br>
  54. <a target=_top href=../index.htm>Index</a><br>
  55. <br>
  56. Click <a href=http://www.blitzbasic.co.nz/b3ddocs/command.php?name=FontWidth&ref=comments target=_blank>here</a> to view the latest version of this page online</body>
  57. </html>