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