home *** CD-ROM | disk | FTP | other *** search
/ BUG 4 / BUGCD1997_05.BIN / aplic / clip4win / clip4win.exe / C4W30E.HUF / SOURCE / FONT2.PRG < prev    next >
Text File  |  1995-05-26  |  959b  |  48 lines

  1. #include "windows.ch"
  2. #define NO_C4WCLASS
  3. #include "commands.ch"
  4.  
  5. static    nX := 10, nY := 10
  6.  
  7. function main()
  8. local    oApp, oWnd
  9.  
  10. CREATE APPLICATION oApp  WINDOW oWnd  TITLE "Clip-4-Win: CREATE FONT Test" ;
  11.     ON WM_PAINT TestFonts(oWnd)
  12.  
  13. return 0
  14.  
  15.  
  16. static function TestFonts(hWnd)
  17. local    hDC := GetDC(hWnd), hFont, hOldFont
  18.  
  19. nY := 10
  20. Out(hDC, "Arial", , 20)
  21. Out(hDC, "Courier", , 20)
  22. Out(hDC, "Arial", 14)
  23. Out(hDC, "Courier", 14)
  24.  
  25. ReleaseDC(hWnd, hDC)
  26. return nil
  27.  
  28.  
  29. static function Out(hDC, cFont, nPt, nH)
  30. local    hFont, hOldFont, cStr
  31.  
  32. if nPt != nil
  33.     CREATE FONT HANDLE hFont  FACE cFont  POINTSIZE nPt  DC hDC
  34.     cStr = cFont + "    POINTSIZE " + ltrim(str(nPt))
  35. elseif nH != nil
  36.     CREATE FONT HANDLE hFont  FACE cFont  HEIGHT nH
  37.     cStr = cFont + "    HEIGHT " + ltrim(str(nH))
  38. endif
  39.  
  40. hOldFont = SelectObject(hDC, hFont)
  41. TextOut(hDC, nX, nY += 40, cStr)
  42. SelectObject(hDC, hOldFont)
  43.  
  44. DELETE FONT HANDLE hFont
  45.  
  46. return nil
  47.  
  48.