@x [17.236] - (WEB2C!) 
@d char_sub_def_min_code=55 {smallest value in the charsubdef list}
@d char_sub_def_max_code=56 {largest value in the charsubdef list}
@d tracing_char_sub_def_code=57 {traces changes to a charsubdef def}
@d int_pars=58 {total number of integer parameters}
@y
@d char_sub_def_min_code=62 {smallest value in the charsubdef list}
@d char_sub_def_max_code=63 {largest value in the charsubdef list}
@d tracing_char_sub_def_code=64 {traces changes to a charsubdef def}
@d int_pars=65 {total number of integer parameters}
@z

@x (MLTeX)
@ The following code typesets a character to PDF output.

@<Output character |c| of font |f|@>=
if pdf_font_type[f] = new_font_type then
    do_vf;
if pdf_font_type[f] = virtual_font_type then
    do_vf_packet(c)
else begin
    pdf_begin_string;
    pdf_print_char(c);
    add_char_width(char_width(f)(char_info(f)(c)));
    pdf_set_char_used(f, c);
end

@y
@ The following code typesets a character to PDF output.

@d char_done = 72

@<Output character |c| of font |f|@>=
if pdf_font_type[f] = new_font_type then
    do_vf;
if pdf_font_type[f] = virtual_font_type then
    do_vf_packet(c)
else begin
    if font_ec[f]>=qo(c) then if font_bc[f]<=qo(c) then
        if char_exists(orig_char_info(f)(c)) then  {N.B.: not |char_info|} 
        begin
            pdf_begin_string;
            pdf_print_char(c);
            add_char_width(char_width(f)(orig_char_info(f)(c)));
            pdf_set_char_used(f, c);
            goto char_done;
        end;
    if mltex_enabled_p then
      begin
      @<Get substitution information, check it, goto |found|
      if all is ok, otherwise goto |continue|@>;
found: @<Print character substition tracing log@>;
      @<Rebuild character for PDF using substitution information@>;
      end;
char_done:
end

@ @<Rebuild character for PDF using substitution information@>=
  base_x_height:=x_height(f);
  base_slant:=slant(f)/float_constant(65536);
@^real division@>
  accent_slant:=base_slant; {slant of accent character font}
  base_width:=char_width(f)(ib_c);
  base_height:=char_height(f)(height_depth(ib_c));
  accent_width:=char_width(f)(ia_c);
  accent_height:=char_height(f)(height_depth(ia_c));
  @/{compute necessary horizontal shift (don't forget slant)}@/
  delta:=round((base_width-accent_width)/float_constant(2)+
            base_height*base_slant-base_x_height*accent_slant);
@^real multiplication@>
@^real addition@>
  @/{1. For centering/horizontal shifting insert a kern node.}@/
  cur_h:=cur_h+delta;
  if ((base_height<>base_x_height) and (accent_height>0)) then
    begin {the accent must be shifted up or down}
    base_line:=cur_v;
    cur_v:=base_line+(base_x_height-base_height);
    pdf_begin_string;
    pdf_out(accent_c);
    cur_v:=base_line;
  end
  else begin
  pdf_begin_string;
  pdf_print_char(accent_c);
  end;
  pdf_set_char_used(f, accent_c);
  cur_h := cur_h + accent_width;
  add_char_width(accent_width);
  cur_h:=cur_h+(-accent_width-delta);
  pdf_begin_string;
  pdf_print_char(base_c);
  pdf_set_char_used(f, base_c);
  cur_h:=cur_h+base_width;
  add_char_width(base_width);
  goto continue;
@z

@x [49.1259] 
    begin if s>0 then
      begin if s=font_size[f] then goto common_ending;
      end
    else if font_size[f]=xn_over_d(font_dsize[f],-s,1000) then
      goto common_ending;
    end
@y
    begin
    if (cur_font_step = 0) or
      ((cur_font_step = pdf_font_step[f]) and
       (cur_font_stretch = pdf_expand_font[pdf_max_font_stretch[f]]) and
       (cur_font_shrink = -pdf_expand_font[pdf_max_font_shrink[f]])) then begin
       if s>0 then
         begin if s=font_size[f] then goto common_ending;
         end
       else if font_size[f]=xn_over_d(font_dsize[f],-s,1000) then
         goto common_ending;
       end
    end
@z


@x (WEB2C!)
xmalloc_array(param_base, font_max);

undump_things(font_check[null_font], font_ptr+1-null_font);
@y
xmalloc_array(param_base, font_max);

xmalloc_array(pdf_char_used,font_max);
xmalloc_array(pdf_font_size,font_max);
xmalloc_array(pdf_font_num,font_max);
xmalloc_array(pdf_font_map,font_max);
xmalloc_array(pdf_font_type,font_max);
xmalloc_array(pdf_font_link,font_max);
xmalloc_array(pdf_max_font_stretch,font_max);
xmalloc_array(pdf_max_font_shrink,font_max);
xmalloc_array(pdf_font_step,font_max);
xmalloc_array(pdf_expand_font,font_max);
xmalloc_array(vf_packet_base,font_max);
xmalloc_array(vf_default_font,font_max);
xmalloc_array(vf_local_font_num,font_max);
xmalloc_array(vf_e_fnts,font_max);
xmalloc_array(vf_i_fnts,font_max);

for font_k := font_base to font_max do begin
    for k := 0 to 31 do
        pdf_char_used[font_k,k] := 0;
    pdf_font_size[font_k] := 0;
    pdf_font_num[font_k] := 0;
    pdf_font_map[font_k] := -1;
    pdf_font_type[font_k] := new_font_type;
    pdf_font_link[font_k] := null_font;
    pdf_max_font_stretch[font_k] := null_font;
    pdf_max_font_shrink[font_k] := null_font;
    pdf_font_step[font_k] := 0;
    pdf_expand_font[font_k] := 0;
end;

undump_things(font_check[null_font], font_ptr+1-null_font);
@z

@x [51.1]
  setup_bound_var (0)('hash_extra')(hash_extra);

@y
  setup_bound_var (0)('hash_extra')(hash_extra);
  setup_bound_var (65536)('obj_tab_size')(obj_tab_size);
  setup_bound_var (65536)('obj_tab_size')(pdf_mem_size);
@z

@x [51.2]
  const_chk (hash_extra);
  if error_line > ssup_error_line then error_line := ssup_error_line;
@y
  const_chk (hash_extra);
  const_chk (obj_tab_size);
  if error_line > ssup_error_line then error_line := ssup_error_line;
@z

@x [51.3]
  xmalloc_array (hyph_link , hyph_size);
@y
  xmalloc_array (hyph_link , hyph_size);
  xmalloc_array (obj_tab, obj_tab_size);
  xmalloc_array (pdf_mem, pdf_mem_size);
@z

@x (WEB2C!)
  xmalloc_array(param_base, font_max);

  font_ptr:=null_font; fmem_ptr:=7;
@y
xmalloc_array(param_base, font_max);

xmalloc_array(pdf_char_used,font_max);
xmalloc_array(pdf_font_size,font_max);
xmalloc_array(pdf_font_num,font_max);
xmalloc_array(pdf_font_map,font_max);
xmalloc_array(pdf_font_type,font_max);
xmalloc_array(pdf_font_link,font_max);
xmalloc_array(pdf_max_font_stretch,font_max);
xmalloc_array(pdf_max_font_shrink,font_max);
xmalloc_array(pdf_font_step,font_max);
xmalloc_array(pdf_expand_font,font_max);
xmalloc_array(vf_packet_base,font_max);
xmalloc_array(vf_default_font,font_max);
xmalloc_array(vf_local_font_num,font_max);
xmalloc_array(vf_e_fnts,font_max);
xmalloc_array(vf_i_fnts,font_max);

for font_k := font_base to font_max do begin
    for k := 0 to 31 do
        pdf_char_used[font_k,k] := 0;
    pdf_font_size[font_k] := 0;
    pdf_font_num[font_k] := 0;
    pdf_font_map[font_k] := -1;
    pdf_font_type[font_k] := new_font_type;
    pdf_font_link[font_k] := null_font;
    pdf_max_font_stretch[font_k] := null_font;
    pdf_max_font_shrink[font_k] := null_font;
    pdf_font_step[font_k] := 0;
    pdf_expand_font[font_k] := 0;
end;

font_ptr:=null_font; fmem_ptr:=7;
@z

