home *** CD-ROM | disk | FTP | other *** search
/ BUG 4 / BUGCD1997_05.BIN / aplic / clip4win / clip4win.exe / C4W30E.HUF / INCLUDE / FONT.CH < prev    next >
Text File  |  1995-07-04  |  6KB  |  212 lines

  1. ////////////////////////////
  2. //
  3. //    Clip-4-Win font definitions
  4. //
  5. //    Copyright (C) 1992 Skelton Software, Kendal Cottage, Hillam, Leeds, UK.
  6. //    All Rights Reserved.
  7. //
  8. ////////////////////////////
  9.  
  10. #ifndef    C4W_FONT_CH
  11. #define    C4W_FONT_CH
  12.  
  13.  
  14. // Array elements of aFont[], which is used with CreateFont() and ChooseFont()
  15. // (Really, aFont[] is aLogicalFont[] -- which explains the LF_ prefix)
  16.  
  17. #define    LF_Height    1
  18. #define    LF_Width    2
  19. #define    LF_Escapement    3
  20. #define    LF_Orientation    4
  21. #define    LF_Weight    5
  22. #define    LF_Italic    6
  23. #define    LF_Underline    7
  24. #define    LF_StrikeOut    8
  25. #define    LF_CharSet    9
  26. #define    LF_OutPrecision    10
  27. #define    LF_ClipPrecision 11    
  28. #define    LF_Quality     12
  29. #define    LF_PitchAndFamily 13
  30. #define    LF_FaceName    14
  31.  
  32.  
  33. // Logical Font
  34. #define LF_FACESIZE    32    // name length
  35.  
  36.  
  37. // In Windows, the Italic/Underline/StrikeOut are BYTE, although BOOL would
  38. // make more sense (& is what Clip-4-Win uses).  For Bin2A()/A2Bin(), use
  39. // the Windows type to be able to unpack/pack the structure:
  40.  
  41. #define    LF_A2Bin    "int[5],BYTE[8],str"    // len(str) must be LF_FACESIZE
  42. #define    LF_Bin2A    "int[5],BYTE[8],str[32]"
  43.  
  44. #define    LF_BYTELEN    40    // length in bytes (2*5 + 1*8 + LF_FACESIZE)
  45.  
  46. // NEWLOGFONT (TrueType) values:
  47.  
  48. #define    NLF_A2Bin    "int[5],BYTE[8],str,str,str"  // str lengths must be LF_FACESIZE, 2 * LF_FACESIZE, LF_FACESIZE
  49. #define    NLF_Bin2A    "int[5],BYTE[8],str[32],str[64],str[32]"
  50.  
  51. #define    NLF_BYTELEN    136    // NEWLOGFONT length in bytes
  52.                 // (2*5 + 1*8 + LF_FACESIZE*4)
  53.  
  54.  
  55. // LF_Weight values
  56. #define FW_DONTCARE        0
  57. #define FW_THIN         100
  58. #define FW_EXTRALIGHT        200
  59. #define FW_LIGHT        300
  60. #define FW_NORMAL        400
  61. #define FW_MEDIUM        500
  62. #define FW_SEMIBOLD        600
  63. #define FW_BOLD         700
  64. #define FW_EXTRABOLD        800
  65. #define FW_HEAVY        900
  66.  
  67. #define FW_ULTRALIGHT        FW_EXTRALIGHT
  68. #define FW_REGULAR        FW_NORMAL
  69. #define FW_DEMIBOLD        FW_SEMIBOLD
  70. #define FW_ULTRABOLD        FW_EXTRABOLD
  71. #define FW_BLACK        FW_HEAVY
  72.  
  73.  
  74. // LF_CharSet values
  75. #define ANSI_CHARSET        0
  76. #define DEFAULT_CHARSET     1
  77. #define SYMBOL_CHARSET        2
  78. #define SHIFTJIS_CHARSET    128
  79. #define HANGEUL_CHARSET     129
  80. #define CHINESEBIG5_CHARSET 136
  81. #define OEM_CHARSET        255
  82.  
  83.  
  84. // LF_OutPrecision values
  85. #define OUT_DEFAULT_PRECIS    0
  86. #define OUT_STRING_PRECIS    1
  87. #define OUT_CHARACTER_PRECIS    2
  88. #define OUT_STROKE_PRECIS    3
  89. // Win 3.1:
  90. #define OUT_TT_PRECIS        4
  91. #define OUT_DEVICE_PRECIS    5
  92. #define OUT_RASTER_PRECIS    6
  93. #define OUT_TT_ONLY_PRECIS    7
  94. // end of Win 3.1
  95.  
  96.  
  97. // LF_ClipPrecision values
  98. #define CLIP_DEFAULT_PRECIS     0
  99. #define CLIP_CHARACTER_PRECIS   1
  100. #define CLIP_STROKE_PRECIS      2
  101. #define CLIP_MASK        15
  102. // Win 3.1:
  103. #define CLIP_LH_ANGLES        16
  104. #define CLIP_TT_ALWAYS        32
  105. #define CLIP_EMBEDDED        128
  106. // end of Win 3.1
  107.  
  108.  
  109. // LF_Quality values
  110. #define DEFAULT_QUALITY     0
  111. #define DRAFT_QUALITY       1
  112. #define PROOF_QUALITY       2
  113.  
  114.  
  115. // LF_PitchAndFamily pitch values (low 4 bits)
  116. #define DEFAULT_PITCH       0
  117. #define FIXED_PITCH         1
  118. #define VARIABLE_PITCH      2
  119.  
  120. // LF_PitchAndFamily family values (high 4 bits)
  121. #define FF_DONTCARE         0
  122. #define FF_ROMAN            16
  123. #define FF_SWISS            32
  124. #define FF_MODERN           48
  125. #define FF_SCRIPT           64
  126. #define FF_DECORATIVE       80
  127.  
  128.  
  129. #ifndef    LOGPIXELSY        // maybe user forgot WIN_WANT_GETDEVCAPS
  130. #define    LOGPIXELSY    90
  131. #endif
  132.  
  133. #ifndef    RC_INVOKED
  134. #ifndef    WORKSHOP_INVOKED
  135.  
  136. // Remember to specify the device context (hDC) if you want to specify
  137. // point size,
  138. // e.g.
  139. //    hDC = GetPrintDC()  or CreateDC(...)  or  PrinterDC() [see printdc.zip]
  140. //    CREATE FONT HANDLE hFont FACE "Arial" POINTSIZE 12 DC hDC
  141. //    hOldFont = SelectObject(hDC, hFont)
  142. //    ...
  143. //    SelectObject(hDC, hOldFont)
  144. //    DeleteDC(hDC)
  145. //    DELETE FONT HANDLE hFont  // or DeleteObject(hFont)
  146. // e.g.
  147. //    hDC = GetDC(hWnd)
  148. //    CREATE FONT HANDLE hFont FACE "Arial" POINTSIZE 12 DC hDC
  149. //    hOldFont = SelectObject(hDC, hFont)
  150. //    ...
  151. //    SelectObject(hDC, hOldFont)
  152. //    ReleaseDC(hWnd, hDC)
  153. //    DELETE FONT HANDLE hFont  // or DeleteObject(hFont)
  154. // e.g.
  155. //    CREATE FONT HANDLE hFont FACE "Courier" BOLD
  156. //    ...
  157. //    DELETE FONT HANDLE hFont  // or DeleteObject(hFont)
  158.  
  159. #command CREATE FONT                            ;
  160.          [OBJECT <o>]    ; //TBD: NYI
  161.          [HANDLE <h>]                            ;
  162.          [<face: FACENAME, NAME, TYPEFACE> <c>]                ;
  163.          [<size: POINTSIZE, SIZE> <nPt>]                ;
  164.          [DC <hDC>]                            ;
  165.          [HEIGHT <nH>]                            ;
  166.          [WIDTH <nW>]                            ;
  167.          [WEIGHT <nWt>]                            ;
  168.          [<thin: THIN>]                            ;
  169.          [<bold: BOLD>]                            ;
  170.          [<ital: ITALIC>]                        ;
  171.          [<und: UNDERLINE>]                        ;
  172.          [<stk: STRIKEOUT>]                        ;
  173.          [<ansi: ANSI>]                            ;
  174.          [<oem: OEM>]                            ;
  175.          [<tt: TRUETYPE>]                        ;
  176.          [<tto: TRUETYPEONLY>]                        ;
  177.          [<draft: DRAFT>]                        ;
  178.          [<proof: PROOF>]                        ;
  179.          [PITCH <pitch>]                        ;
  180.          [FAMILY <fam>]                            ;
  181.       => [<h> :=]                            ;
  182.          CreateFont({_IF_(<.nPt.>,                    ;
  183.                           -(<nPt> * GetDeviceCaps(<hDC>, LOGPIXELSY) / 72),;
  184.                           <nH>),                    ;
  185.                      _IF_(<.nW.>, <nW>, 0),                ;
  186.                      0,                            ;
  187.                      0,                            ;
  188.                      _IF_(<.nWt.>, <nWt>, 0)                ;
  189.                      + _IF_(<.thin.>, FW_THIN, 0)            ;
  190.                      + _IF_(<.bold.>, FW_BOLD, 0),            ;
  191.                      <.ital.>,                        ;
  192.                      <.und.>,                        ;
  193.                      <.stk.>,                        ;
  194.                      _IF_(<.ansi.>, ANSI_CHARSET, 0)            ;
  195.                      + _IF_(<.oem.>, OEM_CHARSET, DEFAULT_CHARSET),    ;
  196.                      _IF_(<.tt.>, OUT_TT_PRECIS, 0)            ;
  197.                      + _IF_(<.tto.>, OUT_TT_ONLY_PRECIS, 0),        ;
  198.                      0,                            ;
  199.                      _IF_(<.draft.>, DRAFT_QUALITY, 0)            ;
  200.                      + _IF_(<.proof.>, PROOF_QUALITY, 0),        ;
  201.                      _IF_(<.pitch.>, <pitch>, 0) + _IF_(<.fam.>, <fam>, 0),;
  202.                      <c>})
  203.  
  204. #command DELETE FONT                            ;
  205.          [HANDLE <h>]                            ;
  206.       => DeleteObject(<h>)
  207.  
  208. #endif    // WORKSHOP_INVOKED
  209. #endif    // RC_INVOKED
  210.  
  211. #endif    // C4W_FONT_CH
  212.