diff options
author | wl <wl> | 2006-07-12 19:31:08 +0000 |
---|---|---|
committer | wl <wl> | 2006-07-12 19:31:08 +0000 |
commit | d0aaf996772a9b623023b45a47fa6ea656d64872 (patch) | |
tree | 5b28076dc0fb537b632079ebeb4a4875df4bfefa | |
parent | c5116ee8cc5889b23b1049ff702f19b828026af2 (diff) | |
download | groff-d0aaf996772a9b623023b45a47fa6ea656d64872.tar.gz |
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.
-rw-r--r-- | ChangeLog | 77 | ||||
-rw-r--r-- | NEWS | 15 | ||||
-rw-r--r-- | doc/groff.texinfo | 36 | ||||
-rw-r--r-- | man/groff.man | 17 | ||||
-rw-r--r-- | man/groff_diff.man | 20 | ||||
-rw-r--r-- | src/include/font.h | 9 | ||||
-rw-r--r-- | src/libs/libgroff/font.cpp | 74 | ||||
-rw-r--r-- | src/roff/troff/TODO | 4 | ||||
-rw-r--r-- | src/roff/troff/env.cpp | 6 | ||||
-rw-r--r-- | src/roff/troff/env.h | 4 | ||||
-rw-r--r-- | src/roff/troff/node.cpp | 65 |
11 files changed, 277 insertions, 50 deletions
@@ -1,3 +1,39 @@ +2006-07-11 Werner LEMBERG <wl@gnu.org> + + 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 <wl@gnu.org> * 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 <wl@gnu.org> @@ -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 <gaius@glam.ac.uk> @@ -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 <wl@gnu.org> @@ -270,9 +306,9 @@ 2006-03-26 Werner LEMBERG <wl@gnu.org> - * 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 <msom@netspace.net.au> - * doc/groff.texinfo: Improve documentation of `.sp'. + * doc/groff.texinfo (Manipulating Spacing): Improve documentation of + `.sp'. 2006-03-18 Werner LEMBERG <wl@gnu.org> @@ -1181,8 +1218,8 @@ Version 1.19.2 released 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 <garys@opusnet.com> @@ -2616,8 +2653,8 @@ Version 1.19.2 released 2004-09-23 Keith Marshall <keith.d.marshall@ntlworld.com> - * 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 <wl@gnu.org> @@ -2682,8 +2719,8 @@ Version 1.19.2 released 2004-09-19 Keith Marshall <keith.d.marshall@ntlworld.com> - * 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 <wl@gnu.org> @@ -2775,8 +2812,8 @@ Version 1.19.2 released * 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 <wl@gnu.org> @@ -2787,7 +2824,8 @@ Version 1.19.2 released * tmac/s.tmac (@AU, @AI, par@load-init, par@init, par@reset, 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 <wl@gnu.org> @@ -2803,7 +2841,8 @@ Version 1.19.2 released 2004-07-05 Werner LEMBERG <wl@gnu.org> - * doc/groff.texinfo: Further improve documentation of `hcode'. + * doc/groff.texinfo (Manipulating Hyphenation): Further improve + documentation of `hcode'. 2004-07-04 Sang Dae Yu <sdyu@bh.knu.ac.kr> @@ -17,7 +17,7 @@ o Fabrice Ménard contributed locales support. In particular, it is now 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 @@ o A new read-only number register `.br' is available which is set to 1 . 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 --- diff --git a/doc/groff.texinfo b/doc/groff.texinfo index aae17d01..97b53473 100644 --- a/doc/groff.texinfo +++ b/doc/groff.texinfo @@ -8703,6 +8703,7 @@ the current environment. @endDefreq @Defreq {ftr, f [@Var{g}]} +@cindex 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 @@ font@tie{}@var{g} is used. If @var{g} is missing or equal to@tie{}@var{f} the translation is undone. @endDefreq +@DefreqList {fzoom, f [@Var{zoom}]} +@DefregListEnd {.zoom} +@cindex magnification of a font (@code{fzoom}) +@cindex font, magnification (@code{fzoom}) +@cindex zoom factor of a font (@code{fzoom}) +@cindex factor, zoom, of a font (@code{fzoom}) +@cindex font, zoom factor (@code{fzoom}) +@cindex optical size of a font +@cindex font, optical size +@cindex size, optical, of a font +Set magnification of font@tie{}@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). + +@Example +.fam P +.fzoom CR 1100 +.ps 12 +Palatino and \f[CR]Courier\f[] +@endExample + +A missing or zero value of @var{zoom} is the same as a value of 1000, which +means no magnification. @var{f}@tie{}must 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. +@endDefreq + @c --------------------------------------------------------------------- @node Font Families, Font Positions, Changing Fonts, Fonts and Symbols diff --git a/man/groff.man b/man/groff.man index f636aaac..921bed0e 100644 --- a/man/groff.man +++ b/man/groff.man @@ -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 @@ Translate 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 @@ Current vertical line spacing. 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 @@ The revision number of groff. Name of current diversion. .PD . +.REG .zoom +Zoom factor for current font (in multiples of 1/1000th; zero if no +magnification). +. . .\" -------------------------------------------------------------------- .SS "Writable Registers" diff --git a/man/groff_diff.man b/man/groff_diff.man index a33710fe..4cfed149 100644 --- a/man/groff_diff.man +++ b/man/groff_diff.man @@ -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 @@ then font 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 @@ contains\~03. 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] diff --git a/src/include/font.h b/src/include/font.h index 0f561d1a..066dae2d 100644 --- a/src/include/font.h +++ b/src/include/font.h @@ -178,6 +178,9 @@ public: // 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 @@ public: 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 @@ private: 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 @@ private: // 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 diff --git a/src/libs/libgroff/font.cpp b/src/libs/libgroff/font.cpp index e0b6de0a..6e82de64 100644 --- a/src/libs/libgroff/font.cpp +++ b/src/libs/libgroff/font.cpp @@ -159,6 +159,7 @@ font::font(const char *s) strcpy(name, s); internalname = 0; slant = 0.0; + zoom = 0; // load(); // for testing } @@ -196,20 +197,34 @@ static int scale_round(int n, int x, int y) 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) { - return sz == unitwidth ? w : scale_round(w, sz, unitwidth); + if (zoom) + return scale_round(w, sz, unitwidth, zoom); + else + return sz == unitwidth ? w : scale_round(w, sz, unitwidth); } int font::unit_scale(double *value, char unit) @@ -313,19 +328,28 @@ int font::get_width(glyph *g, int point_size) { 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 @@ int font::get_width(glyph *g, int point_size) 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 font::get_width(glyph *g, int point_size) 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 @@ int font::get_subscript_correction(glyph *g, int point_size) 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 @@ int font::load(int *not_found, int head_only) 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; } diff --git a/src/roff/troff/TODO b/src/roff/troff/TODO index a1b531e5..5151cccb 100644 --- a/src/roff/troff/TODO +++ b/src/roff/troff/TODO @@ -66,10 +66,6 @@ Devise a more compact representation for the hyphenation patterns trie. 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. diff --git a/src/roff/troff/env.cpp b/src/roff/troff/env.cpp index a24142c5..ce23ed89 100644 --- a/src/roff/troff/env.cpp +++ b/src/roff/troff/env.cpp @@ -3132,6 +3132,11 @@ void horizontal_place_reg::set_value(units n) 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 @@ void init_env_requests() 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)); diff --git a/src/roff/troff/env.h b/src/roff/troff/env.h index 01b6866d..1a3153af 100644 --- a/src/roff/troff/env.h +++ b/src/roff/troff/env.h @@ -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 (jjc@jclark.com) @@ -72,6 +72,7 @@ hunits env_space_width(environment *); 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 @@ public: 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 diff --git a/src/roff/troff/node.cpp b/src/roff/troff/node.cpp index a84bbb50..8e6bb3b9 100644 --- a/src/roff/troff/node.cpp +++ b/src/roff/troff/node.cpp @@ -158,6 +158,8 @@ public: 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 @@ public: 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 @@ inline int font_info::is_style() 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 @@ tfont *make_tfont(tfont_spec &spec) 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 @@ tfont *font_info::get_tfont(font_size fs, int height, int slant, int fontno) } 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 @@ inline font_size tfont::get_size() return size; } +inline int tfont::get_zoom() +{ + return fm->get_zoom(); +} + inline symbol tfont::get_name() { return name; @@ -687,8 +716,8 @@ class real_output_file : public output_file { #ifndef POPEN_MISSING int piped; #endif - int printing; // decision via optional page list - int output_on; // \O[0] or \O[1] escape calls + int printing; // decision via optional page list + int output_on; // \O[0] or \O[1] escape calls virtual void really_transparent_char(unsigned char) = 0; virtual void really_print_line(hunits x, vunits y, node *n, vunits before, vunits after, hunits width) = 0; @@ -1185,7 +1214,13 @@ void troff_output_file::set_font(tfont *tf) 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); @@ -4116,7 +4151,7 @@ void suppress_node::tprint(troff_output_file *out) // postscript (or other device) if (suppress_start_page > 0 && current_page != suppress_start_page) error("suppression limit registers span more than one page;\n" - "image description %1 will be wrong", image_no); + "image description %1 will be wrong", image_no); // if (topdiv->get_page_number() != suppress_start_page) // fprintf(stderr, "end of image and topdiv page = %d and suppress_start_page = %d\n", // topdiv->get_page_number(), suppress_start_page); @@ -6193,6 +6228,27 @@ void special_request() 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 @@ void init_node_requests() 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); |