SetFont.htm 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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>SetFont fonthandle</h1>
  8. <h1>Parameters</h1>
  9. <table>
  10. <tr>
  11. <td>
  12. fontname = string containing font name <br />
  13. height = font height desired <br />
  14. bold = set to TRUE to load font as BOLD <br />
  15. italic = set to TRUE to load font as ITALIC <br />
  16. underlined set to TRUE to load font as UNDERLINED
  17. </td>
  18. </tr>
  19. </table>
  20. <h1>Description</h1>
  21. <table>
  22. <tr>
  23. <td>
  24. This activates a TrueType font previously loaded into memory (though the LoadFont command) for future use with printing commands such as Text. <br />
  25. <br />
  26. Note: Blitz doesn't work with SYMBOL fonts, like Webdings and WingDings. <br />
  27. <br />
  28. Be sure to free the memory used by the font went you are done using the FreeFont command.
  29. </td>
  30. </tr>
  31. </table>
  32. <h1><a href=../2d_examples/SetFont.bb>Example</a></h1>
  33. <table>
  34. <tr>
  35. <td>
  36. ; LoadFont/SetFont/FreeFont example <br />
  37. <br />
  38. ; enable graphics mode <br />
  39. Graphics 800,600,16 <br />
  40. <br />
  41. ; Set global on font variables <br />
  42. Global fntArial,fntArialB,fntArialI,fntArialU <br />
  43. <br />
  44. ;Load fonts to a file handle variables <br />
  45. fntArial=LoadFont("Arial",24,False,False,False) <br />
  46. fntArialB=LoadFont("Arial",18,True,False,False) <br />
  47. fntArialI=LoadFont("Arial",32,False,True,False) <br />
  48. fntArialU=LoadFont("Arial",14,False,False,True) <br />
  49. <br />
  50. ; set the font and print text <br />
  51. SetFont fntArial <br />
  52. Text 400,0,"This is just plain Arial 24 point",True,False <br />
  53. <br />
  54. SetFont fntArialB <br />
  55. Text 400,30,"This is bold Arial 18 point",True,False <br />
  56. <br />
  57. SetFont fntArialI <br />
  58. Text 400,60,"This is italic Arial 32 point",True,False <br />
  59. <br />
  60. SetFont fntArialU <br />
  61. Text 400,90,"This is underlined Arial 14 point",True,False <br />
  62. <br />
  63. ; Standard 'wait for ESC' from user <br />
  64. While Not KeyHit(1) <br />
  65. Wend <br />
  66. <br />
  67. ; Clear all the fonts from memory! <br />
  68. FreeFont fntArial <br />
  69. FreeFont fntArialB <br />
  70. FreeFont fntArialI <br />
  71. FreeFont fntArialU <br />
  72. </td>
  73. </tr>
  74. </table>
  75. <br>
  76. <a target=_top href=../index.htm>Index</a><br>
  77. <br>
  78. Click <a href=http://www.blitzbasic.co.nz/b3ddocs/command.php?name=SetFont&ref=comments target=_blank>here</a> to view the latest version of this page online</body>
  79. </html>