summaryrefslogtreecommitdiff
path: root/charspace/char.h
blob: a424a4ce2f3920de4033ed2b8ca213535c0c9781 (plain)
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
/* char.h: the definition of `char_type'.

Copyright (C) 1992, 2011 Free Software Foundation, Inc.

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 3, 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 program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */

#ifndef CHAR_H
#define CHAR_H

#include "font.h"
#include "list.h"
#include "realstrval.h"

/* We want these to mean the values in our own structure.  */
#undef CHAR_LSB
#undef CHAR_RSB


/* A side bearing can be defined almost like a symbol (no `char_type').  */
typedef struct
{
  symval_tag_type tag;
  real_string_val_type value;
} sidebearing_type;

#define SB_TAG(sb) ((sb).tag)
#define SB_VALUE(sb) ((sb).value)
#define SB_REAL(sb) ((sb).value.real_val)
#define SB_STRING(sb) ((sb).value.string_val)

/* The information about each character in which we're interested.  */
typedef struct
{
  char_info_type *char_info;
  tfm_char_type *tfm_info;
  sidebearing_type *lsb, *rsb;
  list_type kerns; /* We use `char_kern_type' for the elements.  */
} char_type;


/* The information from the bitmap font.  */
#define CHAR_BITMAP_INFO(c) ((c).char_info)
#define CHAR_CHARCODE(c) CHARCODE (*CHAR_BITMAP_INFO (c))

/* The information from the TFM file.  */
#define CHAR_TFM_INFO(c) ((c).tfm_info)

/* Information we've collected for the sidebearings.  */
#define CHAR_LSB(c) ((c).lsb)
#define CHAR_LSB_TAG(c) (CHAR_LSB (c)->tag)
#define CHAR_LSB_VALUE(c) (CHAR_LSB (c)->value)

#define CHAR_RSB(c) ((c).rsb)
#define CHAR_RSB_TAG(c) (CHAR_RSB (c)->tag)
#define CHAR_RSB_VALUE(c) (CHAR_RSB (c)->value)

#define CHAR_KERNS(c) ((c).kerns)

/* Initialize the various fields.  */
extern char_type init_char (void);

/* Get the font information for CODE, and update *C_PTR_ADDR from the
   symbol table and encoding vector.  */
extern void do_char (charcode_type code, char_type **c_ptr_addr);

/* Looks up `designsize' in the symbol table and converts the result
   back to printer's points.  */
extern real get_designsize_in_points (void);

#endif /* not CHAR_H */