[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Groff-commit] groff ChangeLog NEWS doc/groff.texinfo man/grof...
From: |
Werner LEMBERG |
Subject: |
[Groff-commit] groff ChangeLog NEWS doc/groff.texinfo man/grof... |
Date: |
Wed, 12 Jul 2006 19:31:09 +0000 |
CVSROOT: /cvsroot/groff
Module name: groff
Changes by: Werner LEMBERG <wl> 06/07/12 19:31:09
Modified files:
. : ChangeLog NEWS
doc : groff.texinfo
man : groff.man groff_diff.man
src/include : font.h
src/libs/libgroff: font.cpp
src/roff/troff : TODO env.cpp env.h node.cpp
Log message:
Add a request `.fzoom' and a number register `.zoom' to magnify
fonts.
* src/include/font.h (font): Add member variable `zoom'.
Add member functions `set_zoom' and `get_zoom'.
Remove `static' attribute from `scale' member function.
* src/libs/libgroff/font.cpp (font::font): Updated.
(scale_round): New version with three parameters to handle zoom
factor.
(font::scale, font::get_width): Handle zoom factor.
(font::set_zoom, font::get_zoom): New functions.
(font::load): Handle `zoom' while computing `space_width'.
* src/roff/troff/env.h: Declare `env_get_zoom'.
(environment): Add member function `get_zoom'.
* src/roff/troff/env.cpp (environment::get_zoom): New function.
(init_env_requests): Initialize `.zoom' register.
* src/roff/troff/node.cpp (font_info): New member functions
`set_zoom' and `get_zoom'.
(tfont): New member function `get_zoom'.
(env_get_zoom): New function.
(troff_output_file::set_font): Handle zoom factor.
(font_zoom_request): New function.
(init_node_requests): Initialize `fzoom' request.
* docs/groff.texinfo (Changing Fonts), man/groff.man,
man/groff_diff.man, NEWS: Document `fzoom' request and `.zoom'
register.
* src/roff/troff/TODO: Updated.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/groff/ChangeLog?cvsroot=groff&r1=1.977&r2=1.978
http://cvs.savannah.gnu.org/viewcvs/groff/NEWS?cvsroot=groff&r1=1.217&r2=1.218
http://cvs.savannah.gnu.org/viewcvs/groff/doc/groff.texinfo?cvsroot=groff&r1=1.243&r2=1.244
http://cvs.savannah.gnu.org/viewcvs/groff/man/groff.man?cvsroot=groff&r1=1.80&r2=1.81
http://cvs.savannah.gnu.org/viewcvs/groff/man/groff_diff.man?cvsroot=groff&r1=1.56&r2=1.57
http://cvs.savannah.gnu.org/viewcvs/groff/src/include/font.h?cvsroot=groff&r1=1.16&r2=1.17
http://cvs.savannah.gnu.org/viewcvs/groff/src/libs/libgroff/font.cpp?cvsroot=groff&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/groff/src/roff/troff/TODO?cvsroot=groff&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/groff/src/roff/troff/env.cpp?cvsroot=groff&r1=1.16&r2=1.17
http://cvs.savannah.gnu.org/viewcvs/groff/src/roff/troff/env.h?cvsroot=groff&r1=1.35&r2=1.36
http://cvs.savannah.gnu.org/viewcvs/groff/src/roff/troff/node.cpp?cvsroot=groff&r1=1.23&r2=1.24
Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/groff/groff/ChangeLog,v
retrieving revision 1.977
retrieving revision 1.978
diff -u -b -r1.977 -r1.978
--- ChangeLog 11 Jul 2006 06:35:24 -0000 1.977
+++ ChangeLog 12 Jul 2006 19:31:08 -0000 1.978
@@ -1,3 +1,39 @@
+2006-07-11 Werner LEMBERG <address@hidden>
+
+ Add a request `.fzoom' and a number register `.zoom' to magnify
+ fonts.
+
+ * src/include/font.h (font): Add member variable `zoom'.
+ Add member functions `set_zoom' and `get_zoom'.
+ Remove `static' attribute from `scale' member function.
+
+ * src/libs/libgroff/font.cpp (font::font): Updated.
+ (scale_round): New version with three parameters to handle zoom
+ factor.
+ (font::scale, font::get_width): Handle zoom factor.
+ (font::set_zoom, font::get_zoom): New functions.
+ (font::load): Handle `zoom' while computing `space_width'.
+
+ * src/roff/troff/env.h: Declare `env_get_zoom'.
+ (environment): Add member function `get_zoom'.
+
+ * src/roff/troff/env.cpp (environment::get_zoom): New function.
+ (init_env_requests): Initialize `.zoom' register.
+
+ * src/roff/troff/node.cpp (font_info): New member functions
+ `set_zoom' and `get_zoom'.
+ (tfont): New member function `get_zoom'.
+ (env_get_zoom): New function.
+ (troff_output_file::set_font): Handle zoom factor.
+ (font_zoom_request): New function.
+ (init_node_requests): Initialize `fzoom' request.
+
+ * docs/groff.texinfo (Changing Fonts), man/groff.man,
+ man/groff_diff.man, NEWS: Document `fzoom' request and `.zoom'
+ register.
+
+ * src/roff/troff/TODO: Updated.
+
2006-07-10 Werner LEMBERG <address@hidden>
* doc/groff.texinfo (Drawing Requests): Improve documentation of
@@ -221,8 +257,8 @@
* tmac/trace.tmac: s/!!sp/!!!sp/.
Modify definitions of `de', `de1', `am', and `am1' to use \n[.br].
- * docs/groff.texinfo, man/groff.man, man/groff_diff.man, NEWS:
- Document it.
+ * docs/groff.texinfo (Requests), man/groff.man, man/groff_diff.man,
+ NEWS: Document it.
2006-03-29 Werner LEMBERG <address@hidden>
@@ -252,8 +288,8 @@
New functions.
(init_input_requests): Register them.
- * doc/groff.texinfo, man/groff_diff.man, man/groff.man, NEWS:
- Document them.
+ * doc/groff.texinfo (Postprocessor Access), man/groff_diff.man,
+ man/groff.man, NEWS: Document them.
2006-03-27 Gaius Mulley <address@hidden>
@@ -261,7 +297,7 @@
for -Thtml as `\[...]'.
* src/devices/grohtml/post-html.cpp (page::add_and_encode): Updated.
- * doc/groff.texinfo (\X): Updated.
+ * doc/groff.texinfo (Postprocessor Access) <\X>: Updated.
2006-03-27 Werner LEMBERG <address@hidden>
@@ -270,9 +306,9 @@
2006-03-26 Werner LEMBERG <address@hidden>
- * doc/groff.texinfo: More documentation on end-of-macro symbol of
- `.de'.
- Minor addition to `.di' description.
+ * doc/groff.texinfo (Writing Macros): More documentation on
+ end-of-macro symbol of `.de'.
+ (Diversions): Minor addition to `.di' description.
* src/devices/grops/grops.man: Some clarifications regarding
insertion of PostScript snippets.
@@ -349,7 +385,8 @@
2006-03-19 Miklos Somogyi <address@hidden>
- * doc/groff.texinfo: Improve documentation of `.sp'.
+ * doc/groff.texinfo (Manipulating Spacing): Improve documentation of
+ `.sp'.
2006-03-18 Werner LEMBERG <address@hidden>
@@ -1181,8 +1218,8 @@
assignment, prior `.ll' request and then package defaults, in this
specified order of decreasing priority.
- * tmac/groff_man.man, doc/groff.texinfo: Document altered `LL'
- register initialization priorities.
+ * tmac/groff_man.man, doc/groff.texinfo (Man options): Document
+ altered `LL' register initialization priorities.
2005-08-29 Gary W. Swearingen <address@hidden>
@@ -2616,8 +2653,8 @@
2004-09-23 Keith Marshall <address@hidden>
- * tmac/groff_ms.man, doc/groff.texinfo: Document changes from
- 2004-09-19.
+ * tmac/groff_ms.man, doc/groff.texinfo (ms Document Control
+ Registers): Document changes from 2004-09-19.
2004-09-23 Werner LEMBERG <address@hidden>
@@ -2682,8 +2719,8 @@
2004-09-19 Keith Marshall <address@hidden>
- * NEWS, doc/groff.texinfo, tmac/groff_ms.man: Document the deletion
- of `Ds' and `De' macros.
+ * NEWS, doc/groff.texinfo (ms Display and Keeps), tmac/groff_ms.man:
+ Document the deletion of `Ds' and `De' macros.
2004-09-10 Werner LEMBERG <address@hidden>
@@ -2775,8 +2812,8 @@
* src/roff/troff/input.h: Export do_glyph_color and do_fill_color.
- * NEWS, man/groff_diff.man, man/groff.man, doc/groff.texinfo:
- Document new requests.
+ * NEWS, man/groff_diff.man, man/groff.man, doc/groff.texinfo
+ (Colors): Document new requests.
2004-07-24 Werner LEMBERG <address@hidden>
@@ -2787,7 +2824,8 @@
* tmac/s.tmac (@AU, @AI, address@hidden, address@hidden,
address@hidden, NL,
PX): Handle fractional point sizes for PS, VS, FPS, and FVS.
- * tmac/groff_ms.man, docs/groff.texinfo, NEWS: Document it.
+ * tmac/groff_ms.man, docs/groff.texinfo (ms Document Control
+ Registers), NEWS: Document it.
2004-07-19 Werner LEMBERG <address@hidden>
@@ -2803,7 +2841,8 @@
2004-07-05 Werner LEMBERG <address@hidden>
- * doc/groff.texinfo: Further improve documentation of `hcode'.
+ * doc/groff.texinfo (Manipulating Hyphenation): Further improve
+ documentation of `hcode'.
2004-07-04 Sang Dae Yu <address@hidden>
Index: NEWS
===================================================================
RCS file: /cvsroot/groff/groff/NEWS,v
retrieving revision 1.217
retrieving revision 1.218
diff -u -b -r1.217 -r1.218
--- NEWS 1 Jul 2006 22:49:22 -0000 1.217
+++ NEWS 12 Jul 2006 19:31:08 -0000 1.218
@@ -17,7 +17,7 @@
Note that latin-9 input encoding is used for French (to support the `oe'
ligature).
-o Swedish macro localization has been added also.
+o Swedish macro localization (with `-msv') has been added also.
o Two new requests `device' and `devicem' have been added which are
equivalents to the \X and \Y escapes, respectively.
@@ -34,6 +34,19 @@
. tm after bp
..
+o A new request `fzoom' has been added to adjust the optical size of a
+ font in relation to the others. The zoom factor is given in integer
+ multiples of 1/1000th. In the following example, the CR font is
+ magnified by 10% (the zoom factor is 1.1).
+
+ .fam P
+ .fzoom CR 1100
+ .ps 12
+ Palatino and \f[CR]Courier\f[]
+
+ The new number register `.zoom' holds the zoom value of the current font,
+ in multiples of 1/1000th.
+
Pic
---
Index: doc/groff.texinfo
===================================================================
RCS file: /cvsroot/groff/groff/doc/groff.texinfo,v
retrieving revision 1.243
retrieving revision 1.244
diff -u -b -r1.243 -r1.244
--- doc/groff.texinfo 11 Jul 2006 06:35:24 -0000 1.243
+++ doc/groff.texinfo 12 Jul 2006 19:31:08 -0000 1.244
@@ -8703,6 +8703,7 @@
@endDefreq
@Defreq {ftr, f address@hidden
address@hidden font translation (@code{ftr})
@cindex @code{ft} request, and font translations
@cindex @code{ul} request, and font translations
@cindex @code{bd} request, and font translations
@@ -8725,6 +8726,41 @@
the translation is undone.
@endDefreq
address@hidden {fzoom, f address@hidden
address@hidden {.zoom}
address@hidden magnification of a font (@code{fzoom})
address@hidden font, magnification (@code{fzoom})
address@hidden zoom factor of a font (@code{fzoom})
address@hidden factor, zoom, of a font (@code{fzoom})
address@hidden font, zoom factor (@code{fzoom})
address@hidden optical size of a font
address@hidden font, optical size
address@hidden size, optical, of a font
+Set magnification of address@hidden@var{f} to factor @var{zoom}, which must be
a
+non-negative integer multiple of 1/1000th. This request is useful to adjust
+the optical size of a font in relation to the others. In the example below,
+font @code{CR} is magnified by 10% (the zoom factor is thus 1.1).
+
address@hidden
+.fam P
+.fzoom CR 1100
+.ps 12
+Palatino and \f[CR]Courier\f[]
address@hidden
+
+A missing or zero value of @var{zoom} is the same as a value of 1000, which
+means no magnification. @address@hidden be a real font name, not a style.
+
+Note that the magnification of a font is completely transparent to troff; a
+change of the zoom factor doesn't cause any effect except that the
+dimensions of glyphs, (word) spaces, kerns, etc., of the affected font are
+adjusted accordingly.
+
+The zoom factor of the current font is available in the read-only number
+register @samp{.zoom}, in multiples of 1/1000th. It returns zero if there
+is no magnification.
address@hidden
+
@c ---------------------------------------------------------------------
@node Font Families, Font Positions, Changing Fonts, Fonts and Symbols
Index: man/groff.man
===================================================================
RCS file: /cvsroot/groff/groff/man/groff.man,v
retrieving revision 1.80
retrieving revision 1.81
diff -u -b -r1.80 -r1.81
--- man/groff.man 26 Apr 2006 22:22:03 -0000 1.80
+++ man/groff.man 12 Jul 2006 19:31:09 -0000 1.81
@@ -2,7 +2,7 @@
.ig
groff.man
-Last update: 26 Apr 2006
+Last update: 11 Jul 2006
This file is part of groff, the GNU roff type-setting system.
@@ -1644,6 +1644,15 @@
to
.IR font2 .
.
+.REQ .fzoom font
+Don't magnify
+.IR font .
+.
+.REQ .fzoom font zoom
+Set zoom factor for
+.I font
+(in multiples of 1/1000th).
+.
.REQ .gcolor
Set glyph color to previous glyph color.
.
@@ -3316,7 +3325,7 @@
Available vertical resolution in basic units.
.
.REG .vpt
-1\~ if vertical position traps are enabled, 0\~otherwise.
+1\~if vertical position traps are enabled, 0\~otherwise.
.
.REG .w
Width of previous character.
@@ -3337,6 +3346,10 @@
Name of current diversion.
.PD
.
+.REG .zoom
+Zoom factor for current font (in multiples of 1/1000th; zero if no
+magnification).
+.
.
.\" --------------------------------------------------------------------
.SS "Writable Registers"
Index: man/groff_diff.man
===================================================================
RCS file: /cvsroot/groff/groff/man/groff_diff.man,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -b -r1.56 -r1.57
--- man/groff_diff.man 4 Apr 2006 20:20:04 -0000 1.56
+++ man/groff_diff.man 12 Jul 2006 19:31:09 -0000 1.57
@@ -3,7 +3,7 @@
.ig
groff_diff.man
-Last update : 04 Apr 2006
+Last update : 11 Jul 2006
This file is part of groff, the GNU roff type-setting system.
It is the source of the man-page groff_diff(7).
@@ -1494,6 +1494,19 @@
is not translated.
.
.TP
+.BI .fzoom\ f\ zoom
+Set zoom factor
+.I zoom
+for font\~\c
+.IR f .
+.I zoom
+must a non-negative integer multiple of 1/1000th.
+If it is missing or is equal to zero, it means the same as 1000, namely no
+magnification.
+.I f\c
+\~must be a real font name, not a style.
+.
+.TP
.BI .gcolor\ c
Set the glyph color to
.IR c .
@@ -2922,6 +2935,11 @@
The revision number of groff.
.
.TP
+.B \[rs]n[.zoom]
+The zoom value of the current font, in multiples of 1/1000th.
+Zero if no magnification.
+.
+.TP
.B \[rs]n[llx]
.TQ
.B \[rs]n[lly]
Index: src/include/font.h
===================================================================
RCS file: /cvsroot/groff/groff/src/include/font.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- src/include/font.h 26 Feb 2006 22:21:37 -0000 1.16
+++ src/include/font.h 12 Jul 2006 19:31:09 -0000 1.17
@@ -178,6 +178,9 @@
// to be advanced by some (possibly negative)
// amount. See groff manual, description of \w and
// the `ssc' register. Return this amount.
+ void set_zoom(int); // Set the font's zoom factor * 1000. Must be a
+ // non-negative value.
+ int get_zoom(); // Return the font's zoom factor * 1000.
int get_code(glyph *); // Return the code point in the physical
// font of the given glyph.
const char *get_special_device_encoding(glyph *); // Return special
@@ -220,11 +223,11 @@
static int load_desc(); // Open the DESC file (depending on the
// device) and initialize some static variables with
// info from there.
-
static FONT_COMMAND_HANDLER
set_unknown_desc_command_handler(FONT_COMMAND_HANDLER); // Register
// a function which defines the semantics of
// arbitrary commands in the font DESC file.
+ // Now the variables from the DESC file, shared by all fonts.
static int res; // The `res' attribute given in the DESC file.
static int hor; // The `hor' attribute given in the DESC file.
static int vert; // The `vert' attribute given in the DESC file.
@@ -277,6 +280,8 @@
char *internalname; // The `internalname' attribute of this font, or
// NULL. Used by get_internal_name().
double slant; // The natural slant angle (in degrees) of this
font.
+ int zoom; // The font's magnification, multiplied by 1000.
+ // Used by scale(). A zero value means `no zoom'.
int *ch_index; // Conversion table from font-independent character
// indices to indices for this particular font.
int nindices;
@@ -311,7 +316,7 @@
// the pair of glyphs (arg1 and arg2).
/* Returns w * pointsize / unitwidth, rounded to the nearest integer. */
- static int scale(int w, int pointsize);
+ int scale(int w, int pointsize);
static int unit_scale(double *, char); // Convert value in arg1 from the
// given unit (arg2; possible values are `i', `c',
// `p', and `P' as documented in the info file of
Index: src/libs/libgroff/font.cpp
===================================================================
RCS file: /cvsroot/groff/groff/src/libs/libgroff/font.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- src/libs/libgroff/font.cpp 30 May 2006 17:29:09 -0000 1.14
+++ src/libs/libgroff/font.cpp 12 Jul 2006 19:31:09 -0000 1.15
@@ -159,6 +159,7 @@
strcpy(name, s);
internalname = 0;
slant = 0.0;
+ zoom = 0;
// load(); // for testing
}
@@ -196,19 +197,33 @@
if (x == 0)
return 0;
if (n >= 0) {
- if (n <= (INT_MAX - y2)/x)
- return (n*x + y2)/y;
- return int(n*double(x)/double(y) + .5);
+ if (n <= (INT_MAX - y2) / x)
+ return (n * x + y2) / y;
+ return int(n * double(x) / double(y) + .5);
}
else {
- if (-(unsigned)n <= (-(unsigned)INT_MIN - y2)/x)
- return (n*x - y2)/y;
- return int(n*double(x)/double(y) - .5);
+ if (-(unsigned)n <= (-(unsigned)INT_MIN - y2) / x)
+ return (n * x - y2) / y;
+ return int(n * double(x) / double(y) - .5);
}
}
+static int scale_round(int n, int x, int y, int z)
+{
+ assert(x >= 0 && y > 0 && z > 0);
+ if (x == 0)
+ return 0;
+ if (n >= 0)
+ return int((n * double(x) / double(y)) * (double(z) / 1000.0) + .5);
+ else
+ return int((n * double(x) / double(y)) * (double(z) / 1000.0) - .5);
+}
+
inline int font::scale(int w, int sz)
{
+ if (zoom)
+ return scale_round(w, sz, unitwidth, zoom);
+ else
return sz == unitwidth ? w : scale_round(w, sz, unitwidth);
}
@@ -313,19 +328,28 @@
{
int idx = glyph_to_index(g);
assert(idx >= 0);
+ int real_size;
+ if (!zoom)
+ real_size = point_size;
+ else
+ {
+ if (point_size <= (INT_MAX - 500) / zoom)
+ real_size = (point_size * zoom + 500) / 1000;
+ else
+ real_size = int(point_size * double(zoom) / 1000.0 + .5);
+ }
if (idx < nindices && ch_index[idx] >= 0) {
// Explicitly enumerated glyph
int i = ch_index[idx];
-
- if (point_size == unitwidth || font::unscaled_charwidths)
+ if (real_size == unitwidth || font::unscaled_charwidths)
return ch[i].width;
if (!widths_cache)
- widths_cache = new font_widths_cache(point_size, ch_size);
- else if (widths_cache->point_size != point_size) {
+ widths_cache = new font_widths_cache(real_size, ch_size);
+ else if (widths_cache->point_size != real_size) {
font_widths_cache **p;
for (p = &widths_cache; *p; p = &(*p)->next)
- if ((*p)->point_size == point_size)
+ if ((*p)->point_size == real_size)
break;
if (*p) {
font_widths_cache *tem = *p;
@@ -334,7 +358,7 @@
widths_cache = tem;
}
else
- widths_cache = new font_widths_cache(point_size, ch_size,
+ widths_cache = new font_widths_cache(real_size, ch_size,
widths_cache);
}
int &w = widths_cache->width[i];
@@ -347,7 +371,7 @@
int width = 24; // value found in the original font files
// XXX: this must be eventually moved back to the
// font description file!
- if (point_size == unitwidth || font::unscaled_charwidths)
+ if (real_size == unitwidth || font::unscaled_charwidths)
return width;
else
return scale(width, point_size);
@@ -440,6 +464,20 @@
abort();
}
+void font::set_zoom(int factor)
+{
+ assert(factor >= 0);
+ if (factor == 1000)
+ zoom = 0;
+ else
+ zoom = factor;
+}
+
+int font::get_zoom()
+{
+ return zoom;
+}
+
int font::get_space_width(int point_size)
{
return scale(space_width, point_size);
@@ -984,8 +1022,12 @@
t.error("missing `charset' command");
return 0;
}
- if (space_width == 0)
- space_width = scale_round(unitwidth, res, 72*3*sizescale);
+ if (space_width == 0) {
+ if (zoom)
+ space_width = scale_round(unitwidth, res, 72 * 3 * sizescale, zoom);
+ else
+ space_width = scale_round(unitwidth, res, 72 * 3 * sizescale);
+ }
return 1;
}
Index: src/roff/troff/TODO
===================================================================
RCS file: /cvsroot/groff/groff/src/roff/troff/TODO,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- src/roff/troff/TODO 4 Apr 2006 20:20:04 -0000 1.9
+++ src/roff/troff/TODO 12 Jul 2006 19:31:09 -0000 1.10
@@ -66,10 +66,6 @@
Have a per-environment parameter to increase letter-spacing.
-Number register to return character height.
-
-Number register to return character slant.
-
Request to set character height.
Request to set character slant.
Index: src/roff/troff/env.cpp
===================================================================
RCS file: /cvsroot/groff/groff/src/roff/troff/env.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- src/roff/troff/env.cpp 27 May 2006 05:43:37 -0000 1.16
+++ src/roff/troff/env.cpp 12 Jul 2006 19:31:09 -0000 1.17
@@ -3132,6 +3132,11 @@
curenv->set_input_line_position(hunits(n));
}
+int environment::get_zoom()
+{
+ return env_get_zoom(this);
+}
+
const char *environment::get_font_family_string()
{
return family->nm.contents();
@@ -3328,6 +3333,7 @@
init_int_env_reg(".u", get_fill);
init_vunits_env_reg(".v", get_vertical_spacing);
init_hunits_env_reg(".w", get_prev_char_width);
+ init_int_env_reg(".zoom", get_zoom);
number_reg_dictionary.define("ct", new variable_reg(&ct_reg_contents));
number_reg_dictionary.define("hp", new horizontal_place_reg);
number_reg_dictionary.define("ln", new variable_reg(&next_line_number));
Index: src/roff/troff/env.h
===================================================================
RCS file: /cvsroot/groff/groff/src/roff/troff/env.h,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -b -r1.35 -r1.36
--- src/roff/troff/env.h 30 May 2006 17:29:09 -0000 1.35
+++ src/roff/troff/env.h 12 Jul 2006 19:31:09 -0000 1.36
@@ -1,5 +1,5 @@
// -*- C++ -*-
-/* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001, 2002, 2004, 2005
+/* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001, 2002, 2004, 2005, 2006
Free Software Foundation, Inc.
Written by James Clark (address@hidden)
@@ -72,6 +72,7 @@
hunits env_sentence_space_width(environment *);
hunits env_narrow_space_width(environment *);
hunits env_half_narrow_space_width(environment *);
+int env_get_zoom(environment *);
struct tab;
@@ -280,6 +281,7 @@
int get_char_slant() { return char_slant; }
hunits get_digit_width();
int get_font() { return fontno; }; // .f
+ int get_zoom(); // .zoom
font_family *get_family() { return family; }
int get_bold(); // .b
int get_adjust_mode(); // .j
Index: src/roff/troff/node.cpp
===================================================================
RCS file: /cvsroot/groff/groff/src/roff/troff/node.cpp,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- src/roff/troff/node.cpp 26 Apr 2006 07:41:33 -0000 1.23
+++ src/roff/troff/node.cpp 12 Jul 2006 19:31:09 -0000 1.24
@@ -158,6 +158,8 @@
int get_bold(hunits *);
int is_special();
int is_style();
+ void set_zoom(int);
+ int get_zoom();
friend symbol get_font_name(int, environment *);
friend symbol get_style_name(int);
};
@@ -198,6 +200,7 @@
hunits get_track_kern();
tfont *get_plain();
font_size get_size();
+ int get_zoom();
symbol get_name();
charinfo *get_lig(charinfo *c1, charinfo *c2);
int get_kern(charinfo *c1, charinfo *c2, hunits *res);
@@ -247,6 +250,19 @@
return fm == 0;
}
+void font_info::set_zoom(int zoom)
+{
+ assert(fm != 0);
+ fm->set_zoom(zoom);
+}
+
+inline int font_info::get_zoom()
+{
+ if (is_style())
+ return 0;
+ return fm->get_zoom();
+}
+
tfont *make_tfont(tfont_spec &spec)
{
for (tfont *p = tfont::tfont_list; p; p = p->next)
@@ -255,6 +271,12 @@
return new tfont(spec);
}
+int env_get_zoom(environment *env)
+{
+ int fontno = env->get_family()->make_definite(env->get_font());
+ return font_table[fontno]->get_zoom();
+}
+
// this is the current_font, fontno is where we found the character,
// presumably a special font
@@ -299,7 +321,9 @@
}
if (fontno != number)
return make_tfont(spec);
+ // save font for comparison purposes
last_tfont = make_tfont(spec);
+ // save font related values not contained in tfont
last_size = fs;
last_height = height;
last_slant = slant;
@@ -588,6 +612,11 @@
return size;
}
+inline int tfont::get_zoom()
+{
+ return fm->get_zoom();
+}
+
inline symbol tfont::get_name()
{
return name;
@@ -1185,7 +1214,13 @@
put('\n');
current_font_number = n;
}
- int size = tf->get_size().to_scaled_points();
+ int zoom = tf->get_zoom();
+ int size;
+ if (zoom)
+ size = scale(tf->get_size().to_scaled_points(),
+ zoom, 1000);
+ else
+ size = tf->get_size().to_scaled_points();
if (current_size != size) {
put('s');
put(size);
@@ -6193,6 +6228,27 @@
skip_line();
}
+void font_zoom_request()
+{
+ int n = get_fontno();
+ if (n >= 0) {
+ if (font_table[n]->is_style())
+ warning(WARN_FONT, "can't set zoom factor for a style");
+ else {
+ int zoom;
+ if (has_arg() && get_integer(&zoom)) {
+ if (zoom < 0)
+ warning(WARN_FONT, "can't use negative zoom factor");
+ else
+ font_table[n]->set_zoom(zoom);
+ }
+ else
+ font_table[n]->set_zoom(0);
+ }
+ }
+ skip_line();
+}
+
int next_available_font_position()
{
int i;
@@ -6471,6 +6527,7 @@
init_request("fp", font_position);
init_request("fschar", define_font_special_character);
init_request("fspecial", font_special_request);
+ init_request("fzoom", font_zoom_request);
init_request("ftr", font_translate);
init_request("kern", kern_request);
init_request("lg", ligature);