home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
BUG 4
/
BUGCD1997_05.BIN
/
aplic
/
clip4win
/
clip4win.exe
/
C4W30E.HUF
/
INCLUDE
/
FONT.CH
< prev
next >
Wrap
Text File
|
1995-07-04
|
6KB
|
212 lines
////////////////////////////
//
// Clip-4-Win font definitions
//
// Copyright (C) 1992 Skelton Software, Kendal Cottage, Hillam, Leeds, UK.
// All Rights Reserved.
//
////////////////////////////
#ifndef C4W_FONT_CH
#define C4W_FONT_CH
// Array elements of aFont[], which is used with CreateFont() and ChooseFont()
// (Really, aFont[] is aLogicalFont[] -- which explains the LF_ prefix)
#define LF_Height 1
#define LF_Width 2
#define LF_Escapement 3
#define LF_Orientation 4
#define LF_Weight 5
#define LF_Italic 6
#define LF_Underline 7
#define LF_StrikeOut 8
#define LF_CharSet 9
#define LF_OutPrecision 10
#define LF_ClipPrecision 11
#define LF_Quality 12
#define LF_PitchAndFamily 13
#define LF_FaceName 14
// Logical Font
#define LF_FACESIZE 32 // name length
// In Windows, the Italic/Underline/StrikeOut are BYTE, although BOOL would
// make more sense (& is what Clip-4-Win uses). For Bin2A()/A2Bin(), use
// the Windows type to be able to unpack/pack the structure:
#define LF_A2Bin "int[5],BYTE[8],str" // len(str) must be LF_FACESIZE
#define LF_Bin2A "int[5],BYTE[8],str[32]"
#define LF_BYTELEN 40 // length in bytes (2*5 + 1*8 + LF_FACESIZE)
// NEWLOGFONT (TrueType) values:
#define NLF_A2Bin "int[5],BYTE[8],str,str,str" // str lengths must be LF_FACESIZE, 2 * LF_FACESIZE, LF_FACESIZE
#define NLF_Bin2A "int[5],BYTE[8],str[32],str[64],str[32]"
#define NLF_BYTELEN 136 // NEWLOGFONT length in bytes
// (2*5 + 1*8 + LF_FACESIZE*4)
// LF_Weight values
#define FW_DONTCARE 0
#define FW_THIN 100
#define FW_EXTRALIGHT 200
#define FW_LIGHT 300
#define FW_NORMAL 400
#define FW_MEDIUM 500
#define FW_SEMIBOLD 600
#define FW_BOLD 700
#define FW_EXTRABOLD 800
#define FW_HEAVY 900
#define FW_ULTRALIGHT FW_EXTRALIGHT
#define FW_REGULAR FW_NORMAL
#define FW_DEMIBOLD FW_SEMIBOLD
#define FW_ULTRABOLD FW_EXTRABOLD
#define FW_BLACK FW_HEAVY
// LF_CharSet values
#define ANSI_CHARSET 0
#define DEFAULT_CHARSET 1
#define SYMBOL_CHARSET 2
#define SHIFTJIS_CHARSET 128
#define HANGEUL_CHARSET 129
#define CHINESEBIG5_CHARSET 136
#define OEM_CHARSET 255
// LF_OutPrecision values
#define OUT_DEFAULT_PRECIS 0
#define OUT_STRING_PRECIS 1
#define OUT_CHARACTER_PRECIS 2
#define OUT_STROKE_PRECIS 3
// Win 3.1:
#define OUT_TT_PRECIS 4
#define OUT_DEVICE_PRECIS 5
#define OUT_RASTER_PRECIS 6
#define OUT_TT_ONLY_PRECIS 7
// end of Win 3.1
// LF_ClipPrecision values
#define CLIP_DEFAULT_PRECIS 0
#define CLIP_CHARACTER_PRECIS 1
#define CLIP_STROKE_PRECIS 2
#define CLIP_MASK 15
// Win 3.1:
#define CLIP_LH_ANGLES 16
#define CLIP_TT_ALWAYS 32
#define CLIP_EMBEDDED 128
// end of Win 3.1
// LF_Quality values
#define DEFAULT_QUALITY 0
#define DRAFT_QUALITY 1
#define PROOF_QUALITY 2
// LF_PitchAndFamily pitch values (low 4 bits)
#define DEFAULT_PITCH 0
#define FIXED_PITCH 1
#define VARIABLE_PITCH 2
// LF_PitchAndFamily family values (high 4 bits)
#define FF_DONTCARE 0
#define FF_ROMAN 16
#define FF_SWISS 32
#define FF_MODERN 48
#define FF_SCRIPT 64
#define FF_DECORATIVE 80
#ifndef LOGPIXELSY // maybe user forgot WIN_WANT_GETDEVCAPS
#define LOGPIXELSY 90
#endif
#ifndef RC_INVOKED
#ifndef WORKSHOP_INVOKED
// Remember to specify the device context (hDC) if you want to specify
// point size,
// e.g.
// hDC = GetPrintDC() or CreateDC(...) or PrinterDC() [see printdc.zip]
// CREATE FONT HANDLE hFont FACE "Arial" POINTSIZE 12 DC hDC
// hOldFont = SelectObject(hDC, hFont)
// ...
// SelectObject(hDC, hOldFont)
// DeleteDC(hDC)
// DELETE FONT HANDLE hFont // or DeleteObject(hFont)
// e.g.
// hDC = GetDC(hWnd)
// CREATE FONT HANDLE hFont FACE "Arial" POINTSIZE 12 DC hDC
// hOldFont = SelectObject(hDC, hFont)
// ...
// SelectObject(hDC, hOldFont)
// ReleaseDC(hWnd, hDC)
// DELETE FONT HANDLE hFont // or DeleteObject(hFont)
// e.g.
// CREATE FONT HANDLE hFont FACE "Courier" BOLD
// ...
// DELETE FONT HANDLE hFont // or DeleteObject(hFont)
#command CREATE FONT ;
[OBJECT <o>] ; //TBD: NYI
[HANDLE <h>] ;
[<face: FACENAME, NAME, TYPEFACE> <c>] ;
[<size: POINTSIZE, SIZE> <nPt>] ;
[DC <hDC>] ;
[HEIGHT <nH>] ;
[WIDTH <nW>] ;
[WEIGHT <nWt>] ;
[<thin: THIN>] ;
[<bold: BOLD>] ;
[<ital: ITALIC>] ;
[<und: UNDERLINE>] ;
[<stk: STRIKEOUT>] ;
[<ansi: ANSI>] ;
[<oem: OEM>] ;
[<tt: TRUETYPE>] ;
[<tto: TRUETYPEONLY>] ;
[<draft: DRAFT>] ;
[<proof: PROOF>] ;
[PITCH <pitch>] ;
[FAMILY <fam>] ;
=> [<h> :=] ;
CreateFont({_IF_(<.nPt.>, ;
-(<nPt> * GetDeviceCaps(<hDC>, LOGPIXELSY) / 72),;
<nH>), ;
_IF_(<.nW.>, <nW>, 0), ;
0, ;
0, ;
_IF_(<.nWt.>, <nWt>, 0) ;
+ _IF_(<.thin.>, FW_THIN, 0) ;
+ _IF_(<.bold.>, FW_BOLD, 0), ;
<.ital.>, ;
<.und.>, ;
<.stk.>, ;
_IF_(<.ansi.>, ANSI_CHARSET, 0) ;
+ _IF_(<.oem.>, OEM_CHARSET, DEFAULT_CHARSET), ;
_IF_(<.tt.>, OUT_TT_PRECIS, 0) ;
+ _IF_(<.tto.>, OUT_TT_ONLY_PRECIS, 0), ;
0, ;
_IF_(<.draft.>, DRAFT_QUALITY, 0) ;
+ _IF_(<.proof.>, PROOF_QUALITY, 0), ;
_IF_(<.pitch.>, <pitch>, 0) + _IF_(<.fam.>, <fam>, 0),;
<c>})
#command DELETE FONT ;
[HANDLE <h>] ;
=> DeleteObject(<h>)
#endif // WORKSHOP_INVOKED
#endif // RC_INVOKED
#endif // C4W_FONT_CH