home *** CD-ROM | disk | FTP | other *** search
/ Amiga Developer CD v1.2 / amidev_cd_12.iso / reference / amiga_mail_vol2 / v-15 / fta.c < prev   
C/C++ Source or Header  |  1996-01-30  |  3KB  |  99 lines

  1. ;/* FTA.c - Execute me to compile me with SAS/C 6.56
  2. sc NMINC STRMERGE STREQ NOSTKCHK SAVEDS IGNORE=73 FTA.c
  3. slink FROM LIB:c.o,FTA.o TO FTA LIBRARY LIB:sc.lib,LIB:amiga.lib
  4. quit
  5.  
  6. Sept. 17 1991 by John Orr
  7.  
  8. Copyright (c) 1991 Commodore-Amiga, Inc.
  9.  
  10. This example is provided in electronic form by Commodore-Amiga,
  11. Inc. for use with the Amiga Mail Volume II technical publication.
  12. Amiga Mail Volume II contains additional information on the correct
  13. usage of the techniques and operating system functions presented in
  14. these examples.  The source and executable code of these examples may
  15. only be distributed in free electronic form, via bulletin board or
  16. as part of a fully non-commercial and freely redistributable
  17. diskette.  Both the source and executable code (including comments)
  18. must be included, without modification, in any copy.  This example
  19. may not be published in printed form or distributed with any
  20. commercial product. However, the programming techniques and support
  21. routines set forth in these examples may be used in the development
  22. of original executable software products for Commodore Amiga
  23. computers.
  24.  
  25. All other rights reserved.
  26.  
  27. This example is provided "as-is" and is subject to change; no
  28. warranties are made.  All use is at your own risk. No liability or
  29. responsibility is assumed.
  30. */
  31.  
  32.  
  33.  
  34. #include <exec/types.h>
  35. #include <intuition/intuition.h>
  36. #include <graphics/text.h>
  37. #include <graphics/gfx.h>
  38. #include <libraries/diskfont.h>
  39. #include <utility/tagitem.h>
  40. #include <clib/exec_protos.h>
  41. #include <clib/dos_protos.h>
  42. #include <clib/alib_stdio_protos.h>
  43. #include <clib/intuition_protos.h>
  44. #include <clib/graphics_protos.h>
  45. #include <clib/diskfont_protos.h>
  46. #include <clib/utility_protos.h>
  47.  
  48. #ifdef LATTICE
  49. int CXBRK(void) { return(0); }  /* Disable Lattice CTRL/C handling */
  50. int chkabort(void) { return(0); }
  51. #endif
  52.  
  53. #define MYXDPI (75L << 16)
  54. #define MYYDPI (50L)
  55.  
  56. struct TTextAttr mytta = {
  57.     "topaz.font",
  58.     9,
  59.     FSF_TAGGED,
  60.     0L,
  61.     NULL
  62. };
  63.  
  64. struct TagItem tagitem[2];
  65. struct TextFont *myfont;
  66. ULONG dpivalue;
  67.  
  68. struct Library *UtilityBase, *DiskfontBase, *GfxBase;
  69.  
  70. void main(void)
  71. {
  72.     tagitem[0].ti_Tag = TA_DeviceDPI;
  73.     tagitem[0].ti_Data = MYXDPI | MYYDPI;
  74.     tagitem[1].ti_Tag = TAG_END;
  75.  
  76.  
  77.     if (DiskfontBase = OpenLibrary("diskfont.library", 36L))
  78.     {
  79.         if (UtilityBase = OpenLibrary("utility.library", 36L))
  80.         {
  81.             if (GfxBase = OpenLibrary("graphics.library", 36L))
  82.             {
  83.                 if (myfont = OpenDiskFont(&mytta))
  84.                 {
  85.                     dpivalue = GetTagData(TA_DeviceDPI,
  86.                                      0L,
  87.                                      ((struct TextFontExtension *)(myfont->tf_Extension))->tfe_Tags);
  88.                     if (dpivalue) printf("XDPI = %d    YDPI = %d\n",
  89.                                     ((dpivalue & 0xFFFF0000)>>16),
  90.                                     (dpivalue & 0x0000FFFF));
  91.                     CloseFont(myfont);
  92.                 }
  93.                 CloseLibrary(GfxBase);
  94.             }
  95.             CloseLibrary(UtilityBase);
  96.         }
  97.         CloseLibrary(DiskfontBase);
  98.     }
  99. }