initial commit
[profile/ivi/xterm.git] / fontutils.h
1 /* $XTermId: fontutils.h,v 1.82 2010/10/11 08:13:54 tom Exp $ */
2
3 /************************************************************
4
5 Copyright 1998-2009,2010 by Thomas E. Dickey
6
7                         All Rights Reserved
8
9 Permission is hereby granted, free of charge, to any person obtaining a
10 copy of this software and associated documentation files (the
11 "Software"), to deal in the Software without restriction, including
12 without limitation the rights to use, copy, modify, merge, publish,
13 distribute, sublicense, and/or sell copies of the Software, and to
14 permit persons to whom the Software is furnished to do so, subject to
15 the following conditions:
16
17 The above copyright notice and this permission notice shall be included
18 in all copies or substantial portions of the Software.
19
20 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 
23 IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
24 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
25 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27
28 Except as contained in this notice, the name(s) of the above copyright
29 holders shall not be used in advertising or otherwise to promote the
30 sale, use or other dealings in this Software without prior written
31 authorization.
32
33 ********************************************************/
34
35 #ifndef included_fontutils_h
36 #define included_fontutils_h 1
37
38 #include <xterm.h>
39
40 extern Bool xtermLoadDefaultFonts (XtermWidget /* xw */);
41 extern Bool xtermOpenFont (XtermWidget /* xw */, const char */* name */, XTermFonts * /* result */, fontWarningTypes /* warn */, Bool /* force */);
42 extern XTermFonts * xtermCloseFont (XtermWidget /* xw */, XTermFonts * /* fnt */);
43 extern const VTFontNames * xtermFontName (const char */* normal */);
44 extern int lookupRelativeFontSize (XtermWidget /* xw */, int /* old */, int /* relative */);
45 extern int xtermGetFont(const char * /* param */);
46 extern int xtermLoadFont (XtermWidget /* xw */, const VTFontNames */* fonts */, Bool /* doresize */, int /* fontnum */);
47 extern void HandleSetFont PROTO_XT_ACTIONS_ARGS;
48 extern void SetVTFont (XtermWidget /* xw */, int /* i */, Bool /* doresize */, const VTFontNames */* fonts */);
49 extern void xtermCloseFonts (XtermWidget /* xw */, XTermFonts * /* fnts[fMAX] */);
50 extern void xtermComputeFontInfo (XtermWidget /* xw */, VTwin */* win */, XFontStruct */* font */, int /* sbwidth */);
51 extern void xtermCopyFontInfo (XTermFonts * /* target */, XTermFonts * /* source */);
52 extern void xtermFreeFontInfo (XTermFonts * /* target */);
53 extern void xtermSaveFontInfo (TScreen * /* screen */, XFontStruct */* font */);
54 extern void xtermSetCursorBox (TScreen * /* screen */);
55 extern void xtermUpdateFontInfo (XtermWidget /* xw */, Bool /* doresize */);
56
57 #if OPT_DEC_CHRSET
58 extern char *xtermSpecialFont (TScreen */* screen */, unsigned /* atts */, unsigned /* chrset */);
59 #endif
60
61 #if OPT_BOX_CHARS
62
63 #define FontIsIncomplete(font) \
64         ((font)->fs != 0 \
65          && (font)->fs->per_char != 0 \
66          && !(font)->fs->all_chars_exist)
67
68 #define ForceBoxChars(screen,ch) \
69         (xtermIsDecGraphic(ch) \
70          && (screen)->force_box_chars)
71
72 #if OPT_WIDE_CHARS
73 #define CharKnownMissing(font, ch) \
74          (((ch) < 256) && ((font)->known_missing[(Char)(ch)] > 1))
75 #else
76 #define CharKnownMissing(font, ch) \
77          ((font)->known_missing[(Char)(ch)] > 1)
78 #endif
79
80 #define IsXtermMissingChar(screen, ch, font) \
81          (CharKnownMissing(font, ch) \
82           ? ((font)->known_missing[(Char)(ch)] > 1) \
83           : ((FontIsIncomplete(font) && xtermMissingChar(ch, font)) \
84            || ForceBoxChars(screen, ch)))
85
86 extern Bool xtermMissingChar (unsigned /* ch */, XTermFonts */* font */);
87 extern void xtermDrawBoxChar (XtermWidget /* xw */, unsigned /* ch */, unsigned /* flags */, GC /* gc */, int /* x */, int /* y */, int /* cols */);
88 #else
89 #define IsXtermMissingChar(screen, ch, font) False
90 #endif
91
92 #if OPT_LOAD_VTFONTS
93 extern void HandleLoadVTFonts PROTO_XT_ACTIONS_ARGS;
94 #endif
95
96 #if OPT_LOAD_VTFONTS || OPT_WIDE_CHARS
97 extern Bool xtermLoadWideFonts (XtermWidget /* w */, Bool /* nullOk */);
98 #endif
99
100 #define xtermIsDecGraphic(ch)   ((ch) > 0 && (ch) < 32)
101
102 #if OPT_RENDERFONT
103 extern Bool xtermXftMissing (XtermWidget /* xw */, XftFont * /* font */, unsigned /* wc */);
104 extern void xtermCloseXft(TScreen * /* screen */, XTermXftFonts * /* pub */);
105 #endif
106
107 #if OPT_SHIFT_FONTS
108 extern String getFaceName(XtermWidget /* xw */, Bool /* wideName */);
109 extern void HandleLargerFont PROTO_XT_ACTIONS_ARGS;
110 extern void HandleSmallerFont PROTO_XT_ACTIONS_ARGS;
111 extern void setFaceName(XtermWidget /* xw */, const char * /*value */);
112 #endif
113
114 #if OPT_WIDE_CHARS
115 extern unsigned ucs2dec (unsigned);
116 extern unsigned dec2ucs (unsigned);
117 #endif
118
119 #endif /* included_fontutils_h */