[go: up one dir, main page]

Menu

[f2b791]: / src / font.h  Maximize  Restore  History

Download this file

146 lines (116 with data), 3.8 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
/* $Id$
* font.h
* Copyright (C) 1997-1999 Maciej Stachowiak and Greg J. Badros
*
* This module is all original code
* by Maciej Stachowiak and Greg J. Badros.
* It may be used or distributed under either the FVWM license
* (see COPYING.FVWM) or the GNU General Public License (see COPYING.GPL and
* the description below)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING.GPL. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*
* As a special exception, this file may alternatively be distributed under
* the fvwm license (see COPYING.FVWM).
*
*/
#ifndef FONT_H
#define FONT_H
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <libguile.h>
#undef EXTERN
#undef EXTERN_SET
#ifdef FONT_IMPLEMENTATION
#define EXTERN
#define EXTERN_SET(x,y) x = y
#else
#define EXTERN extern
#define EXTERN_SET(x,y) extern x
#endif
EXTERN long scm_tc16_scwm_font;
EXTERN SCM str_fixed;
typedef struct {
#ifdef I18N
XFontSet fontset;
int ascent;
XFontStruct *xfs; /* Dummy of font structure */
#else
XFontStruct *xfs; /* font structure */
#endif
int height; /* height of the font */
SCM name;
} scwm_font;
#ifdef I18N
#define XFIXEDFONTNAME "-*-fixed-*"
#else
#define XFIXEDFONTNAME "fixed"
#endif
#define FONT_P(X) (SCM_NIMP((X)) && gh_car((X)) == (SCM)scm_tc16_scwm_font)
#define FONT(X) ((scwm_font *)gh_cdr((X)))
#define SAFE_FONT(X) (FONT_P((X))?FONT((X)):NULL)
#define DYNAMIC_FONT_P(X) (gh_symbol_p((X))? \
FONT_P(scm_symbol_binding(SCM_BOOL_F,(X))) : \
FONT_P((X)))
#define FONT_OR_SYMBOL_P(x) (FONT_P((x)) || gh_symbol_p((x)))
#define DYNAMIC_SAFE_FONT(X) (gh_symbol_p((X))? \
SAFE_FONT(scm_symbol_binding(SCM_BOOL_F,(X))) : \
SAFE_FONT((X)))
#ifdef I18N
#define XFONT(X) (((scwm_font *)gh_cdr((X)))->fontset)
#define FONTY(X) (((scwm_font *)gh_cdr((X)))->ascent)
#else
#define XFONT(X) (((scwm_font *)gh_cdr((X)))->xfs)
#define FONTY(X) ((XFONT(X))->ascent)
#endif
#define XFONTID(X) (((scwm_font *)gh_cdr((X)))->xfs->fid)
#define SAFE_XFONT(X) (FONT_P((X))?XFONT((X)):NULL)
#define FONTNAME(X) (((scwm_font *)gh_cdr(X))->name)
#define SAFE_FONTNAME(X) (FONT_P((X))?FONTNAME((X)):NULL)
#define FONTHEIGHT(X) (((scwm_font *)gh_cdr(X))->height)
SCM make_font(SCM fname);
/* GJB:FIXME:: this primitive should not be exposed
it is used by decor.c now --03/22/99 gjb */
SCM set_title_font_x(SCM font);
extern SCM scmFixedFont;
#define VALIDATE_ARG_FONT(pos,scm) \
do { \
if (!FONT_P(scm)) scm_wrong_type_arg(FUNC_NAME,pos,scm); \
} while (0)
#define VALIDATE_ARG_FONT_OR_SYM(pos,scm) \
do { \
if (!FONT_OR_SYMBOL_P(scm)) scm_wrong_type_arg(FUNC_NAME,pos,scm); \
} while (0)
#define VALIDATE_ARG_FONT_COPY(pos,scm,cvar) \
do { \
if (!FONT_P(scm)) scm_wrong_type_arg(FUNC_NAME,pos,scm); \
else cvar = FONT(scm); \
} while (0)
#define VALIDATE_ARG_FONT_OR_STRING(pos,scm) \
do { \
if (gh_string_p(scm)) scm = make_font(scm); \
if (!FONT_P(scm)) scm_wrong_type_arg(FUNC_NAME,pos,scm); \
} while (0)
#endif /* FONT_H */
/* Local Variables: */
/* tab-width: 8 */
/* c-basic-offset: 2 */
/* End: */
/* vim:ts=8:sw=2:sta
*/