File: setfigfont.c

package info (click to toggle)
transfig 1%3A3.2.5.e-4%2Bdeb8u1
  • links: PTS
  • area: main
  • in suites: jessie
  • size: 9,300 kB
  • sloc: ansic: 32,666; makefile: 3,255; sh: 549; csh: 25; perl: 13
file content (76 lines) | stat: -rwxr-xr-x 2,508 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/*
 * TransFig: Facility for Translating Fig code
 * Copyright (c) 1991 by Micah Beck
 *
 * Any party obtaining a copy of these files is granted, free of charge, a
 * full and unrestricted irrevocable, world-wide, paid up, royalty-free,
 * nonexclusive right and license to deal in this software and
 * documentation files (the "Software"), including without limitation the
 * rights to use, copy, modify, merge, publish and/or distribute copies of
 * the Software, and to permit persons who receive copies from any such 
 * party to do so, with the only requirement being that this copyright 
 * notice remain intact.
 *
 */

/* Add a (La)TeX macro, if TeX fonts are used. */

/* This macro is called with three (five with NFSS support) arguments:
 *    #1   fontsize (without `pt')
 *    #2   baselineskip (without `pt')
 *    #3   font  (without escape character)
 *  And, for NFSS support:
 *    #4   font series
 *    #5   font shape
 */

#include <fig2dev.h>

Boolean FontSizeOnly = False;

void
define_setfigfont(tfp)
     FILE *tfp;
{
#ifdef NFSS

    if ( FontSizeOnly )
    	fprintf(tfp, "%%\n\
\\begingroup\\makeatletter\\ifx\\SetFigFont\\undefined%%\n\
\\gdef\\SetFigFont#1#2{%%\n\
  \\fontsize{#1}{#2pt}%%\n\
  \\selectfont}%%\n\
\\fi\\endgroup%%\n");
    else
	fprintf(tfp, "%%\n\
\\begingroup\\makeatletter\\ifx\\SetFigFont\\undefined%%\n\
\\gdef\\SetFigFont#1#2#3#4#5{%%\n\
  \\reset@font\\fontsize{#1}{#2pt}%%\n\
  \\fontfamily{#3}\\fontseries{#4}\\fontshape{#5}%%\n\
  \\selectfont}%%\n\
\\fi\\endgroup%%\n");
#else /* NFSS */
  fprintf(tfp, "%%\n\
\\begingroup\\makeatletter\\ifx\\SetFigFont\\undefined\n\
%% extract first six characters in \\fmtname\n\
\\def\\x#1#2#3#4#5#6#7\\relax{\\def\\x{#1#2#3#4#5#6}}%%\n\
\\expandafter\\x\\fmtname xxxxxx\\relax \\def\\y{splain}%%\n\
\\ifx\\x\\y   %% LaTeX or SliTeX?\n\
\\gdef\\SetFigFont#1#2#3{%%\n\
  \\ifnum #1<17\\tiny\\else \\ifnum #1<20\\small\\else\n\
  \\ifnum #1<24\\normalsize\\else \\ifnum #1<29\\large\\else\n\
  \\ifnum #1<34\\Large\\else \\ifnum #1<41\\LARGE\\else\n\
     \\huge\\fi\\fi\\fi\\fi\\fi\\fi\n\
  \\csname #3\\endcsname}%%\n\
\\else\n\
\\gdef\\SetFigFont#1#2#3{\\begingroup\n\
  \\count@#1\\relax \\ifnum 25<\\count@\\count@25\\fi\n\
  \\def\\x{\\endgroup\\@setsize\\SetFigFont{#2pt}}%%\n\
  \\expandafter\\x\n\
    \\csname \\romannumeral\\the\\count@ pt\\expandafter\\endcsname\n\
    \\csname @\\romannumeral\\the\\count@ pt\\endcsname\n\
  \\csname #3\\endcsname}%%\n\
\\fi\n\
\\fi\\endgroup\n");
#endif /* NFSS */
}