Here is the patch that introduces an abstract data type glyph_t for a glyph "index". It also changes some local variable names and comments to talk about "glyph" instead of "index" or "glyph index".
The slowdown through the use of a class containing an 'int' instead of an immediate 'int' is hardly noticeable - thanks to the ADDRESSOF optimization in gcc-3.x and the tree-based optimizer in gcc-4.x. Here are the timings measured with gcc-3.3 for "troff -mandoc -Tutf8 gcc.1 > /dev/null" on an old Linux/x86 machine: before: 2.14 sec after: 2.16 sec 2006-02-05 Bruno Haible <[EMAIL PROTECTED]> Make the glyph data type abstract. * src/include/font.h (glyph_t): New class. (name_to_index, number_to_index): Change return type to glyph_t. (font::contains, font::get_width, font::get_height, font::get_depth, font::get_character_type, font::get_kern, font::get_skew, font::get_italic_correction, font::get_left_italic_correction, font::get_subscript_correction, font::get_code, font::get_special_device_encoding, font::add_entry, font::copy_entry, font::add_kern, font::hash_kern): Change argument type to glyph_t. * src/libs/libgroff/font.cpp (struct font_kern_list): Change members type and constructor argument types to glyph_t. (font::contains, font::get_width, font::get_height, font::get_depth, font::get_character_type, font::get_kern, font::get_skew, font::get_italic_correction, font::get_left_italic_correction, font::get_subscript_correction, font::get_code, font::get_special_device_encoding, font::add_entry, font::copy_entry, font::add_kern, font::hash_kern): Change argument type to glyph_t. (font::load): Use glyph_t variables. * src/libs/libgroff/nametoindex.cpp (name_to_index, number_to_index): Change return type to glyph_t. * src/roff/troff/charinfo.h (charinfo::index): Change type to glyph_t. (charinfo::get_index): Change return type to glyph_t. * src/roff/troff/env.cpp: Include font.h. * src/roff/troff/node.cpp: Include font.h before charinfo.h. * src/roff/troff/input.cpp: Include font.h before charinfo.h. (charinfo::charinfo): Update. (name_to_index, number_to_index): Change return type to glyph_t. * src/include/printer.h (printer::set_char_and_width): Change return type to glyph_t. * src/libs/libdriver/printer.cpp (printer::set_char_and_width): Change return type to glyph_t. * src/devices/grodvi/dvi.cpp (dvi_printer::set_char): Change argument type to glyph_t. * src/devices/grohtml/post-html.cpp (page::add_and_encode): Update. (html_printer::space_glyph): Renamed from space_char_index. (html_printer::add_to_sbuf, html_printer::sbuf_continuation, html_printer::overstrike, html_printer::set_char): Change argument type to glyph_t. (html_printer::set_char_and_width): Change return type to glyph_t. * src/devices/grolbp/lbp.cpp (lbp_printer::set_char): Change argument type to glyph_t. * src/devices/grolj4/lj4.cpp (lj4_printer::set_char): Change argument type to glyph_t. * src/devices/grops/ps.cpp (ps_printer::space_glyph): Renamed from space_char_index. (ps_printer::set_subencoding, ps_printer::set_char): Change argument type to glyph_t. * src/devices/grotty/tty.cpp (tty_printer::set_char): Change argument type to glyph_t. diff -r -c3 groff-20060204.orig/src/include/font.h groff-20060204/src/include/font.h --- groff-20060204.orig/src/include/font.h Thu Jan 26 21:51:07 2006 +++ groff-20060204/src/include/font.h Mon Feb 6 01:18:54 2006 @@ -26,6 +26,54 @@ const char *, // file int); // lineno +// A glyph is represented by a font-independent glyph_t object. +// The functions font::name_to_index and font::number_to_index return such +// an object. +struct glyph_t { +private: + int index; // A font-independent integer value. + friend class font; + friend class charinfo; + glyph_t(int); // Glyph with given index. +public: + glyph_t(); // Uninitialized glyph. + static glyph_t undefined_glyph(); // Undefined glyph. + int glyph_index(); + int operator==(const glyph_t&) const; + int operator!=(const glyph_t&) const; +}; + +inline glyph_t::glyph_t(int idx) +: index (idx) +{ +} + +inline glyph_t::glyph_t() +: index (0xdeadbeef) +{ +} + +inline glyph_t glyph_t::undefined_glyph() +{ + return glyph_t(-1); +} +#define UNDEFINED_GLYPH glyph_t::undefined_glyph() + +inline int glyph_t::glyph_index() +{ + return index; +} + +inline int glyph_t::operator==(const glyph_t &other) const +{ + return index == other.index; +} + +inline int glyph_t::operator!=(const glyph_t &other) const +{ + return index != other.index; +} + // Types used in non-public members of `class font'. struct font_kern_list; struct font_char_metric; @@ -34,10 +82,6 @@ // A `class font' instance represents the relevant information of a font of // the given device. This includes the set of glyphs represented by the // font, and metrics for each glyph. -// -// In the member functions a glyph is represented by a font-independent -// integer value called an `index'; the functions font::name_to_index and -// font::number_to_index return such an index. class font { public: enum { // The valid argument values of `has_ligature'. @@ -49,52 +93,51 @@ }; virtual ~font(); // Destructor. - int contains(int); // Return 1 if this font contains the glyph with the - // given index, 0 otherwise. + int contains(glyph_t); // Return 1 if this font contains the given + // glyph, 0 otherwise. int is_special(); // Return 1 if this font is special, 0 otherwise. // See section `Special Fonts' in the info file of // groff. Used by make_glyph_node(). - int get_width(int, int); // A rectangle represents the shape of the - // glyph with the given index (arg1) at the given - // point size (arg2). Return the horizontal - // dimension of this rectangle. - int get_height(int, int); // A rectangle represents the shape of the - // glyph with the given index (arg1) at the given - // point size (arg2). Return the distance between - // the base line and the top of this rectangle. + int get_width(glyph_t, int); // A rectangle represents the shape of the + // given glyph (arg1) at the given point size + // (arg2). Return the horizontal dimension of this + // rectangle. + int get_height(glyph_t, int); // A rectangle represents the shape of the + // given glyph (arg1) at the given point size + // (arg2). Return the distance between the base + // line and the top of this rectangle. // This is often also called the `ascent' of the // glyph. If the top is above the base line, this // value is positive. - int get_depth(int, int); // A rectangle represents the shape of the - // glyph with the given index (arg1) at the given - // point size (arg2). Return the distance between - // the base line and the bottom of this rectangle. + int get_depth(glyph_t, int); // A rectangle represents the shape of the + // given glyph (arg1) at the given point size + // (arg2). Return the distance between the base + // line and the bottom of this rectangle. // This is often also called the `descent' of the // glyph. If the bottom is below the base line, // this value is positive. int get_space_width(int); // Return the normal width of a space at the // given point size. - int get_character_type(int); // Return a bit mask describing the shape of - // the glyph with the given index. Bit 0 is set if - // the character has a descender. Bit 1 is set if - // the character has a tall glyph. See groff - // manual, description of \w and the `ct' register. - int get_kern(int, int, int); // Return the kerning between the glyphs - // with given indices (arg1 and the arg2), both at - // the given point size (arg3). - int get_skew(int, int, int); // A rectangle represents the shape of the - // glyph with the given index (arg1) at the given - // point size (arg2). For slanted fonts like - // Times-Italic, the optical vertical axis is - // naturally slanted. The natural slant value - // (measured in degrees; positive values mean a - // slant to the right) is specified in the font's - // description file (see member variable SLANT - // below). In addition to this, any font can be - // artificially slanted. This artificial slant - // value (arg3, measured in degrees; positive values - // mean a slant to the right) is specified with the - // \S escape. + int get_character_type(glyph_t); // Return a bit mask describing the + // shape of the given glyph. Bit 0 is set if the + // haracter has a descender. Bit 1 is set if the + // character has a tall glyph. See groff manual, + // description of \w and the `ct' register. + int get_kern(glyph_t, glyph_t, int); // Return the kerning between the + // given glyphs (arg1 and arg2), both at the given + // point size (arg3). + int get_skew(glyph_t, int, int); // A rectangle represents the shape + // of the given glyph (arg1) at the given point size + // (arg2). For slanted fonts like Times-Italic, the + // optical vertical axis is naturally slanted. The + // natural slant value (measured in degrees; + // positive values mean aslant to the right) is + // specified in the font's description file (see + // member variable SLANT below). In addition to + // this, any font can be artificially slanted. This + // artificial slant value (arg3, measured in + // degrees; positive values mean a slant to the + // right) is specified with the \S escape. // // Return the skew value which is the horizontal // distance between the upper left corner of the @@ -106,31 +149,29 @@ int has_ligature(int); // Return a non-zero value if this font has // the given ligature type (one of LIG_ff, LIG_fi, // etc.), 0 otherwise. - int get_italic_correction(int, int); // If the glyph with the given index - // (arg1) at the given point size (arg2) is followed - // by an unslanted glyph, some horizontal white + int get_italic_correction(glyph_t, int); // If the given glyph (arg1) + // at the given point size (arg2) is followed by an + // unslanted glyph, some horizontal white space may + // need to be inserted in between. See the groff + // manual, description of \/. Return the amount + // (width) of this white space. + int get_left_italic_correction(glyph_t, int); // If the given glyph (arg1) + // at the given point size (arg2) is preceded by an + // unslanted roman glyph, some horizontal white // space may need to be inserted in between. See - // the groff manual, description of \/. Return the + // the groff manual, description of \,. Return the // amount (width) of this white space. - int get_left_italic_correction(int, int); // If the glyph with the - // given index (arg1) at the given point size (arg2) - // is preceded by an unslanted roman glyph, some - // horizontal white space may need to be inserted in - // between. See the groff manual, description of - // \,. Return the amount (width) of this white - // space. - int get_subscript_correction(int, int); // If the glyph with the - // given index (arg1) at the given point size (arg2) - // is followed by a subscript glyph, the horizontal - // position may need to be advanced by some - // (possibly negative) amount. See groff manual, - // description of \w and the `ssc' register. Return - // this amount. - int get_code(int); // Return the code point in the physical font of the - // glyph with the given index. - const char *get_special_device_encoding(int); // Return special device - // dependent information about the glyph with the - // given index. Return NULL if there is no special + int get_subscript_correction(glyph_t, int); // If the given glyph (arg1) + // at the given point size (arg2)is followed by a + // subscript glyph, the horizontal position may need + // to be advanced by some (possibly negative) + // amount. See groff manual, description of \w and + // the `ssc' register. Return this amount. + int get_code(glyph_t); // Return the code point in the physical + // font of the given glyph. + const char *get_special_device_encoding(glyph_t); // Return special + // device dependent information about the given + // glyph. Return NULL if there is no special // information. const char *get_name(); // Return the name of this font. const char *get_internal_name(); // Return the `internalname' @@ -168,16 +209,21 @@ static int load_desc(); // Open the DESC file (depending on the // device) and initialize some static variables with // info from there. - static int name_to_index(const char *); // Convert the glyph with - // the given name (arg1) to a glyph index. This has + + // The next two functions exist in two versions: one in roff/troff/input.cpp + // for troff, and one for libs/libgroff/nametoindex.cpp for the preprocessors + // and the postprocessors. + static glyph_t name_to_index(const char *); // Convert the glyph with + // the given name (arg1) to a glyph_t. This has // the same semantics as the groff escape sequence - // \C'name'. If such an index does not yet exist, a + // \C'name'. If such a glyph_t does not yet exist, a // new one is allocated. - static int number_to_index(int); // Convert the font-dependent glyph - // with the given number (in the font) to a glyph - // index. This has the same semantics as the groff - // escape sequence \N'number'. If such an index - // does not yet exist, a new one is allocated. + static glyph_t number_to_index(int); // Convert the font-dependent glyph + // with the given number (in the font) to a glyph_t. + // This has the same semantics as the groff escape + // sequence \N'number'. If such a glyph_t does not + // yet exist, a new one is allocated. + static FONT_COMMAND_HANDLER set_unknown_desc_command_handler(FONT_COMMAND_HANDLER); // Register // a function which defines the semantics of @@ -249,19 +295,19 @@ // pairs. // These methods add new characters to the ch_index[] and ch[] arrays. - void add_entry(int, // index + void add_entry(glyph_t, // glyph const font_char_metric &); // metric - void copy_entry(int, // new_index - int); // old_index + void copy_entry(glyph_t, // new_glyph + glyph_t); // old_glyph void alloc_ch_index(int); // index void extend_ch(); void compact(); - void add_kern(int, int, int); // Add to the kerning table a kerning amount - // (arg3) between two glyphs with given indices + void add_kern(glyph_t, glyph_t, int); // Add to the kerning table a + // kerning amount (arg3) between two given glyphs // (arg1 and arg2). - static int hash_kern(int, int); // Return a hash code for the pair - // of glyph indices (arg1 and arg2). + static int hash_kern(glyph_t, glyph_t); // Return a hash code for + // the pair of glyphs (arg1 and arg2). /* Returns w * pointsize / unitwidth, rounded to the nearest integer. */ static int scale(int w, int pointsize); diff -r -c3 groff-20060204.orig/src/devices/grodvi/dvi.cpp groff-20060204/src/devices/grodvi/dvi.cpp --- groff-20060204.orig/src/devices/grodvi/dvi.cpp Thu Jul 7 13:16:42 2005 +++ groff-20060204/src/devices/grodvi/dvi.cpp Mon Feb 6 01:38:30 2006 @@ -1,5 +1,5 @@ // -*- C++ -*- -/* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001, 2002, 2003, 2004 +/* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001, 2002, 2003, 2004, 2006 Free Software Foundation, Inc. Written by James Clark ([EMAIL PROTECTED]) @@ -175,7 +175,7 @@ font *make_font(const char *); void begin_page(int); void end_page(int); - void set_char(int, font *, const environment *, int w, const char *name); + void set_char(glyph_t, font *, const environment *, int w, const char *name); void special(char *arg, const environment *env, char type); void end_of_line(); void draw(int code, int *p, int np, const environment *env); @@ -340,12 +340,12 @@ do_special(buf); } -void dvi_printer::set_char(int idx, font *f, const environment *env, +void dvi_printer::set_char(glyph_t glyph, font *f, const environment *env, int w, const char *) { if (*env->col != cur_color) set_color(env->col); - int code = f->get_code(idx); + int code = f->get_code(glyph); if (env->size != cur_point_size || f != cur_font) { cur_font = f; cur_point_size = env->size; @@ -384,7 +384,7 @@ } possibly_begin_line(); end_h = env->hpos + w; - cur_h += scale(f->get_width(idx, UNITWIDTH)/MULTIPLIER, + cur_h += scale(f->get_width(glyph, UNITWIDTH)/MULTIPLIER, cur_point_size*RES_7227); if (cur_h > max_h) max_h = cur_h; diff -r -c3 groff-20060204.orig/src/devices/grohtml/post-html.cpp groff-20060204/src/devices/grohtml/post-html.cpp --- groff-20060204.orig/src/devices/grohtml/post-html.cpp Sat Feb 4 19:51:39 2006 +++ groff-20060204/src/devices/grohtml/post-html.cpp Mon Feb 6 01:44:36 2006 @@ -1417,10 +1417,9 @@ if (html_glyph) html_string += html_glyph; else { - int idx=s->f->name_to_index((troff_charname + '\0').contents()); - - if (s->f->contains(idx) && (idx != 0)) - html_string += s->f->get_code(idx); + glyph_t glyph = s->f->name_to_index((troff_charname + '\0').contents()); + if (s->f->contains(glyph)) + html_string += s->f->get_code(glyph); } } } else @@ -1939,7 +1938,7 @@ files file_list; simple_output html; int res; - int space_char_index; + glyph_t space_glyph; int space_width; int no_of_printed_pages; int paper_length; @@ -2010,9 +2009,9 @@ void set_line_thickness (const environment *); void terminate_current_font (void); void flush_font (void); - void add_to_sbuf (int index, const string &s); + void add_to_sbuf (glyph_t glyph, const string &s); void write_title (int in_head); - int sbuf_continuation (int index, const char *name, const environment *env, int w); + int sbuf_continuation (glyph_t glyph, const char *name, const environment *env, int w); void flush_page (void); void troff_tag (text_glob *g); void flush_globs (void); @@ -2063,7 +2062,7 @@ void outstanding_eol (int n); int is_bold (font *f); font *make_bold (font *f); - int overstrike (int index, const char *name, const environment *env, int w); + int overstrike (glyph_t glyph, const char *name, const environment *env, int w); void do_body (void); int next_horiz_pos (text_glob *g, int nf); void lookahead_for_tables (void); @@ -2101,9 +2100,9 @@ public: html_printer (); ~html_printer (); - void set_char (int i, font *f, const environment *env, int w, const char *name); + void set_char (glyph_t glyph, font *f, const environment *env, int w, const char *name); void set_numbered_char(int num, const environment *env, int *widthp); - int set_char_and_width(const char *nm, const environment *env, + glyph_t set_char_and_width(const char *nm, const environment *env, int *widthp, font **f); void draw (int code, int *p, int np, const environment *env); void begin_page (int); @@ -4221,7 +4220,7 @@ } res = r; html.set_fixed_point(point); - space_char_index = font::name_to_index("space"); + space_glyph = font::name_to_index("space"); space_width = font::hor; paper_length = font::paperlength; linelength = font::res*13/2; @@ -4235,17 +4234,17 @@ * add_to_sbuf - adds character code or name to the sbuf. */ -void html_printer::add_to_sbuf (int idx, const string &s) +void html_printer::add_to_sbuf (glyph_t glyph, const string &s) { if (sbuf_style.f == NULL) return; const char *html_glyph = NULL; - unsigned int code = sbuf_style.f->get_code(idx); + unsigned int code = sbuf_style.f->get_code(glyph); if (s.empty()) { - if (sbuf_style.f->contains(idx)) - html_glyph = get_html_entity(sbuf_style.f->get_code(idx)); + if (sbuf_style.f->contains(glyph)) + html_glyph = get_html_entity(sbuf_style.f->get_code(glyph)); else html_glyph = NULL; @@ -4261,7 +4260,7 @@ sbuf += html_glyph; } -int html_printer::sbuf_continuation (int idx, const char *name, +int html_printer::sbuf_continuation (glyph_t glyph, const char *name, const environment *env, int w) { /* @@ -4271,7 +4270,7 @@ || ((sbuf_prev_hpos < sbuf_end_hpos) && (env->hpos < sbuf_end_hpos) && ((sbuf_end_hpos-env->hpos < env->hpos-sbuf_prev_hpos)))) { - add_to_sbuf(idx, name); + add_to_sbuf(glyph, name); sbuf_prev_hpos = sbuf_end_hpos; sbuf_end_hpos += w + sbuf_kern; return TRUE; @@ -4283,7 +4282,7 @@ */ if (env->hpos-sbuf_end_hpos < space_width) { - add_to_sbuf(idx, name); + add_to_sbuf(glyph, name); sbuf_prev_hpos = sbuf_end_hpos; sbuf_end_hpos = env->hpos + w; return TRUE; @@ -4300,14 +4299,12 @@ const char *get_html_translation (font *f, const string &name) { - int idx; - if ((f == 0) || name.empty()) return NULL; else { - idx = f->name_to_index((char *)(name + '\0').contents()); - if (f->contains(idx)) - return get_html_entity(f->get_code(idx)); + glyph_t glyph = f->name_to_index((char *)(name + '\0').contents()); + if (f->contains(glyph)) + return get_html_entity(f->get_code(glyph)); else return NULL; } @@ -4579,7 +4576,7 @@ * is flushed. */ -int html_printer::overstrike(int idx, const char *name, const environment *env, int w) +int html_printer::overstrike(glyph_t glyph, const char *name, const environment *env, int w) { if ((env->hpos < sbuf_end_hpos) || ((sbuf_kern != 0) && (sbuf_end_hpos - sbuf_kern < env->hpos))) { @@ -4589,7 +4586,7 @@ if (overstrike_detected) { /* already detected, remove previous glyph and use this glyph */ sbuf.set_length(last_sbuf_length); - add_to_sbuf(idx, name); + add_to_sbuf(glyph, name); sbuf_end_hpos = env->hpos + w; return TRUE; } else { @@ -4598,7 +4595,7 @@ if (! is_bold(sbuf_style.f)) flush_sbuf(); overstrike_detected = TRUE; - add_to_sbuf(idx, name); + add_to_sbuf(glyph, name); sbuf_end_hpos = env->hpos + w; return TRUE; } @@ -4612,7 +4609,7 @@ * and add character anew. */ -void html_printer::set_char(int i, font *f, const environment *env, +void html_printer::set_char(glyph_t glyph, font *f, const environment *env, int w, const char *name) { style sty(f, env->size, env->height, env->slant, env->fontno, *env->col); @@ -4623,13 +4620,14 @@ } } if (((! sbuf.empty()) && (sty == sbuf_style) && (sbuf_vpos == env->vpos)) - && (sbuf_continuation(i, name, env, w) || overstrike(i, name, env, w))) + && (sbuf_continuation(glyph, name, env, w) + || overstrike(glyph, name, env, w))) return; flush_sbuf(); if (sbuf_style.f == NULL) sbuf_style = sty; - add_to_sbuf(i, name); + add_to_sbuf(glyph, name); sbuf_end_hpos = env->hpos + w; sbuf_start_hpos = env->hpos; sbuf_prev_hpos = env->hpos; @@ -4652,7 +4650,7 @@ nbsp_width = -num; num = 160; // } - int i = font::number_to_index(num); + glyph_t glyph = font::number_to_index(num); int fn = env->fontno; if (fn < 0 || fn >= nfonts) { error("bad font position `%1'", fn); @@ -4663,7 +4661,7 @@ error("no font mounted at `%1'", fn); return; } - if (!f->contains(i)) { + if (!f->contains(glyph)) { error("font `%1' does not contain numbered character %2", f->get_name(), num); @@ -4673,28 +4671,28 @@ if (nbsp_width) w = nbsp_width; else - w = f->get_width(i, env->size); + w = f->get_width(glyph, env->size); w = round_width(w); if (widthp) *widthp = w; - set_char(i, f, env, w, 0); + set_char(glyph, f, env, w, 0); } -int html_printer::set_char_and_width(const char *nm, const environment *env, - int *widthp, font **f) +glyph_t html_printer::set_char_and_width(const char *nm, const environment *env, + int *widthp, font **f) { - int i = font::name_to_index(nm); + glyph_t glyph = font::name_to_index(nm); int fn = env->fontno; if (fn < 0 || fn >= nfonts) { error("bad font position `%1'", fn); - return -1; + return UNDEFINED_GLYPH; } *f = font_table[fn]; if (*f == 0) { error("no font mounted at `%1'", fn); - return -1; + return UNDEFINED_GLYPH; } - if (!(*f)->contains(i)) { + if (!(*f)->contains(glyph)) { if (nm[0] != '\0' && nm[1] == '\0') error("font `%1' does not contain ascii character `%2'", (*f)->get_name(), @@ -4703,13 +4701,13 @@ error("font `%1' does not contain special character `%2'", (*f)->get_name(), nm); - return -1; + return UNDEFINED_GLYPH; } - int w = (*f)->get_width(i, env->size); + int w = (*f)->get_width(glyph, env->size); w = round_width(w); if (widthp) *widthp = w; - return i; + return glyph; } /* diff -r -c3 groff-20060204.orig/src/devices/grolbp/lbp.cpp groff-20060204/src/devices/grolbp/lbp.cpp --- groff-20060204.orig/src/devices/grolbp/lbp.cpp Thu Jul 7 13:16:42 2005 +++ groff-20060204/src/devices/grolbp/lbp.cpp Mon Feb 6 01:45:44 2006 @@ -1,5 +1,5 @@ // -*- C++ -*- -/* Copyright (C) 1994, 2000, 2001, 2002, 2003, 2004, 2005 +/* Copyright (C) 1994, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. Written by Francisco Andre Verd <[EMAIL PROTECTED]> with many ideas taken from the other groff drivers. @@ -63,7 +63,7 @@ public: lbp_printer(int, double, double); ~lbp_printer(); - void set_char(int, font *, const environment *, int, const char *name); + void set_char(glyph_t, font *, const environment *, int, const char *name); void draw(int code, int *p, int np, const environment *env); void begin_page(int); void end_page(int page_length); @@ -277,10 +277,10 @@ return bfont_name; } -void lbp_printer::set_char(int idx, font *f, const environment *env, +void lbp_printer::set_char(glyph_t glyph, font *f, const environment *env, int w, const char *) { - int code = f->get_code(idx); + int code = f->get_code(glyph); unsigned char ch = code & 0xff; unsigned short symbol_set = code >> 8; if (f != cur_font) { diff -r -c3 groff-20060204.orig/src/devices/grolj4/lj4.cpp groff-20060204/src/devices/grolj4/lj4.cpp --- groff-20060204.orig/src/devices/grolj4/lj4.cpp Thu Jul 7 13:16:42 2005 +++ groff-20060204/src/devices/grolj4/lj4.cpp Mon Feb 6 01:46:49 2006 @@ -1,5 +1,5 @@ // -*- C++ -*- -/* Copyright (C) 1994, 2000, 2001, 2002, 2003, 2004 +/* Copyright (C) 1994, 2000, 2001, 2002, 2003, 2004, 2006 Free Software Foundation, Inc. Written by James Clark ([EMAIL PROTECTED]) @@ -163,7 +163,7 @@ public: lj4_printer(int); ~lj4_printer(); - void set_char(int, font *, const environment *, int, const char *name); + void set_char(glyph_t, font *, const environment *, int, const char *name); void draw(int code, int *p, int np, const environment *env); void begin_page(int); void end_page(int page_length); @@ -278,10 +278,10 @@ return c < 32 && (c == 0 || (7 <= c && c <= 15) || c == 27); } -void lj4_printer::set_char(int idx, font *f, const environment *env, +void lj4_printer::set_char(glyph_t glyph, font *f, const environment *env, int w, const char *) { - int code = f->get_code(idx); + int code = f->get_code(glyph); unsigned char ch = code & 0xff; unsigned short symbol_set = code >> 8; diff -r -c3 groff-20060204.orig/src/devices/grops/ps.cpp groff-20060204/src/devices/grops/ps.cpp --- groff-20060204.orig/src/devices/grops/ps.cpp Fri Dec 30 16:27:48 2005 +++ groff-20060204/src/devices/grops/ps.cpp Mon Feb 6 01:59:13 2006 @@ -1,5 +1,5 @@ // -*- C++ -*- -/* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001, 2002, 2003, 2004, 2005 +/* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. Written by James Clark ([EMAIL PROTECTED]) @@ -523,7 +523,7 @@ FILE *tempfp; ps_output out; int res; - int space_char_index; + glyph_t space_glyph; int pages_output; int paper_length; int equalise_spaces; @@ -562,7 +562,7 @@ void set_style(const style &); void set_space_code(unsigned char c); int set_encoding_index(ps_font *); - subencoding *set_subencoding(font *, int, unsigned char *); + subencoding *set_subencoding(font *, glyph_t, unsigned char *); char *get_subfont(subencoding *, const char *); void do_exec(char *, const environment *); void do_import(char *, const environment *); @@ -587,7 +587,7 @@ public: ps_printer(double); ~ps_printer(); - void set_char(int i, font *f, const environment *env, int w, + void set_char(glyph_t glyph, font *f, const environment *env, int w, const char *name); void draw(int code, int *p, int np, const environment *env); void begin_page(int); @@ -630,7 +630,7 @@ } res = r; out.set_fixed_point(point); - space_char_index = font::name_to_index("space"); + space_glyph = font::name_to_index("space"); if (pl == 0) paper_length = font::paperlength; else @@ -656,9 +656,9 @@ return f->encoding_index = next_encoding_index++; } -subencoding *ps_printer::set_subencoding(font *f, int i, unsigned char *codep) +subencoding *ps_printer::set_subencoding(font *f, glyph_t glyph, unsigned char *codep) { - unsigned int idx = f->get_code(i); + unsigned int idx = f->get_code(glyph); *codep = idx % 256; unsigned int num = idx >> 8; if (num == 0) @@ -670,7 +670,7 @@ if (p == 0) p = subencodings = new subencoding(f, num, next_subencoding_index++, subencodings); - p->glyphs[*codep] = f->get_special_device_encoding(i); + p->glyphs[*codep] = f->get_special_device_encoding(glyph); return p; } @@ -685,13 +685,13 @@ return sub->subfont; } -void ps_printer::set_char(int i, font *f, const environment *env, int w, +void ps_printer::set_char(glyph_t glyph, font *f, const environment *env, int w, const char *) { - if (i == space_char_index || invis_count > 0) + if (glyph == space_glyph || invis_count > 0) return; unsigned char code; - subencoding *sub = set_subencoding(f, i, &code); + subencoding *sub = set_subencoding(f, glyph, &code); style sty(f, sub, env->size, env->height, env->slant); if (sty.slant != 0) { if (sty.slant > 80 || sty.slant < -80) { @@ -720,8 +720,8 @@ if (sbuf_len < SBUF_SIZE - 1 && env->hpos >= sbuf_end_hpos && (sbuf_kern == 0 || sbuf_end_hpos - sbuf_kern != env->hpos)) { if (sbuf_space_code < 0) { - if (f->contains(space_char_index)) { - sbuf_space_code = f->get_code(space_char_index); + if (f->contains(space_glyph)) { + sbuf_space_code = f->get_code(space_glyph); sbuf_space_width = env->hpos - sbuf_end_hpos; sbuf_end_hpos = env->hpos + w + sbuf_kern; sbuf[sbuf_len++] = sbuf_space_code; @@ -998,7 +998,7 @@ } } if (sbuf_space_code >= 0) { - int w = sbuf_style.f->get_width(space_char_index, sbuf_style.point_size); + int w = sbuf_style.f->get_width(space_glyph, sbuf_style.point_size); if (w + sbuf_kern != sbuf_space_width) { if (sbuf_space_code != output_space_code) { set_space_code(sbuf_space_code); diff -r -c3 groff-20060204.orig/src/devices/grotty/tty.cpp groff-20060204/src/devices/grotty/tty.cpp --- groff-20060204.orig/src/devices/grotty/tty.cpp Thu Jul 7 13:16:42 2005 +++ groff-20060204/src/devices/grotty/tty.cpp Mon Feb 6 01:49:49 2006 @@ -1,5 +1,5 @@ // -*- C++ -*- -/* Copyright (C) 1989-2000, 2001, 2002, 2003, 2004, 2005 +/* Copyright (C) 1989-2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. Written by James Clark ([EMAIL PROTECTED]) @@ -215,7 +218,7 @@ public: tty_printer(const char *device); ~tty_printer(); - void set_char(int, font *, const environment *, int, const char *name); + void set_char(glyph_t, font *, const environment *, int, const char *name); void draw(int code, int *p, int np, const environment *env); void special(char *arg, const environment *env, char type); void change_color(const environment * const env); @@ -360,12 +363,12 @@ return idx; } -void tty_printer::set_char(int i, font *f, const environment *env, +void tty_printer::set_char(glyph_t gly, font *f, const environment *env, int w, const char *) { if (w % font::hor != 0) fatal("width of character not a multiple of horizontal resolution"); - add_char(f->get_code(i), w, + add_char(f->get_code(gly), w, env->hpos, env->vpos, env->col, env->fill, ((tty_font *)f)->get_mode()); diff -r -c3 groff-20060204.orig/src/include/printer.h groff-20060204/src/include/printer.h --- groff-20060204.orig/src/include/printer.h Thu Jul 7 13:16:42 2005 +++ groff-20060204/src/include/printer.h Mon Feb 6 00:18:25 2006 @@ -2,7 +2,7 @@ // <groff_src_dir>/src/include/printer.h -/* Copyright (C) 1989, 1990, 1991, 1992, 2001, 2002, 2003, 2004 +/* Copyright (C) 1989, 1990, 1991, 1992, 2001, 2002, 2003, 2004, 2006 Free Software Foundation, Inc. Written by James Clark ([EMAIL PROTECTED]) @@ -69,8 +69,8 @@ int *widthp = 0); virtual void set_numbered_char(int n, const environment *env, int *widthp = 0); - int set_char_and_width(const char *nm, const environment *env, - int *widthp, font **f); + glyph_t set_char_and_width(const char *nm, const environment *env, + int *widthp, font **f); font *get_font_from_index(int fontno); virtual void draw(int code, int *p, int np, const environment *env); // perform change of line color (text, outline) in the print-out @@ -100,7 +100,7 @@ private: font *find_font(const char *); - virtual void set_char(int index, font *f, const environment *env, + virtual void set_char(glyph_t glyph, font *f, const environment *env, int w, const char *name) = 0; }; diff -r -c3 groff-20060204.orig/src/libs/libdriver/printer.cpp groff-20060204/src/libs/libdriver/printer.cpp --- groff-20060204.orig/src/libs/libdriver/printer.cpp Thu Jul 7 13:16:42 2005 +++ groff-20060204/src/libs/libdriver/printer.cpp Mon Feb 6 01:58:42 2006 @@ -2,7 +2,7 @@ // <groff_src_dir>/src/libs/libdriver/printer.cpp -/* Copyright (C) 1989, 1990, 1991, 1992, 2001, 2002, 2003, 2004, 2005 +/* Copyright (C) 1989, 1990, 1991, 1992, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. Written by James Clark ([EMAIL PROTECTED]) @@ -182,8 +182,8 @@ buf[0] = c; buf[1] = '\0'; - int i = set_char_and_width(buf, env, &w, &f); - set_char(i, f, env, w, 0); + glyph_t glyph = set_char_and_width(buf, env, &w, &f); + set_char(glyph, f, env, w, 0); if (widthp) { *widthp = w; } @@ -194,29 +194,29 @@ { font *f; int w; - int i = set_char_and_width(nm, env, &w, &f); - if (i != -1) { - set_char(i, f, env, w, nm); + glyph_t glyph = set_char_and_width(nm, env, &w, &f); + if (glyph != UNDEFINED_GLYPH) { + set_char(glyph, f, env, w, nm); if (widthp) *widthp = w; } } -int printer::set_char_and_width(const char *nm, const environment *env, - int *widthp, font **f) +glyph_t printer::set_char_and_width(const char *nm, const environment *env, + int *widthp, font **f) { - int i = font::name_to_index(nm); + glyph_t glyph = font::name_to_index(nm); int fn = env->fontno; if (fn < 0 || fn >= nfonts) { error("bad font position `%1'", fn); - return(-1); + return UNDEFINED_GLYPH; } *f = font_table[fn]; if (*f == 0) { error("no font mounted at `%1'", fn); - return(-1); + return UNDEFINED_GLYPH; } - if (!(*f)->contains(i)) { + if (!(*f)->contains(glyph)) { if (nm[0] != '\0' && nm[1] == '\0') error("font `%1' does not contain ascii character `%2'", (*f)->get_name(), @@ -225,17 +225,17 @@ error("font `%1' does not contain special character `%2'", (*f)->get_name(), nm); - return(-1); + return UNDEFINED_GLYPH; } - int w = (*f)->get_width(i, env->size); + int w = (*f)->get_width(glyph, env->size); if (widthp) *widthp = w; - return( i ); + return glyph; } void printer::set_numbered_char(int num, const environment *env, int *widthp) { - int i = font::number_to_index(num); + glyph_t glyph = font::number_to_index(num); int fn = env->fontno; if (fn < 0 || fn >= nfonts) { error("bad font position `%1'", fn); @@ -246,16 +246,16 @@ error("no font mounted at `%1'", fn); return; } - if (!f->contains(i)) { + if (!f->contains(glyph)) { error("font `%1' does not contain numbered character %2", f->get_name(), num); return; } - int w = f->get_width(i, env->size); + int w = f->get_width(glyph, env->size); if (widthp) *widthp = w; - set_char(i, f, env, w, 0); + set_char(glyph, f, env, w, 0); } font *printer::get_font_from_index(int fontno) diff -r -c3 groff-20060204.orig/src/libs/libgroff/font.cpp groff-20060204/src/libs/libgroff/font.cpp --- groff-20060204.orig/src/libs/libgroff/font.cpp Sun Feb 5 23:45:15 2006 +++ groff-20060204/src/libs/libgroff/font.cpp Mon Feb 6 01:58:16 2006 @@ -46,12 +46,12 @@ }; struct font_kern_list { - int i1; - int i2; + glyph_t glyph1; + glyph_t glyph2; int amount; font_kern_list *next; - font_kern_list(int, int, int, font_kern_list * = 0); + font_kern_list(glyph_t, glyph_t, int, font_kern_list * = 0); }; struct font_widths_cache { @@ -238,15 +238,17 @@ return 0; } -int font::get_skew(int c, int point_size, int sl) +int font::get_skew(glyph_t c, int point_size, int sl) { int h = get_height(c, point_size); return int(h*tan((slant+sl)*PI/180.0) + .5); } -int font::contains(int c) +int font::contains(glyph_t c) { - return c >= 0 && c < nindices && ch_index[c] >= 0; + int idx = c.glyph_index(); + assert(idx >= 0); + return idx < nindices && ch_index[idx] >= 0; } int font::is_special() @@ -268,10 +270,11 @@ a_delete width; } -int font::get_width(int c, int point_size) +int font::get_width(glyph_t c, int point_size) { - assert(c >= 0 && c < nindices); - int i = ch_index[c]; + int idx = c.glyph_index(); + assert(idx >= 0 && idx < nindices); + int i = ch_index[idx]; assert(i >= 0); if (point_size == unitwidth || font::unscaled_charwidths) @@ -299,34 +302,39 @@ return w; } -int font::get_height(int c, int point_size) +int font::get_height(glyph_t c, int point_size) { - assert(c >= 0 && c < nindices && ch_index[c] >= 0); - return scale(ch[ch_index[c]].height, point_size); + int idx = c.glyph_index(); + assert(idx >= 0 && idx < nindices && ch_index[idx] >= 0); + return scale(ch[ch_index[idx]].height, point_size); } -int font::get_depth(int c, int point_size) +int font::get_depth(glyph_t c, int point_size) { - assert(c >= 0 && c < nindices && ch_index[c] >= 0); - return scale(ch[ch_index[c]].depth, point_size); + int idx = c.glyph_index(); + assert(idx >= 0 && idx < nindices && ch_index[idx] >= 0); + return scale(ch[ch_index[idx]].depth, point_size); } -int font::get_italic_correction(int c, int point_size) +int font::get_italic_correction(glyph_t c, int point_size) { - assert(c >= 0 && c < nindices && ch_index[c] >= 0); - return scale(ch[ch_index[c]].italic_correction, point_size); + int idx = c.glyph_index(); + assert(idx >= 0 && idx < nindices && ch_index[idx] >= 0); + return scale(ch[ch_index[idx]].italic_correction, point_size); } -int font::get_left_italic_correction(int c, int point_size) +int font::get_left_italic_correction(glyph_t c, int point_size) { - assert(c >= 0 && c < nindices && ch_index[c] >= 0); - return scale(ch[ch_index[c]].pre_math_space, point_size); + int idx = c.glyph_index(); + assert(idx >= 0 && idx < nindices && ch_index[idx] >= 0); + return scale(ch[ch_index[idx]].pre_math_space, point_size); } -int font::get_subscript_correction(int c, int point_size) +int font::get_subscript_correction(glyph_t c, int point_size) { - assert(c >= 0 && c < nindices && ch_index[c] >= 0); - return scale(ch[ch_index[c]].subscript_correction, point_size); + int idx = c.glyph_index(); + assert(idx >= 0 && idx < nindices && ch_index[idx] >= 0); + return scale(ch[ch_index[idx]].subscript_correction, point_size); } int font::get_space_width(int point_size) @@ -334,33 +342,33 @@ return scale(space_width, point_size); } -font_kern_list::font_kern_list(int c1, int c2, int n, font_kern_list *p) -: i1(c1), i2(c2), amount(n), next(p) +font_kern_list::font_kern_list(glyph_t c1, glyph_t c2, int n, font_kern_list *p) +: glyph1(c1), glyph2(c2), amount(n), next(p) { } -inline int font::hash_kern(int i1, int i2) +inline int font::hash_kern(glyph_t glyph1, glyph_t glyph2) { - int n = ((i1 << 10) + i2) % KERN_HASH_TABLE_SIZE; + int n = ((glyph1.glyph_index() << 10) + glyph2.glyph_index()) % KERN_HASH_TABLE_SIZE; return n < 0 ? -n : n; } -void font::add_kern(int i1, int i2, int amount) +void font::add_kern(glyph_t glyph1, glyph_t glyph2, int amount) { if (!kern_hash_table) { kern_hash_table = new font_kern_list *[int(KERN_HASH_TABLE_SIZE)]; for (int i = 0; i < KERN_HASH_TABLE_SIZE; i++) kern_hash_table[i] = 0; } - font_kern_list **p = kern_hash_table + hash_kern(i1, i2); - *p = new font_kern_list(i1, i2, amount, *p); + font_kern_list **p = kern_hash_table + hash_kern(glyph1, glyph2); + *p = new font_kern_list(glyph1, glyph2, amount, *p); } -int font::get_kern(int i1, int i2, int point_size) +int font::get_kern(glyph_t glyph1, glyph_t glyph2, int point_size) { if (kern_hash_table) { - for (font_kern_list *p = kern_hash_table[hash_kern(i1, i2)]; p; p = p->next) - if (i1 == p->i1 && i2 == p->i2) + for (font_kern_list *p = kern_hash_table[hash_kern(glyph1, glyph2)]; p; p = p->next) + if (glyph1 == p->glyph1 && glyph2 == p->glyph2) return scale(p->amount, point_size); } return 0; @@ -371,16 +379,18 @@ return mask & ligatures; } -int font::get_character_type(int c) +int font::get_character_type(glyph_t c) { - assert(c >= 0 && c < nindices && ch_index[c] >= 0); - return ch[ch_index[c]].type; + int idx = c.glyph_index(); + assert(idx >= 0 && idx < nindices && ch_index[idx] >= 0); + return ch[ch_index[idx]].type; } -int font::get_code(int c) +int font::get_code(glyph_t c) { - assert(c >= 0 && c < nindices && ch_index[c] >= 0); - return ch[ch_index[c]].code; + int idx = c.glyph_index(); + assert(idx >= 0 && idx < nindices && ch_index[idx] >= 0); + return ch[ch_index[idx]].code; } const char *font::get_name() @@ -393,10 +403,11 @@ return internalname; } -const char *font::get_special_device_encoding(int c) +const char *font::get_special_device_encoding(glyph_t c) { - assert(c >= 0 && c < nindices && ch_index[c] >= 0); - return ch[ch_index[c]].special_device_coding; + int idx = c.glyph_index(); + assert(idx >= 0 && idx < nindices && ch_index[idx] >= 0); + return ch[ch_index[idx]].special_device_coding; } const char *font::get_image_generator() @@ -465,8 +476,9 @@ } } -void font::add_entry(int idx, const font_char_metric &metric) +void font::add_entry(glyph_t glyph, const font_char_metric &metric) { + int idx = glyph.glyph_index(); assert(idx >= 0); if (idx >= nindices) alloc_ch_index(idx); @@ -478,8 +490,10 @@ ch[ch_used++] = metric; } -void font::copy_entry(int new_index, int old_index) +void font::copy_entry(glyph_t new_glyph, glyph_t old_glyph) { + int new_index = new_glyph.glyph_index(); + int old_index = old_glyph.glyph_index(); assert(new_index >= 0 && old_index >= 0 && old_index < nindices); if (new_index >= nindices) alloc_ch_index(new_index); @@ -676,14 +690,15 @@ t.error("bad kern amount `%1'", p); return 0; } - int i1 = name_to_index(c1); - int i2 = name_to_index(c2); - add_kern(i1, i2, n); + glyph_t glyph1 = name_to_index(c1); + glyph_t glyph2 = name_to_index(c2); + add_kern(glyph1, glyph2, n); } } else if (strcmp(command, "charset") == 0) { had_charset = 1; - int last_index = -1; + glyph_t last_glyph; + int got_last_glyph = 0; for (;;) { if (!t.next()) { command = 0; @@ -698,7 +713,7 @@ break; } if (p[0] == '"') { - if (last_index == -1) { + if (!got_last_glyph) { t.error("first charset entry is duplicate"); return 0; } @@ -706,8 +721,8 @@ t.error("unnamed character cannot be duplicate"); return 0; } - int idx = name_to_index(nm); - copy_entry(idx, last_index); + glyph_t glyph = name_to_index(nm); + copy_entry(glyph, last_glyph); } else { font_char_metric metric; @@ -761,17 +776,18 @@ metric.special_device_coding = nam; } if (strcmp(nm, "---") == 0) { - last_index = number_to_index(metric.code); - add_entry(last_index, metric); + last_glyph = number_to_index(metric.code); + add_entry(last_glyph, metric); } else { - last_index = name_to_index(nm); - add_entry(last_index, metric); - copy_entry(number_to_index(metric.code), last_index); + last_glyph = name_to_index(nm); + add_entry(last_glyph, metric); + copy_entry(number_to_index(metric.code), last_glyph); } + got_last_glyph = 1; } } - if (last_index == -1) { + if (!got_last_glyph) { t.error("I didn't seem to find any characters"); return 0; } diff -r -c3 groff-20060204.orig/src/libs/libgroff/nametoindex.cpp groff-20060204/src/libs/libgroff/nametoindex.cpp --- groff-20060204.orig/src/libs/libgroff/nametoindex.cpp Thu Jul 7 13:16:42 2005 +++ groff-20060204/src/libs/libgroff/nametoindex.cpp Sun Feb 5 23:47:38 2006 @@ -1,5 +1,5 @@ // -*- C++ -*- -/* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001, 2002, 2003, 2004 +/* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001, 2002, 2003, 2004, 2006 Free Software Foundation, Inc. Written by James Clark ([EMAIL PROTECTED]) @@ -95,23 +95,23 @@ static character_indexer indexer; -int font::number_to_index(int n) +glyph_t font::number_to_index(int n) { - return indexer.numbered_char_index(n); + return glyph_t(indexer.numbered_char_index(n)); } -int font::name_to_index(const char *s) +glyph_t font::name_to_index(const char *s) { assert(s != 0 && s[0] != '\0' && s[0] != ' '); if (s[1] == '\0') - return indexer.ascii_char_index(s[0]); + return glyph_t(indexer.ascii_char_index(s[0])); /* char128 and \200 are synonyms */ if (s[0] == 'c' && s[1] == 'h' && s[2] == 'a' && s[3] == 'r') { char *val; long n = strtol(s + 4, &val, 10); if (val != s + 4 && *val == '\0' && n >= 0 && n < 256) - return indexer.ascii_char_index((unsigned char)n); + return glyph_t(indexer.ascii_char_index((unsigned char)n)); } - return indexer.named_char_index(s); + return glyph_t(indexer.named_char_index(s)); } diff -r -c3 groff-20060204.orig/src/roff/troff/charinfo.h groff-20060204/src/roff/troff/charinfo.h --- groff-20060204.orig/src/roff/troff/charinfo.h Thu Jul 7 13:16:43 2005 +++ groff-20060204/src/roff/troff/charinfo.h Mon Feb 6 01:09:05 2006 @@ -1,5 +1,5 @@ // -*- C++ -*- -/* Copyright (C) 1989, 1990, 1991, 1992, 2001, 2002 +/* Copyright (C) 1989, 1990, 1991, 1992, 2001, 2002, 2006 Free Software Foundation, Inc. Written by James Clark ([EMAIL PROTECTED]) @@ -24,7 +24,7 @@ class charinfo { static int next_index; charinfo *translation; - int index; + glyph_t index; int number; macro *mac; unsigned char special_translation; @@ -57,7 +57,7 @@ }; symbol nm; charinfo(symbol s); - int get_index(); + glyph_t get_index(); int ends_sentence(); int overlaps_vertically(); int overlaps_horizontally(); @@ -171,7 +171,7 @@ flags = c; } -inline int charinfo::get_index() +inline glyph_t charinfo::get_index() { return index; } diff -r -c3 groff-20060204.orig/src/roff/troff/env.cpp groff-20060204/src/roff/troff/env.cpp --- groff-20060204.orig/src/roff/troff/env.cpp Thu Jul 7 13:16:43 2005 +++ groff-20060204/src/roff/troff/env.cpp Mon Feb 6 01:12:09 2006 @@ -1,5 +1,5 @@ // -*- C++ -*- -/* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001, 2002, 2003, 2004, 2005 +/* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. Written by James Clark ([EMAIL PROTECTED]) @@ -30,6 +30,7 @@ #include "token.h" #include "div.h" #include "reg.h" +#include "font.h" #include "charinfo.h" #include "macropath.h" #include "input.h" diff -r -c3 groff-20060204.orig/src/roff/troff/input.cpp groff-20060204/src/roff/troff/input.cpp --- groff-20060204.orig/src/roff/troff/input.cpp Sun Feb 5 23:45:15 2006 +++ groff-20060204/src/roff/troff/input.cpp Mon Feb 6 01:53:14 2006 @@ -32,11 +32,11 @@ #include "token.h" #include "div.h" #include "reg.h" +#include "font.h" #include "charinfo.h" #include "macropath.h" #include "input.h" #include "defs.h" -#include "font.h" #include "unicode.h" // Needed for getpid() and isatty() @@ -8093,7 +8093,7 @@ not_found(0), transparent_translate(1), translate_input(0), mode(CHAR_NORMAL), nm(s) { - index = next_index++; + index = glyph_t(next_index++); } void charinfo::set_hyphenation_code(unsigned char c) @@ -8193,7 +8193,7 @@ } } -int font::name_to_index(const char *nm) +glyph_t font::name_to_index(const char *nm) { charinfo *ci; if (nm[1] == 0) @@ -8208,7 +8208,7 @@ return ci->get_index(); } -int font::number_to_index(int n) +glyph_t font::number_to_index(int n) { return get_charinfo_by_number(n)->get_index(); } diff -r -c3 groff-20060204.orig/src/roff/troff/node.cpp groff-20060204/src/roff/troff/node.cpp --- groff-20060204.orig/src/roff/troff/node.cpp Thu Jul 7 13:16:43 2005 +++ groff-20060204/src/roff/troff/node.cpp Mon Feb 6 01:11:22 2006 @@ -1,5 +1,5 @@ // -*- C++ -*- -/* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001, 2002, 2003, 2004, 2005 +/* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. Written by James Clark ([EMAIL PROTECTED]) @@ -37,8 +37,8 @@ #include "token.h" #include "div.h" #include "reg.h" -#include "charinfo.h" #include "font.h" +#include "charinfo.h" #include "input.h" #include "geometry.h" _______________________________________________ Groff mailing list Groff@gnu.org http://lists.gnu.org/mailman/listinfo/groff