source: tags/initial/fig2dev/dev/setfigfont.c

Last change on this file was 2, checked in by oldcode, 24 years ago

Initial revision

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 1.2 KB
Line 
1/* Add a (La)TeX macro, if TeX fonts are used. */
2/* This macro is called with three arguments:
3 *    #1   fontsize (without `pt')
4 *    #2   baselineskip (without `pt')
5 *    #3   font  (without escape character)
6 */
7
8#include <stdio.h>
9
10define_setfigfont(tfp)
11     FILE *tfp;
12{
13        fprintf(tfp, "%%\n\
14\\begingroup\\makeatletter\n\
15%% extract first six characters in \\fmtname\n\
16\\def\\x#1#2#3#4#5#6#7\\relax{\\def\\x{#1#2#3#4#5#6}}%%\n\
17\\expandafter\\x\\fmtname xxxxxx\\relax \\def\\y{splain}%%\n\
18\\ifx\\x\\y   %% LaTeX or SliTeX?\n\
19\\gdef\\SetFigFont#1#2#3{%%\n\
20  \\ifnum #1<17\\tiny\\else \\ifnum #1<20\\small\\else\n\
21  \\ifnum #1<24\\normalsize\\else \\ifnum #1<29\\large\\else\n\
22  \\ifnum #1<34\\Large\\else \\ifnum #1<41\\LARGE\\else\n\
23     \\huge\\fi\\fi\\fi\\fi\\fi\\fi\n\
24  \\csname #3\\endcsname}%%\n\
25\\else\n\
26\\gdef\\SetFigFont#1#2#3{\\begingroup\n\
27  \\count@#1\\relax \\ifnum 25<\\count@\\count@25\\fi\n\
28  \\def\\x{\\endgroup\\@setsize\\SetFigFont{#2pt}}%%\n\
29  \\expandafter\\x\n\
30    \\csname \\romannumeral\\the\\count@ pt\\expandafter\\endcsname\n\
31    \\csname @\\romannumeral\\the\\count@ pt\\endcsname\n\
32  \\csname #3\\endcsname}%%\n\
33\\fi\n\
34\\endgroup\n");
35}
Note: See TracBrowser for help on using the repository browser.