home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 63 / CDACTUAL63.iso / Aplicaciones / DarkBasic / DemoDarkBasic.exe / help / examples / text / exam03.dba < prev    next >
Encoding:
Text File  |  2000-04-09  |  3.7 KB  |  145 lines

  1. Rem * Title  : Checking for Fonts
  2. Rem * Author : DBS-MB
  3. Rem * Date   : 1st August 99
  4. rem ===================================================
  5. rem DARK BASIC EXAMPLE PROGRAM 3
  6. rem ===================================================
  7. rem This program will perform checklist for fonts
  8. rem ---------------------------------------------------
  9.  
  10. rem Set the ink to white and paper color to black 
  11. ink rgb(244,214,210),1
  12.  
  13. rem Set a new font
  14. rem the new font will work with all text command but not the print command
  15. set text font "arial"
  16. set text size 12
  17.  
  18. rem This command will check you system for any fonts
  19. perform checklist for fonts
  20.  
  21. text 0,10,"NUMBER OF FONTS FOUND WERE "+upper$(str$(checklist quantity()))
  22. text 0,(10+text size())+2,"PRESS SPACEKEY" 
  23. suspend for key
  24.  
  25. rem This command will clear the screen
  26. cls 
  27.  
  28. rem This part will print all fonts on your system
  29. rem CHECKLIST QUANTITY() is how many fonts you have on your computer
  30. rem CHECKLIST STRING$() is what the font name is
  31.  
  32. rem Were on screen to print text name
  33. textacross=0
  34. textdown=0
  35. message$=""
  36.  
  37. for t=1 to checklist quantity()
  38.  
  39.     rem get font name        
  40.     message$=checklist string$(t)
  41.  
  42.     if textacross+text width(message$) >=640
  43.         rem if some of the message will be printed of screen
  44.         rem then move to the next line
  45.  
  46.         rem move to the next line on screen
  47.         textdown=(textdown+text size())+2
  48.         rem move to the start of the line
  49.         textacross=0
  50.  
  51.         rem draw font name on screen
  52.         text textacross,textdown,message$
  53.  
  54.         rem move to end of the message that has been printed plus 10 pixel
  55.         textacross=(textacross+text width(message$))+10
  56.     else
  57.         rem if message can be printed on the line then do so
  58.         rem draw font name on screen
  59.         text textacross,textdown,message$
  60.             
  61.         rem move to end of the message that has been printed plus 10 pixel
  62.         textacross=(textacross+text width(message$))+10
  63.     endif
  64.  
  65. next t
  66.  
  67. rem Move down to next line
  68. textdown=(textdown+text size())+2
  69. center text 320,textdown,"PRESS SPACEKEY" 
  70. suspend for key
  71. cls
  72.  
  73. message$=""
  74. for t=1 to checklist quantity()
  75.  
  76.     rem clear the screen
  77.     cls 
  78.  
  79.     set text font checklist string$(t)
  80.     set text size 24
  81.  
  82.     rem get font name        
  83.     message$=checklist string$(t)
  84.          
  85.     rem draw font name on screen
  86.     text 0,30,"THIS FONT IS CALLED"
  87.     text 0,50,message$
  88.     text 0,70,"A B C D E F G H I J K L M N O P Q R T S U V W X Y Z"
  89.     text 0,90,"a b c d e f g h i j k l m n o p q r s t u v w x y z"
  90.     text 0,110,"0 1 2 3 4 5 6 7 8 9"
  91.     text 0,130,"PRESS LEFT MOUSE BUTTON TO SEE NEXT FONT"
  92.  
  93.     rem wait for left mouse button pressed
  94.     repeat:until mouseclick()=1    
  95.  
  96.     rem wait till you let go of left mouse button
  97.     repeat:until mouseclick()<>1
  98.  
  99. next t
  100.  
  101. center text 320,150,"PRESS SPACEKEY" 
  102. suspend for key
  103. cls
  104.  
  105. rem This part will show you how to check for a font
  106. rem CHECKLIST QUANTITY() is how many fonts you have on your computer
  107. rem CHECKLIST STRING$() is what the font name is
  108. rem THE COMMAND LOWER$() WILL TURN ALL OF A STRING INTO LOWER CASE
  109.  
  110. rem were on screen to print text name
  111. textacross=0
  112. textdown=0
  113. found=0
  114. message$=""
  115.  
  116. rem put the font name your are look for here
  117. fonttolookfor$="times new roman"
  118.  
  119. rem check for font
  120. for t= 1 to checklist quantity()
  121.  
  122.     rem get font name
  123.     message$=checklist string$(t)
  124.  
  125.     rem make both string lower case and check them
  126.     if lower$(fonttolookfor$)=lower$(message$)
  127.         found=1
  128.     endif
  129.  
  130. next t
  131.  
  132. if found=0
  133.     rem if found=0 then print this message
  134.     text 0,0,"NO THERE WAS NO FOUNT CALLED "+fonttolookfor$
  135. else
  136.     rem if found = any number but 0 then print this message 
  137.     text 0,0,"YES THERE IS A FONT CALLED "+fonttolookfor$
  138. endif
  139.  
  140. rem Will wait for you to press any key
  141. suspend for key
  142.  
  143. rem End the program
  144. end
  145.