/***********************************************************
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
******************************************************************/
#include <X11/Xfuncproto.h>
* This version of the server font data structure is only for describing
* the in memory data structure. The file structure is not necessarily a
* copy of this. That is up to the compiler and the OS layer font loading
#define GLYPHPADOPTIONS 4 /* 1, 2, 4, or 8 */
typedef struct _FontProp {
long value; /* assumes ATOM is not larger than INT32 */
typedef struct _FontResolution {
unsigned short x_resolution;
unsigned short y_resolution;
unsigned short point_size;
typedef struct _ExtentInfo {
DrawDirection drawDirection;
typedef struct _CharInfo {
xCharInfo metrics; /* info preformatted for Queries */
char *bits; /* pointer to glyph image */
* Font is created at font load time. It is specific to a single encoding.
* e.g. not all of the glyphs in a font may be part of a single encoding.
typedef struct _FontInfo {
unsigned short defaultCh;
unsigned int noOverlap:1;
unsigned int terminalFont:1;
unsigned int constantMetrics:1;
unsigned int constantWidth:1;
unsigned int inkInside:1;
unsigned int inkMetrics:1;
unsigned int drawDirection:2;
unsigned int anamorphic:1;
int (*get_glyphs) (FontPtr /* font */,
unsigned long /* count */,
unsigned char * /* chars */,
FontEncoding /* encoding */,
unsigned long * /* count */,
CharInfoPtr * /* glyphs */);
int (*get_metrics) (FontPtr /* font */,
unsigned long /* count */,
unsigned char * /* chars */,
FontEncoding /* encoding */,
unsigned long * /* count */,
xCharInfo ** /* glyphs */);
void (*unload_font) (FontPtr /* font */);
void (*unload_glyphs) (FontPtr /* font */);
#define FontGetPrivate(pFont,n) ((n) > (pFont)->maxPrivate ? (void *) 0 : \
#define FontSetPrivate(pFont,n,ptr) ((n) > (pFont)->maxPrivate ? \
_FontSetNewPrivate (pFont, n, ptr) : \
((((pFont)->devPrivates[n] = (ptr)) != 0) || TRUE))
typedef struct _FontNames {
/* External view of font paths */
typedef struct _FontPathElement {
#if FONT_PATH_ELEMENT_NAME_CONST
typedef Bool (*NameCheckFunc) (const char *name);
typedef int (*InitFpeFunc) (FontPathElementPtr fpe);
typedef int (*FreeFpeFunc) (FontPathElementPtr fpe);
typedef int (*ResetFpeFunc) (FontPathElementPtr fpe);
typedef int (*OpenFontFunc) ( void *client,
fsBitmapFormatMask fmask,
FontPtr non_cachable_font);
typedef void (*CloseFontFunc) (FontPathElementPtr fpe, FontPtr pFont);
typedef int (*ListFontsFunc) (void *client,
typedef int (*StartLfwiFunc) (void *client,
typedef int (*NextLfwiFunc) (void *client,
typedef int (*WakeupFpeFunc) (FontPathElementPtr fpe,
unsigned long* LastSelectMask);
typedef void (*ClientDiedFunc) (void *client,
typedef int (*LoadGlyphsFunc) (void *client,
typedef int (*StartLaFunc) (void *client,
typedef int (*NextLaFunc) (void *client,
typedef void (*SetPathFunc)(void);
typedef struct _FPEFunctions {
NameCheckFunc name_check;
CloseFontFunc close_font;
ListFontsFunc list_fonts;
StartLaFunc start_list_fonts_and_aliases;
NextLaFunc list_next_font_or_alias;
StartLfwiFunc start_list_fonts_with_info;
NextLfwiFunc list_next_font_with_info;
WakeupFpeFunc wakeup_fpe;
ClientDiedFunc client_died;
/* for load_glyphs, range_flag = 0 ->
nchars = # of characters in data
data = list of characters
nchars = # of fsChar2b's in data
data = list of fsChar2b's */
LoadGlyphsFunc load_glyphs;
SetPathFunc set_path_hook;
} FPEFunctionsRec, FPEFunctions;
* Various macros for computing values based on contents of
#define GLYPHWIDTHPIXELS(pci) \
((pci)->metrics.rightSideBearing - (pci)->metrics.leftSideBearing)
#define GLYPHHEIGHTPIXELS(pci) \
((pci)->metrics.ascent + (pci)->metrics.descent)
#define GLYPHWIDTHBYTES(pci) (((GLYPHWIDTHPIXELS(pci))+7) >> 3)
#define GLYPHWIDTHPADDED(bc) (((bc)+7) & ~0x7)
#define BYTES_PER_ROW(bits, nbytes) \
((nbytes) == 1 ? (((bits)+7)>>3) /* pad to 1 byte */ \
:(nbytes) == 2 ? ((((bits)+15)>>3)&~1) /* pad to 2 bytes */ \
:(nbytes) == 4 ? ((((bits)+31)>>3)&~3) /* pad to 4 bytes */ \
:(nbytes) == 8 ? ((((bits)+63)>>3)&~7) /* pad to 8 bytes */ \
#define BYTES_FOR_GLYPH(ci,pad) (GLYPHHEIGHTPIXELS(ci) * \
BYTES_PER_ROW(GLYPHWIDTHPIXELS(ci),pad))
* Macros for computing different bounding boxes for fonts; from
#define FONT_MAX_ASCENT(pi) ((pi)->fontAscent > (pi)->ink_maxbounds.ascent ? \
(pi)->fontAscent : (pi)->ink_maxbounds.ascent)
#define FONT_MAX_DESCENT(pi) ((pi)->fontDescent > (pi)->ink_maxbounds.descent ? \
(pi)->fontDescent : (pi)->ink_maxbounds.descent)
#define FONT_MAX_HEIGHT(pi) (FONT_MAX_ASCENT(pi) + FONT_MAX_DESCENT(pi))
#define FONT_MIN_LEFT(pi) ((pi)->ink_minbounds.leftSideBearing < 0 ? \
(pi)->ink_minbounds.leftSideBearing : 0)
#define FONT_MAX_RIGHT(pi) ((pi)->ink_maxbounds.rightSideBearing > \
(pi)->ink_maxbounds.characterWidth ? \
(pi)->ink_maxbounds.rightSideBearing : \
(pi)->ink_maxbounds.characterWidth)
#define FONT_MAX_WIDTH(pi) (FONT_MAX_RIGHT(pi) - FONT_MIN_LEFT(pi))