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