ref: 5a8e4a87bfb94588190b39bf2032ed03f66afc8e
parent: 0645b041fc978afa94f089c122c6745abfeffea6
author: Ali Gholami Rudi <ali@rudi.ir>
date: Fri Aug 15 16:08:37 EDT 2014
font: the third argument of .cs
--- a/font.c
+++ b/font.c
@@ -34,7 +34,7 @@
char fontname[FNLEN];
int spacewid;
int special;
- int cs, bd, zoom; /* for .cs, .bd, .fzoom requests */
+ int cs, cs_ps, bd, zoom; /* for .cs, .bd, .fzoom requests */
struct glyph gl[NGLYPHS]; /* glyphs present in the font */
int gl_n; /* number of glyphs in the font */
struct dict gl_dict; /* mapping from gl[i].id to i */
@@ -661,7 +661,8 @@
int font_gwid(struct font *fn, struct font *cfn, int sz, int w)
{
if (cfn->cs)
- return cfn->cs * (font_zoom(fn, sz) * SC_IN / 72) / 36;
+ return cfn->cs * (font_zoom(fn, cfn->cs_ps ? cfn->cs_ps : sz)
+ * SC_IN / 72) / 36;
return font_wid(fn, sz, w) + (font_getbd(cfn) ? font_getbd(cfn) - 1 : 0);
}
@@ -676,9 +677,10 @@
return fn->cs;
}
-void font_setcs(struct font *fn, int cs)
+void font_setcs(struct font *fn, int cs, int ps)
{
fn->cs = cs;
+ fn->cs_ps = ps;
}
int font_getbd(struct font *fn)
--- a/roff.h
+++ b/roff.h
@@ -173,7 +173,7 @@
int font_wid(struct font *fn, int sz, int w);
int font_gwid(struct font *fn, struct font *cfn, int sz, int w);
int font_swid(struct font *fn, int sz, int ss);
-void font_setcs(struct font *fn, int cs);
+void font_setcs(struct font *fn, int cs, int ps);
int font_getcs(struct font *fn);
void font_setbd(struct font *fn, int bd);
int font_getbd(struct font *fn);
--- a/tr.c
+++ b/tr.c
@@ -452,7 +452,8 @@
{
struct font *fn = args[1] ? dev_font(dev_pos(args[1])) : NULL;
if (fn)
- font_setcs(fn, args[2] ? eval(args[2], 0) : 0);
+ font_setcs(fn, args[2] ? eval(args[2], 0) : 0,
+ args[3] ? eval(args[3], 0) : 0);
}
static void tr_fzoom(char **args)