From d0aaf996772a9b623023b45a47fa6ea656d64872 Mon Sep 17 00:00:00 2001 From: wl Date: Wed, 12 Jul 2006 19:31:08 +0000 Subject: 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. --- src/include/font.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/include') 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 -- cgit v1.2.1