[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Groff-commit] groff ./ChangeLog src/devices/grohtml/post-html...
From: |
Werner LEMBERG |
Subject: |
[Groff-commit] groff ./ChangeLog src/devices/grohtml/post-html... |
Date: |
Fri, 17 Feb 2006 16:39:43 +0000 |
CVSROOT: /cvsroot/groff
Module name: groff
Branch:
Changes by: Werner LEMBERG <address@hidden> 06/02/17 16:39:43
Modified files:
. : ChangeLog
src/devices/grohtml: post-html.cpp
src/devices/grops: ps.cpp
src/include : font.h
src/libs/libdriver: printer.cpp
src/libs/libgroff: font.cpp nametoindex.cpp
src/roff/troff : charinfo.h input.cpp node.cpp
Log message:
* src/include/font.h (name_to_glyph): Renamed from
font::name_to_index.
(number_to_glyph): Renamed from font::number_to_index.
(glyph_to_name): Renamed from font::index_to_name.
(glyph_to_number): Renamed from font::index_to_number.
* src/libs/libgroff/nametoindex.cpp: Likewise.
* src/roff/troff/charinfo.h (charinfo::as_glyph): Renamed from
charinfo::get_index.
* src/roff/troff/input.cpp: All callers changed.
* src/roff/troff/node.cpp: Likewise.
* src/libs/libgroff/font.cpp: Likewise.
* src/devices/grops/ps.cpp: Likewise.
* src/devices/grohtml/post-html.cpp: Likewise.
* src/libs/libdriver/printer.cpp: Likewise.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/groff/groff/ChangeLog.diff?tr1=1.905&tr2=1.906&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/groff/groff/src/devices/grohtml/post-html.cpp.diff?tr1=1.32&tr2=1.33&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/groff/groff/src/devices/grops/ps.cpp.diff?tr1=1.11&tr2=1.12&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/groff/groff/src/include/font.h.diff?tr1=1.13&tr2=1.14&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/groff/groff/src/libs/libdriver/printer.cpp.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/groff/groff/src/libs/libgroff/font.cpp.diff?tr1=1.10&tr2=1.11&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/groff/groff/src/libs/libgroff/nametoindex.cpp.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/groff/groff/src/roff/troff/charinfo.h.diff?tr1=1.11&tr2=1.12&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/groff/groff/src/roff/troff/input.cpp.diff?tr1=1.31&tr2=1.32&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/groff/groff/src/roff/troff/node.cpp.diff?tr1=1.20&tr2=1.21&r1=text&r2=text
Patches:
Index: groff/ChangeLog
diff -u groff/ChangeLog:1.905 groff/ChangeLog:1.906
--- groff/ChangeLog:1.905 Fri Feb 17 16:29:25 2006
+++ groff/ChangeLog Fri Feb 17 16:39:42 2006
@@ -1,3 +1,21 @@
+2006-02-17 Bruno Haible <address@hidden>
+
+ * src/include/font.h (name_to_glyph): Renamed from
+ font::name_to_index.
+ (number_to_glyph): Renamed from font::number_to_index.
+ (glyph_to_name): Renamed from font::index_to_name.
+ (glyph_to_number): Renamed from font::index_to_number.
+ * src/libs/libgroff/nametoindex.cpp: Likewise.
+ * src/roff/troff/charinfo.h (charinfo::as_glyph): Renamed from
+ charinfo::get_index.
+
+ * src/roff/troff/input.cpp: All callers changed.
+ * src/roff/troff/node.cpp: Likewise.
+ * src/libs/libgroff/font.cpp: Likewise.
+ * src/devices/grops/ps.cpp: Likewise.
+ * src/devices/grohtml/post-html.cpp: Likewise.
+ * src/libs/libdriver/printer.cpp: Likewise.
+
2006-02-17 Werner LEMBERG <address@hidden>
* src/include/ptable.h, src/include/itable.h
Index: groff/src/devices/grohtml/post-html.cpp
diff -u groff/src/devices/grohtml/post-html.cpp:1.32
groff/src/devices/grohtml/post-html.cpp:1.33
--- groff/src/devices/grohtml/post-html.cpp:1.32 Sat Feb 11 20:34:36 2006
+++ groff/src/devices/grohtml/post-html.cpp Fri Feb 17 16:39:43 2006
@@ -1417,7 +1417,7 @@
if (html_glyph)
html_string += html_glyph;
else {
- glyph g = s->f->name_to_index((troff_charname + '\0').contents());
+ glyph g = name_to_glyph((troff_charname + '\0').contents());
if (s->f->contains(g))
html_string += s->f->get_code(g);
}
@@ -4220,7 +4220,7 @@
}
res = r;
html.set_fixed_point(point);
- space_glyph = font::name_to_index("space");
+ space_glyph = name_to_glyph("space");
space_width = font::hor;
paper_length = font::paperlength;
linelength = font::res*13/2;
@@ -4302,7 +4302,7 @@
if ((f == 0) || name.empty())
return NULL;
else {
- glyph g = f->name_to_index((char *)(name + '\0').contents());
+ glyph g = name_to_glyph((char *)(name + '\0').contents());
if (f->contains(g))
return get_html_entity(f->get_code(g));
else
@@ -4650,7 +4650,7 @@
nbsp_width = -num;
num = 160; //
}
- glyph g = font::number_to_index(num);
+ glyph g = number_to_glyph(num);
int fn = env->fontno;
if (fn < 0 || fn >= nfonts) {
error("bad font position `%1'", fn);
@@ -4681,7 +4681,7 @@
glyph html_printer::set_char_and_width(const char *nm, const environment *env,
int *widthp, font **f)
{
- glyph g = font::name_to_index(nm);
+ glyph g = name_to_glyph(nm);
int fn = env->fontno;
if (fn < 0 || fn >= nfonts) {
error("bad font position `%1'", fn);
Index: groff/src/devices/grops/ps.cpp
diff -u groff/src/devices/grops/ps.cpp:1.11 groff/src/devices/grops/ps.cpp:1.12
--- groff/src/devices/grops/ps.cpp:1.11 Sat Feb 11 20:34:36 2006
+++ groff/src/devices/grops/ps.cpp Fri Feb 17 16:39:43 2006
@@ -630,7 +630,7 @@
}
res = r;
out.set_fixed_point(point);
- space_glyph = font::name_to_index("space");
+ space_glyph = name_to_glyph("space");
if (pl == 0)
paper_length = font::paperlength;
else
Index: groff/src/include/font.h
diff -u groff/src/include/font.h:1.13 groff/src/include/font.h:1.14
--- groff/src/include/font.h:1.13 Fri Feb 17 16:23:21 2006
+++ groff/src/include/font.h Fri Feb 17 16:39:43 2006
@@ -27,8 +27,7 @@
int); // lineno
// A glyph is represented by a font-independent `glyph' object.
-// The functions font::name_to_index and font::number_to_index return such
-// an object.
+// The functions name_to_glyph and number_to_glyph return such an object.
//
// There are two types of glyphs:
//
@@ -54,7 +53,6 @@
struct glyph {
private:
glyphinfo *ptr; // Pointer to the complete information.
- friend class font;
friend class character_indexer;
friend class charinfo;
glyph(glyphinfo *); // Glyph with given complete information.
@@ -104,6 +102,37 @@
return ptr != other.ptr;
}
+// The next two functions and glyph::glyph_name() exist in two versions: one in
+// roff/troff/input.cpp for troff, and one in
+// libs/libgroff/nametoindex.cpp for the preprocessors and the
+// postprocessors.
+extern glyph name_to_glyph(const char *); // Convert the glyph with
+ // the given name (arg1) to a `glyph' object. This
+ // has the same semantics as the groff escape sequence
+ // \C'name'. If such a `glyph' object does not yet
+ // exist, a new one is allocated.
+extern glyph number_to_glyph(int); // Convert the font-dependent glyph
+ // with the given number (in the font) to a `glyph'
+ // object. This has the same semantics as the groff
+ // escape sequence \N'number'. If such a `glyph'
+ // object does not yet exist, a new one is allocated.
+inline const char *glyph_to_name(glyph); // Convert the given glyph
+ // back to its name. Return NULL if the glyph
+ // doesn't have a name.
+inline int glyph_to_number(glyph); // Convert the given glyph back to
+ // its number. Return -1 if it does not designate
+ // a numbered character.
+
+inline const char *glyph_to_name(glyph g)
+{
+ return g.glyph_name();
+}
+
+inline int glyph_to_number(glyph g)
+{
+ return g.glyph_number();
+}
+
// Types used in non-public members of `class font'.
struct font_kern_list;
struct font_char_metric;
@@ -240,27 +269,6 @@
// device) and initialize some static variables with
// info from there.
- // The next two functions exist in two versions: one in
- // roff/troff/input.cpp for troff, and one in
- // libs/libgroff/nametoindex.cpp for the preprocessors and the
- // postprocessors.
- static glyph name_to_index(const char *); // Convert the glyph with
- // the given name (arg1) to a `glyph' object. This
- // has the same semantics as the groff escape sequence
- // \C'name'. If such a `glyph' object does not yet
- // exist, a new one is allocated.
- static glyph number_to_index(int); // Convert the font-dependent glyph
- // with the given number (in the font) to a `glyph'
- // object. This has the same semantics as the groff
- // escape sequence \N'number'. If such a `glyph'
- // object does not yet exist, a new one is allocated.
- static const char *index_to_name(glyph); // Convert the given glyph
- // back to its name. Return NULL if the glyph
- // doesn't have a name.
- static int index_to_number(glyph); // Convert the given glyph back to
- // its number. Return -1 if it does not designate
- // a numbered character.
-
static FONT_COMMAND_HANDLER
set_unknown_desc_command_handler(FONT_COMMAND_HANDLER); // Register
// a function which defines the semantics of
@@ -374,14 +382,4 @@
// case of failure.
};
-inline const char *font::index_to_name(glyph g)
-{
- return g.glyph_name();
-}
-
-inline int font::index_to_number(glyph g)
-{
- return g.glyph_number();
-}
-
// end of font.h
Index: groff/src/libs/libdriver/printer.cpp
diff -u groff/src/libs/libdriver/printer.cpp:1.6
groff/src/libs/libdriver/printer.cpp:1.7
--- groff/src/libs/libdriver/printer.cpp:1.6 Sat Feb 11 20:34:36 2006
+++ groff/src/libs/libdriver/printer.cpp Fri Feb 17 16:39:43 2006
@@ -205,7 +205,7 @@
glyph printer::set_char_and_width(const char *nm, const environment *env,
int *widthp, font **f)
{
- glyph g = font::name_to_index(nm);
+ glyph g = name_to_glyph(nm);
int fn = env->fontno;
if (fn < 0 || fn >= nfonts) {
error("bad font position `%1'", fn);
@@ -235,7 +235,7 @@
void printer::set_numbered_char(int num, const environment *env, int *widthp)
{
- glyph g = font::number_to_index(num);
+ glyph g = number_to_glyph(num);
int fn = env->fontno;
if (fn < 0 || fn >= nfonts) {
error("bad font position `%1'", fn);
Index: groff/src/libs/libgroff/font.cpp
diff -u groff/src/libs/libgroff/font.cpp:1.10
groff/src/libs/libgroff/font.cpp:1.11
--- groff/src/libs/libgroff/font.cpp:1.10 Sat Feb 11 20:34:37 2006
+++ groff/src/libs/libgroff/font.cpp Fri Feb 17 16:39:43 2006
@@ -693,8 +693,8 @@
t.error("bad kern amount `%1'", p);
return 0;
}
- glyph g1 = name_to_index(c1);
- glyph g2 = name_to_index(c2);
+ glyph g1 = name_to_glyph(c1);
+ glyph g2 = name_to_glyph(c2);
add_kern(g1, g2, n);
}
}
@@ -724,7 +724,7 @@
t.error("unnamed character cannot be duplicate");
return 0;
}
- glyph g = name_to_index(nm);
+ glyph g = name_to_glyph(nm);
copy_entry(g, last_glyph);
}
else {
@@ -779,13 +779,13 @@
metric.special_device_coding = nam;
}
if (strcmp(nm, "---") == 0) {
- last_glyph = number_to_index(metric.code);
+ last_glyph = number_to_glyph(metric.code);
add_entry(last_glyph, metric);
}
else {
- last_glyph = name_to_index(nm);
+ last_glyph = name_to_glyph(nm);
add_entry(last_glyph, metric);
- copy_entry(number_to_index(metric.code), last_glyph);
+ copy_entry(number_to_glyph(metric.code), last_glyph);
}
got_last_glyph = 1;
}
Index: groff/src/libs/libgroff/nametoindex.cpp
diff -u groff/src/libs/libgroff/nametoindex.cpp:1.7
groff/src/libs/libgroff/nametoindex.cpp:1.8
--- groff/src/libs/libgroff/nametoindex.cpp:1.7 Fri Feb 17 16:23:21 2006
+++ groff/src/libs/libgroff/nametoindex.cpp Fri Feb 17 16:39:43 2006
@@ -127,12 +127,12 @@
static character_indexer indexer;
-glyph font::number_to_index(int n)
+glyph number_to_glyph(int n)
{
return indexer.numbered_char_index(n);
}
-glyph font::name_to_index(const char *s)
+glyph name_to_glyph(const char *s)
{
assert(s != 0 && s[0] != '\0' && s[0] != ' ');
if (s[1] == '\0')
Index: groff/src/roff/troff/charinfo.h
diff -u groff/src/roff/troff/charinfo.h:1.11
groff/src/roff/troff/charinfo.h:1.12
--- groff/src/roff/troff/charinfo.h:1.11 Fri Feb 17 16:23:21 2006
+++ groff/src/roff/troff/charinfo.h Fri Feb 17 16:39:43 2006
@@ -55,7 +55,7 @@
};
symbol nm;
charinfo(symbol s);
- glyph get_index();
+ glyph as_glyph();
int ends_sentence();
int overlaps_vertically();
int overlaps_horizontally();
@@ -169,7 +169,7 @@
flags = c;
}
-inline glyph charinfo::get_index()
+inline glyph charinfo::as_glyph()
{
return glyph(this);
}
Index: groff/src/roff/troff/input.cpp
diff -u groff/src/roff/troff/input.cpp:1.31 groff/src/roff/troff/input.cpp:1.32
--- groff/src/roff/troff/input.cpp:1.31 Fri Feb 17 16:23:21 2006
+++ groff/src/roff/troff/input.cpp Fri Feb 17 16:39:43 2006
@@ -8195,7 +8195,7 @@
}
}
-glyph font::name_to_index(const char *nm)
+glyph name_to_glyph(const char *nm)
{
charinfo *ci;
if (nm[1] == 0)
@@ -8204,15 +8204,12 @@
ci = get_charinfo(symbol(nm + 1));
else
ci = get_charinfo(symbol(nm));
- if (ci == 0)
- abort();
- else
- return ci->get_index();
+ return ci->as_glyph();
}
-glyph font::number_to_index(int n)
+glyph number_to_glyph(int n)
{
- return get_charinfo_by_number(n)->get_index();
+ return get_charinfo_by_number(n)->as_glyph();
}
const char *glyph::glyph_name()
Index: groff/src/roff/troff/node.cpp
diff -u groff/src/roff/troff/node.cpp:1.20 groff/src/roff/troff/node.cpp:1.21
--- groff/src/roff/troff/node.cpp:1.20 Sat Feb 11 20:34:37 2006
+++ groff/src/roff/troff/node.cpp Fri Feb 17 16:39:43 2006
@@ -234,7 +234,7 @@
inline int font_info::contains(charinfo *ci)
{
- return fm != 0 && fm->contains(ci->get_index());
+ return fm != 0 && fm->contains(ci->as_glyph());
}
inline int font_info::is_special()
@@ -431,8 +431,8 @@
hunits font_info::get_narrow_space_width(font_size fs)
{
charinfo *ci = get_charinfo(symbol("|"));
- if (fm->contains(ci->get_index()))
- return hunits(fm->get_width(ci->get_index(), fs.to_scaled_points()));
+ if (fm->contains(ci->as_glyph()))
+ return hunits(fm->get_width(ci->as_glyph(), fs.to_scaled_points()));
else
return hunits(fs.to_units()/6);
}
@@ -440,8 +440,8 @@
hunits font_info::get_half_narrow_space_width(font_size fs)
{
charinfo *ci = get_charinfo(symbol("^"));
- if (fm->contains(ci->get_index()))
- return hunits(fm->get_width(ci->get_index(), fs.to_scaled_points()));
+ if (fm->contains(ci->as_glyph()))
+ return hunits(fm->get_width(ci->as_glyph(), fs.to_scaled_points()));
else
return hunits(fs.to_units()/12);
}
@@ -491,16 +491,16 @@
if (is_constant_spaced)
return constant_space_width;
else if (is_bold)
- return (hunits(fm->get_width(c->get_index(), size.to_scaled_points()))
+ return (hunits(fm->get_width(c->as_glyph(), size.to_scaled_points()))
+ track_kern + bold_offset);
else
- return (hunits(fm->get_width(c->get_index(), size.to_scaled_points()))
+ return (hunits(fm->get_width(c->as_glyph(), size.to_scaled_points()))
+ track_kern);
}
vunits tfont::get_char_height(charinfo *c)
{
- vunits v = fm->get_height(c->get_index(), size.to_scaled_points());
+ vunits v = fm->get_height(c->as_glyph(), size.to_scaled_points());
if (height != 0 && height != size.to_scaled_points())
return scale(v, height, size.to_scaled_points());
else
@@ -509,7 +509,7 @@
vunits tfont::get_char_depth(charinfo *c)
{
- vunits v = fm->get_depth(c->get_index(), size.to_scaled_points());
+ vunits v = fm->get_depth(c->as_glyph(), size.to_scaled_points());
if (height != 0 && height != size.to_scaled_points())
return scale(v, height, size.to_scaled_points());
else
@@ -518,23 +518,23 @@
hunits tfont::get_char_skew(charinfo *c)
{
- return hunits(fm->get_skew(c->get_index(), size.to_scaled_points(), slant));
+ return hunits(fm->get_skew(c->as_glyph(), size.to_scaled_points(), slant));
}
hunits tfont::get_italic_correction(charinfo *c)
{
- return hunits(fm->get_italic_correction(c->get_index(),
size.to_scaled_points()));
+ return hunits(fm->get_italic_correction(c->as_glyph(),
size.to_scaled_points()));
}
hunits tfont::get_left_italic_correction(charinfo *c)
{
- return hunits(fm->get_left_italic_correction(c->get_index(),
+ return hunits(fm->get_left_italic_correction(c->as_glyph(),
size.to_scaled_points()));
}
hunits tfont::get_subscript_correction(charinfo *c)
{
- return hunits(fm->get_subscript_correction(c->get_index(),
+ return hunits(fm->get_subscript_correction(c->as_glyph(),
size.to_scaled_points()));
}
@@ -545,12 +545,12 @@
inline int tfont::contains(charinfo *ci)
{
- return fm->contains(ci->get_index());
+ return fm->contains(ci->as_glyph());
}
inline int tfont::get_character_type(charinfo *ci)
{
- return fm->get_character_type(ci->get_index());
+ return fm->get_character_type(ci->as_glyph());
}
inline int tfont::get_bold(hunits *res)
@@ -642,7 +642,7 @@
break;
}
}
- if (ci != 0 && fm->contains(ci->get_index()))
+ if (ci != 0 && fm->contains(ci->as_glyph()))
return ci;
return 0;
}
@@ -652,8 +652,8 @@
if (kern_mode == 0)
return 0;
else {
- int n = fm->get_kern(c1->get_index(),
- c2->get_index(),
+ int n = fm->get_kern(c1->as_glyph(),
+ c2->as_glyph(),
size.to_scaled_points());
if (n) {
*res = hunits(n);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Groff-commit] groff ./ChangeLog src/devices/grohtml/post-html...,
Werner LEMBERG <=