"Fossies" - the Fresh Open Source Software Archive

Member "xterm-379/fontutils.h" (23 Oct 2022, 8110 Bytes) of package /linux/misc/xterm-379.tgz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "fontutils.h" see the Fossies "Dox" file reference documentation and the last Fossies "Diffs" side-by-side code changes report: 374_vs_375.

    1 /* $XTermId: fontutils.h,v 1.142 2022/10/23 14:47:45 tom Exp $ */
    2 
    3 /*
    4  * Copyright 1998-2021,2022 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 
   39 extern Bool xtermLoadDefaultFonts (XtermWidget /* xw */);
   40 extern Bool xtermOpenFont (XtermWidget /* xw */, const char */* name */, XTermFonts * /* result */, XTermFonts * /* current */, Bool /* force */);
   41 extern XFontStruct * xtermLoadQueryFont(XtermWidget /* xw */, const char * /*name */);
   42 extern XTermFonts * getDoubleFont (TScreen * /* screen */, int /* which */);
   43 extern XTermFonts * getItalicFont (TScreen * /* screen */, int /* which */);
   44 extern XTermFonts * getNormalFont (TScreen * /* screen */, int /* which */);
   45 extern const VTFontNames * defaultVTFontNames(XtermWidget /* xw */);
   46 extern const VTFontNames * xtermFontName (const char */* normal */);
   47 extern const char * whichFontEnum (VTFontEnum /* value */);
   48 extern const char * whichFontList (XtermWidget /* xw */, VTFontList * /* value */);
   49 extern const char * whichFontList2(XtermWidget /* xw */, char ** /* value */);
   50 extern int lookupRelativeFontSize (XtermWidget /* xw */, int /* old */, int /* relative */);
   51 extern int xtermGetFont (const char * /* param */);
   52 extern int xtermLoadFont (XtermWidget /* xw */, const VTFontNames */* fonts */, Bool /* doresize */, int /* fontnum */);
   53 extern void HandleSetFont PROTO_XT_ACTIONS_ARGS;
   54 extern Bool SetVTFont (XtermWidget /* xw */, int /* i */, Bool /* doresize */, const VTFontNames */* fonts */);
   55 extern void allocFontList (XtermWidget /* xw */, const char * /* name */, XtermFontNames * /* target */, VTFontEnum /* which */, const char * /* source */, Bool /* ttf */);
   56 extern void copyFontList (char *** /* targetp */, char ** /* source */);
   57 extern void initFontLists (XtermWidget /* xw */);
   58 extern void freeFontList (char *** /* targetp */);
   59 extern void freeFontLists (VTFontList * /* lists */);
   60 extern void xtermCloseFont (XtermWidget /* xw */, XTermFonts * /* fnt */);
   61 extern void xtermCloseFonts (XtermWidget /* xw */, XTermFonts * /* fnts[fMAX] */);
   62 extern void xtermComputeFontInfo (XtermWidget /* xw */, VTwin */* win */, XFontStruct */* font */, int /* sbwidth */);
   63 extern void xtermCopyFontInfo (XTermFonts * /* target */, XTermFonts * /* source */);
   64 extern void xtermDerivedFont (const char * /* name */);
   65 extern void xtermFreeFontInfo (XTermFonts * /* target */);
   66 extern void xtermSetCursorBox (TScreen * /* screen */);
   67 extern void xtermUpdateFontGCs (XtermWidget /* xw */, MyGetFont /* myfunc */);
   68 extern void xtermUpdateFontInfo (XtermWidget /* xw */, Bool /* doresize */);
   69 
   70 #define getIconicFont(screen) (&((screen)->fnt_icon))
   71 
   72 /* use these when "which" is constant, or known in-limits */
   73 #define GetNormalFont(screen, which) (&((screen)->fnts[which]))
   74 #define GetDoubleFont(screen, which) (&((screen)->double_fonts[which]))
   75 #if OPT_WIDE_ATTRS
   76 #define GetItalicFont(screen, which) (&((screen)->ifnts[which]))
   77 #else
   78 #define GetItalicFont(screen, which) 0
   79 #endif
   80 
   81 #define FirstItemOf(vector) ((vector) ? (vector)[0] : 0)
   82 #define CurrentXftFont(xw)  ((xw)->work.fonts.xft.list_n[0])
   83 #define DefaultFontN(xw)    ((xw)->work.fonts.x11.list_n[0])
   84 #define DefaultFontB(xw)    ((xw)->work.fonts.x11.list_b[0])
   85 #define DefaultFontW(xw)    ((xw)->work.fonts.x11.list_w[0])
   86 #define DefaultFontWB(xw)   ((xw)->work.fonts.x11.list_wb[0])
   87 
   88 #if OPT_DEC_CHRSET
   89 extern char *xtermSpecialFont (XTermDraw * /* params */);
   90 #endif
   91 
   92 #define FontLacksMetrics(font) \
   93     ((font)->fs != 0 \
   94      && ((font)->fs->per_char == 0))
   95 
   96 #define FontIsIncomplete(font) \
   97     ((font)->fs != 0 \
   98      && (font)->fs->per_char != 0 \
   99      && !(font)->fs->all_chars_exist)
  100 
  101 #if OPT_BOX_CHARS
  102 
  103 #define ForceBoxChars(screen,ch) \
  104     (xtermIsDecGraphic(ch) \
  105      && (screen)->force_box_chars)
  106 
  107      /*
  108       * Keep track of (some) characters to make the check for missing
  109       * characters faster.  If the character is known to be missing,
  110       * the cache value is '2'.  If we have checked the character, the
  111       * cached value is '1'.
  112       */
  113 #if OPT_WIDE_CHARS
  114 #define CheckedKnownMissing(font, ch) \
  115      (((ch) < MaxUChar) && ((font)->known_missing[(Char)(ch)] > 0))
  116 #else
  117 #define CheckedKnownMissing(font, ch) \
  118      ((font)->known_missing[(Char)(ch)] > 0)
  119 #endif
  120 
  121 #define IsXtermMissingChar(screen, ch, font) \
  122      (CheckedKnownMissing(font, ch) \
  123       ? ((font)->known_missing[(Char)(ch)] > 1) \
  124       : ((FontIsIncomplete(font) && xtermMissingChar(ch, font)) \
  125        || ForceBoxChars(screen, ch)))
  126 
  127 extern void xtermDrawBoxChar (XTermDraw * /* params */, unsigned /* ch */, GC /* gc */, int /* x */, int /* y */, int /* cols */, Bool /* xftords */);
  128 #else
  129 #define IsXtermMissingChar(screen, ch, font) False
  130 #endif
  131 
  132 #if OPT_BOX_CHARS || OPT_REPORT_FONTS
  133 extern Bool xtermMissingChar (unsigned /* ch */, XTermFonts */* font */);
  134 #endif
  135 
  136 #if OPT_LOAD_VTFONTS
  137 extern void HandleLoadVTFonts PROTO_XT_ACTIONS_ARGS;
  138 #endif
  139 
  140 #if OPT_LOAD_VTFONTS || OPT_WIDE_CHARS
  141 extern Bool xtermLoadWideFonts (XtermWidget /* w */, Bool /* nullOk */);
  142 extern void xtermSaveVTFonts (XtermWidget /* xw */);
  143 #endif
  144 
  145 #define xtermIsDecGraphic(ch)   ((ch) > 0 && (ch) < 32)
  146 
  147 #if OPT_RENDERFONT
  148 extern Boolean maybeXftCache(XtermWidget /* xw */, XftFont * /* font */);
  149 extern Bool xtermXftMissing (XtermWidget /* xw */, XTermXftFonts * /* fontData */, int /* fontNum */, XftFont * /* font */, unsigned /* wc */);
  150 extern XTermXftFonts *getMyXftFont (XtermWidget /* xw */, int /* which */, int /* fontnum */);
  151 extern const char * whichXftFonts(XtermWidget /* xw */, XTermXftFonts * /* data */);
  152 extern int findXftGlyph (XtermWidget /* xw */, XTermXftFonts * /* fontData */, unsigned /* wc */);
  153 extern XftFont *getXftFont (XtermWidget /* xw */, VTFontEnum /* which */, int /* fontnum */);
  154 extern void closeCachedXft (TScreen * /* screen */, XftFont * /* font */);
  155 extern void xtermCloseXft (TScreen * /* screen */, XTermXftFonts * /* pub */);
  156 #if OPT_DEC_CHRSET
  157 extern void getDoubleXftFont(XTermDraw * /* params */, XTermXftFonts * /* fontData */, unsigned /* chrset */, unsigned /* attr_flags */);
  158 #endif
  159 #endif
  160 
  161 #if OPT_SHIFT_FONTS
  162 extern String getFaceName (XtermWidget /* xw */, Bool /* wideName */);
  163 extern void HandleLargerFont PROTO_XT_ACTIONS_ARGS;
  164 extern void HandleSmallerFont PROTO_XT_ACTIONS_ARGS;
  165 extern void setFaceName (XtermWidget /* xw */, const char * /*value */);
  166 #endif
  167 
  168 #if OPT_WIDE_ATTRS
  169 extern unsigned xtermUpdateItalics (XtermWidget /* xw */, unsigned /* new_attrs */, unsigned /* old_attrs */);
  170 extern void xtermLoadItalics (XtermWidget /* xw */);
  171 #endif
  172 
  173 #if OPT_WIDE_CHARS
  174 extern unsigned ucs2dec (TScreen * /* screen */, unsigned /* ch */);
  175 extern unsigned dec2ucs (TScreen * /* screen */, unsigned /* ch */);
  176 #endif
  177 
  178 /* *INDENT-ON* */
  179 
  180 #endif /* included_fontutils_h */