1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
|
/******************************************************************************
*
* Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries.
* All rights reserved.
*
* File: Font.h
*
* Description:
* This file defines font structures and routines.
*
* History:
* September 13, 1994 Created by Art Lamb
* 05/05/98 art Add structures for font mapping table.
* 07/03/98 kwk Added FntWidthToOffset.
* 10/23/98 kwk Changed fontMapTable to 0xC000 (was 0xFFFF).
* 10/20/99 kwk Moved private values to FontPrv.h
*
*****************************************************************************/
#ifndef __FONT_H__
#define __FONT_H__
#include <PalmTypes.h>
#include <CoreTraps.h>
// Pixel width of tab stops in fields
#define fntTabChrWidth 20
// Width of character missing from font.
#define fntMissingChar -1
typedef struct {
Int8 offset;
Int8 width;
} FontCharInfoType, * FontCharInfoPtr;
typedef struct {
Int16 fontType; // font type
Int16 firstChar; // ASCII code of first character
Int16 lastChar; // ASCII code of last character
Int16 maxWidth; // maximum character width
Int16 kernMax; // negative of maximum character kern
Int16 nDescent; // negative of descent
Int16 fRectWidth; // width of font rectangle
Int16 fRectHeight; // height of font rectangle
Int16 owTLoc; // offset to offset/width table
Int16 ascent; // ascent
Int16 descent; // descent
Int16 leading; // leading
Int16 rowWords; // row width of bit image / 2
} FontType;
typedef FontType *FontPtr;
typedef FontPtr *FontTablePtr;
enum fontID {
stdFont = 0x00, // Small font used for the user's writing. Shows a good amount
boldFont, // Small font. Bold for easier reading. Used often for ui.
largeFont, // Larger font for easier reading. Shows a lot less.
symbolFont, // Various ui images like check boxes and arrows
symbol11Font, // Larger various ui images
symbol7Font, // Smaller various ui images
ledFont, // Calculator specific font
largeBoldFont, // A thicker version of the large font. More readable.
fntAppFontCustomBase = 0x80 // First available application-defined font ID
};
typedef enum fontID FontID;
#define checkboxFont symbol11Font
#define FntIsAppDefined(fnt) (fnt >= fntAppFontCustomBase)
//--------------------------------------------------------------------
//
// Font Function
//
//--------------------------------------------------------------------
#ifdef REMOVE_FOR_EMULATOR
#ifdef __cplusplus
extern "C" {
#endif
FontID FntGetFont (void)
SYS_TRAP(sysTrapFntGetFont);
FontID FntSetFont (FontID font)
SYS_TRAP(sysTrapFntSetFont);
FontPtr FntGetFontPtr (void)
SYS_TRAP(sysTrapFntGetFontPtr);
Int16 FntBaseLine (void)
SYS_TRAP(sysTrapFntBaseLine);
Int16 FntCharHeight (void)
SYS_TRAP(sysTrapFntCharHeight);
Int16 FntLineHeight (void)
SYS_TRAP(sysTrapFntLineHeight);
Int16 FntAverageCharWidth (void)
SYS_TRAP(sysTrapFntAverageCharWidth);
Int16 FntCharWidth (Char ch)
SYS_TRAP(sysTrapFntCharWidth);
Int16 FntCharsWidth (Char const *chars, Int16 len)
SYS_TRAP(sysTrapFntCharsWidth);
Int16 FntWidthToOffset (Char const *pChars, UInt16 length,
Int16 pixelWidth, Boolean *leadingEdge, Int16 *truncWidth)
SYS_TRAP(sysTrapFntWidthToOffset);
void FntCharsInWidth (Char const *string,
Int16 *stringWidthP, Int16 *stringLengthP,
Boolean *fitWithinWidth)
SYS_TRAP(sysTrapFntCharsInWidth);
Int16 FntDescenderHeight (void)
SYS_TRAP(sysTrapFntDescenderHeight);
Int16 FntLineWidth (Char const *pChars, UInt16 length)
SYS_TRAP(sysTrapFntLineWidth);
UInt16 FntWordWrap (Char const *chars, UInt16 maxWidth)
SYS_TRAP(sysTrapFntWordWrap);
void FntWordWrapReverseNLines (Char const *const chars,
UInt16 maxWidth, UInt16 *linesToScrollP, UInt16 *scrollPosP)
SYS_TRAP(sysTrapFntWordWrapReverseNLines);
void FntGetScrollValues (Char const *chars, UInt16 width,
UInt16 scrollPos, UInt16 *linesP, UInt16 *topLine)
SYS_TRAP(sysTrapFntGetScrollValues);
Err FntDefineFont (FontID font, FontPtr fontP)
SYS_TRAP(sysTrapFntDefineFont);
#ifdef __cplusplus
}
#endif
#endif
#endif // __FONT_H__
|