diff options
author | wl <wl> | 2006-02-11 17:48:09 +0000 |
---|---|---|
committer | wl <wl> | 2006-02-11 17:48:09 +0000 |
commit | 05c54bfdc6b809f5b21b791c92232150e9f4b4db (patch) | |
tree | 38a0bbd9548324bf4b71a73077321b2a8bbe4ae9 /src/devices/grops | |
parent | 8e01e118b1796617d4186d24990bca22def6d080 (diff) | |
download | groff-05c54bfdc6b809f5b21b791c92232150e9f4b4db.tar.gz |
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.
Diffstat (limited to 'src/devices/grops')
-rw-r--r-- | src/devices/grops/ps.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/devices/grops/ps.cpp b/src/devices/grops/ps.cpp index 98feb4bd..39c31b38 100644 --- a/src/devices/grops/ps.cpp +++ b/src/devices/grops/ps.cpp @@ -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 (jjc@jclark.com) @@ -523,7 +523,7 @@ class ps_printer : public printer { 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 @@ class ps_printer : public printer { 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 @@ class ps_printer : public printer { 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 @@ ps_printer::ps_printer(double pl) } 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 @@ int ps_printer::set_encoding_index(ps_font *f) 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 @@ subencoding *ps_printer::set_subencoding(font *f, int i, unsigned char *codep) 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 @@ char *ps_printer::get_subfont(subencoding *sub, const char *stem) 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 @@ void ps_printer::set_char(int i, font *f, const environment *env, int w, 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 @@ void ps_printer::flush_sbuf() } } 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); |