| 1 |
% Fix the Omega \char<..> primitives |
| 2 |
%--------------------------------------- |
| 3 |
@x |
| 4 |
@d assign_font_dimen=assign_mu_glue+1 |
| 5 |
{user-defined font dimension ( \.{\\fontdimen} )} |
| 6 |
@y |
| 7 |
@d assign_font_dimen=assign_mu_glue+1 |
| 8 |
{font dimension ( \.{\\fontdimen} ), \.{\\charwd}, \.{\\charht}, etc} |
| 9 |
@d font_dimen_code=0 |
| 10 |
@d char_width_code=font_dimen_code+1 |
| 11 |
@d char_height_code=char_width_code+1 |
| 12 |
@d char_depth_code=char_height_code+1 |
| 13 |
@d char_italic_code=char_depth_code+1 |
| 14 |
@z |
| 15 |
%--------------------------------------- |
| 16 |
@x [26] m.416 l.8407 - Omega char dimensions |
| 17 |
primitive("fontdimen",assign_font_dimen,0);@/ |
| 18 |
@!@:font_dimen_}{\.{\\fontdimen} primitive@> |
| 19 |
@y |
| 20 |
primitive("fontdimen",assign_font_dimen,font_dimen_code);@/ |
| 21 |
@!@:font_dimen_}{\.{\\fontdimen} primitive@> |
| 22 |
primitive("charwd",assign_font_dimen,char_width_code);@/ |
| 23 |
@!@:char_width_}{\.{\\charwd} primitive@> |
| 24 |
primitive("charht",assign_font_dimen,char_height_code);@/ |
| 25 |
@!@:char_height_}{\.{\\charht} primitive@> |
| 26 |
primitive("chardp",assign_font_dimen,char_depth_code);@/ |
| 27 |
@!@:char_depth_}{\.{\\chardp} primitive@> |
| 28 |
primitive("charit",assign_font_dimen,char_italic_code);@/ |
| 29 |
@!@:char_italic_}{\.{\\charit} primitive@> |
| 30 |
@z |
| 31 |
%--------------------------------------- |
| 32 |
@x [26] m.416 l.8425 - Omega char dimensions |
| 33 |
assign_font_dimen: print_esc("fontdimen"); |
| 34 |
@y |
| 35 |
assign_font_dimen: if chr_code=font_dimen_code then print_esc("fontdimen") |
| 36 |
else if chr_code=char_width_code then print_esc("charwd") |
| 37 |
else if chr_code=char_height_code then print_esc("charht") |
| 38 |
else if chr_code=char_depth_code then print_esc("chardp") |
| 39 |
else if chr_code=char_italic_code then print_esc("charit") |
| 40 |
else print("[unknown fontdimen code!]"); |
| 41 |
@z |
| 42 |
%--------------------------------------- |
| 43 |
@x CLEAN UP FROM OMEGA |
| 44 |
primitive("charwd",set_box_dimen,(width_offset+3)); |
| 45 |
@!@:charwd_}{\.{\\charwd} primitive@> |
| 46 |
primitive("charht",set_box_dimen,(height_offset+3)); |
| 47 |
@!@:charht_}{\.{\\charht} primitive@> |
| 48 |
primitive("chardp",set_box_dimen,(depth_offset+3)); |
| 49 |
@!@:chardp_}{\.{\\chardp} primitive@> |
| 50 |
primitive("charit",set_box_dimen,(depth_offset+4)); |
| 51 |
@!@:charit_}{\.{\\charit} primitive@> |
| 52 |
@y |
| 53 |
@z |
| 54 |
%--------------------------------------- |
| 55 |
@x |
| 56 |
else if chr_code=(width_offset+3) then print_esc("charwd") |
| 57 |
else if chr_code=(height_offset+3) then print_esc("charht") |
| 58 |
else if chr_code=(depth_offset+3) then print_esc("chardp") |
| 59 |
else print_esc("charit"); |
| 60 |
@y |
| 61 |
else print("[unknown box dimen!]"); |
| 62 |
@z |
| 63 |
%--------------------------------------- |
| 64 |
@x |
| 65 |
@ @<Fetch a box dimension@>= |
| 66 |
if m<=3 then |
| 67 |
begin |
| 68 |
scan_register_num; |
| 69 |
fetch_box(q); |
| 70 |
if q=null then cur_val:=0 @+else |
| 71 |
cur_val:=mem[q+m].sc; |
| 72 |
cur_val_level:=dimen_val; |
| 73 |
end |
| 74 |
else |
| 75 |
begin |
| 76 |
scan_char_num; |
| 77 |
if m=(width_offset+3) then begin |
| 78 |
cur_val:= char_width(main_f)(char_info(main_f)(cur_val)) |
| 79 |
end |
| 80 |
else if m=(height_offset+3) then begin |
| 81 |
cur_val:= char_height(main_f)(height_depth(char_info(main_f)(cur_val))) |
| 82 |
end |
| 83 |
else if m=(depth_offset+3) then begin |
| 84 |
cur_val:= char_depth(main_f)(height_depth(char_info(main_f)(cur_val))) |
| 85 |
end |
| 86 |
else begin |
| 87 |
cur_val:= char_italic(main_f)(char_info(main_f)(cur_val)); |
| 88 |
end; |
| 89 |
cur_val_level:=dimen_val; |
| 90 |
end |
| 91 |
@y |
| 92 |
@ @<Fetch a box dimension@>= |
| 93 |
if m<=height_offset then begin |
| 94 |
scan_register_num; |
| 95 |
fetch_box(q); |
| 96 |
if q=null then cur_val:=0 @+else |
| 97 |
cur_val:=mem[q+m].sc; |
| 98 |
cur_val_level:=dimen_val; |
| 99 |
end |
| 100 |
else begin |
| 101 |
confusion("boxdimen"); |
| 102 |
{ something wrong with the code ...} |
| 103 |
end |
| 104 |
@z |
| 105 |
%--------------------------------------- |
| 106 |
@x [26] m.419 l.8461 - Omega char dimensions |
| 107 |
@ @<Fetch a font dimension@>= |
| 108 |
begin find_font_dimen(false); |
| 109 |
font_info(dimen_font)(font_file_size(dimen_font)).sc:=0; |
| 110 |
scanned_result(font_info(dimen_font)(cur_val).sc)(dimen_val); |
| 111 |
end |
| 112 |
@y |
| 113 |
@ @<Fetch a font dimension@>= |
| 114 |
if m=font_dimen_code then begin find_font_dimen(false); |
| 115 |
font_info(dimen_font)(font_file_size(dimen_font)).sc:=0; |
| 116 |
scanned_result(font_info(dimen_font)(cur_val).sc)(dimen_val); |
| 117 |
end |
| 118 |
else |
| 119 |
begin scan_char_num; |
| 120 |
if m=char_width_code then begin |
| 121 |
cur_val:= char_width(main_f)(char_info(main_f)(cur_val)) |
| 122 |
end |
| 123 |
else if m=char_height_code then begin |
| 124 |
cur_val:= char_height(main_f)(height_depth(char_info(main_f)(cur_val))) |
| 125 |
end |
| 126 |
else if m=char_depth_code then begin |
| 127 |
cur_val:= char_depth(main_f)(height_depth(char_info(main_f)(cur_val))) |
| 128 |
end |
| 129 |
else if m=char_italic_code then begin |
| 130 |
cur_val:= char_italic(main_f)(char_info(main_f)(cur_val)); |
| 131 |
end |
| 132 |
else confusion("fontdimen"); |
| 133 |
cur_val_level:=dimen_val; |
| 134 |
end |
| 135 |
@z |
| 136 |
%--------------------------------------- |
| 137 |
@x |
| 138 |
assign_font_dimen: begin find_font_dimen(true); k:=cur_val; |
| 139 |
scan_optional_equals; scan_normal_dimen; |
| 140 |
font_info(dimen_font)(k).sc:=cur_val; |
| 141 |
end; |
| 142 |
@y |
| 143 |
assign_font_dimen: begin |
| 144 |
n:=cur_chr; |
| 145 |
if n=font_dimen_code then begin |
| 146 |
find_font_dimen(true); k:=cur_val; |
| 147 |
scan_optional_equals; scan_normal_dimen; |
| 148 |
font_info(dimen_font)(k).sc:=cur_val; |
| 149 |
end |
| 150 |
else begin |
| 151 |
print_err("Invalid dimension assignment"); |
| 152 |
help2("You tried to assign a character dimension.")@/ |
| 153 |
("This is not allowed. Proceed; I'll ignore the assignment."); |
| 154 |
error; |
| 155 |
scan_char_num; scan_optional_equals; scan_normal_dimen; |
| 156 |
end |
| 157 |
end; |
| 158 |
@z |