summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/fonts/source/public/shade/shade.mf
blob: 0fc67b3d175e67ba59e9bb5a150b2ac74fe503c5 (plain)
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
%%% shade/shade.mf
%%% shade font for use with shade.tex/sty
%%% see README for licensing and contact information.

mode_setup;
magnification=1000;
font_identifier "Shade";
font_coding_scheme "Shade Style Matrix";
font_size 10pt#;

%%% a = side of smallest shaded square (3x3 pixels)
    a#:=(3/pixels_per_inch)*1in#;
    define_pixels(a);
%%% greybox produces a shaded rectangle:
%%%     height 2^H*a
%%%      width 2^W*a
%%%                                     ... 
%%% it consists of WxH `unit squares':  .*.
%%%                                     ... 
%%% its character code is 10*W + H
%%%     i.e., the first digit corresponds to the width and
%%%           the second digit corresponds to the height of the character

def greybox (expr H, W) =
    HH:=2**H; WW:=2**W;
    beginchar(10*W+H, WW*a#, HH*a#, 0);
       pickup pencircle scaled 1;
       fill (1,1)--(1,3*HH)--(3*WW,3*HH)--(3*WW,1)--cycle;
       pickup pencircle scaled 2;
       for x = 0 step 3 until 3*HH : undraw (0,x)--(3*WW,x); endfor;
       for x = 0 step 3 until 3*WW : undraw (x,0)--(x,3*HH); endfor;
       endchar;
    enddef;

%%% produce characters for H and W from 0 to 5

for ww = 0 upto 5 :
    for hh = 0 upto 5 : greybox (hh,ww); endfor;
    endfor;

bye;