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
|
/*
* (C)opyright MMIV-MMVI Anselm R. Garbe <garbeam at gmail dot com>
* See LICENSE file for license details.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <locale.h>
unsigned int
textwidth_l(BlitzFont *font, char *text, unsigned int len)
{
if(font->set) {
XRectangle r;
XmbTextExtents(font->set, text, len, nil, &r);
return r.width;
}
return XTextWidth(font->xfont, text, len);
}
unsigned int
textwidth(BlitzFont *font, char *text)
{
return blitz_textwidth_l(font, text, strlen(text));
}
void
loadfont(Blitz *blitz, BlitzFont *font)
{
char *fontname = font->fontstr;
char **missing = nil, *def = "?";
int n;
setlocale(LC_ALL, "");
if(font->set)
XFreeFontSet(blitz->dpy, font->set);
font->set = XCreateFontSet(blitz->dpy, fontname, &missing, &n, &def);
if/* Utility macros for the W3 code library
MACROS FOR GENERAL USE
See also: the system dependent file "tcp.h", which is included here.
*/
#ifndef DEBUG
#define DEBUG /* Noone ever turns this off as trace is too important */
#endif /* Keep option for really small memory applications tho */
#ifndef HTUTILS_H
#define HTUTILS_H
#ifdef HAVE_CONFIG_H
#include <lynx_cfg.h> /* generated by autoconf 'configure' script */
#include <sys/types.h>
#include <stdio.h>
#else
#include <stdio.h>
#define DONT_TRACK_INTERNAL_LINKS 1
/* Explicit system-configure */
#ifdef VMS
#define NO_SIZECHANGE
#define NO_UNISTD_H
#define NO_KEYPAD
#define NO_UTMP
#define NO_FILIO_H
#endif
/* FIXME: these will be removed after completing auto-configure script */
/* Accommodate pre-autoconf Makefile */
#ifndef NO_CBREAK
#define HAVE_CBREAK 1
#endif
#ifndef NO_CUSERID
#define HAVE_CUSERID 1
#endif
#ifndef NO_FILIO_H
#define HAVE_SYS_FILIO_H 1
#endif
#ifndef NO_GETCWD
#define HAVE_GETCWD 1
#endif
#ifndef USE_SLANG
#ifndef NO_KEYPAD
#define HAVE_KEYPAD 1
#endif
#ifndef NO_TTYTYPE
#define HAVE_TTYTYPE 1
#endif
#endif /* USE_SLANG */
#ifndef NO_PUTENV
#define HAVE_PUTENV 1
#endif
#ifndef NO_SIZECHANGE
#define HAVE_SIZECHANGE 1
#endif
#ifndef NO_UNISTD_H
#define HAVE_UNISTD_H 1
#endif
#ifndef NO_UTMP
#define HAVE_UTMP 1
#endif
#endif /* HAVE_CONFIG_H */
#ifndef LY_MAXPATH
#define LY_MAXPATH 256
#endif
#ifndef GCC_UNUSED
#define GCC_UNUSED /* nothing */
#endif
#ifdef _WINDOWS /* SCW */
#include <windef.h>
#define BOOLEAN_DEFINED
#define va_arg
#include <dos.h>
#define popen _popen
#define pclose _pclose
#endif /* _WINDOWS */
#ifdef __EMX__
#include <unistd.h> /* should be re-include protected under EMX */
#include <stdlib.h> /* should be re-include protected under EMX */
#define getcwd _getcwd2
#define chdir _chdir2
#endif
#ifdef SHORT_NAMES
#define WWW_TraceFlag HTTrFlag
#endif
/*
Debug message control.
*/
#ifdef DEBUG
|