tex4h 和 IGO 字体

tex4h 和 IGO 字体

将 tex4ht 与该包结合使用时igo会出现一些错误消息。该igo包可在 上找到CTAN

步骤 1:为了测试目的,我已经生成igobl10.mf并使用了来自生成数字的包的igowh10.mf原始mf文件。igo09

igobl10.mf:

font_identifier:="IGOBL10"; font_size 10pt#;

size#:=10pt#;
line_thickness#:=.04size#;
border_line_thickness#:=.1size#;

%%% 

dig_h#:=63/100size#;
dig_w#:=4/10size#;
dig_pen#:=1/10size#;

%%%% input igoblacki

mode_setup;

define_pixels(size);
define_pixels(line_thickness,border_line_thickness);
define_pixels(dig_h,dig_w,dig_pen);

picture digit[];
picture black_circle;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

def digit_zero =
  currentpicture := nullpicture;
  pickup pencircle scaled dig_pen;
  lft x1=0; y1=.5dig_h;
  x2=.5dig_w; top y2=dig_h;
  rt x3=dig_w; y3=.5dig_h;
  x4=.5dig_w; bot y4=0;
  draw z1...z2...z3...z4...cycle;
  digit[0] := currentpicture;
  clearxy; clearit; clearpen;
enddef;

def digit_one =
  currentpicture := nullpicture;
  pickup pencircle scaled dig_pen;
  x1=.5dig_w; bot y1=0;
  x2=.5dig_w; top y2=dig_h;
  draw z1--z2;
  digit[1] := currentpicture;
  clearxy; clearit; clearpen;
enddef;

def digit_two =
  currentpicture := nullpicture;
  pickup pencircle scaled dig_pen;
  lft x1=0; y1=.75dig_h;
  x2=.5dig_w; top y2=dig_h;
  rt x3=.8dig_w; y3=.9dig_h;
  lft x4=0; bot y4=0;
  draw z1{up}...z2...z3..{(-.8dig_w,-dig_h)}z4;
  z5=z4;
  rt x6=dig_w; bot y6=0;
  draw z5--z6;
  digit[2] := currentpicture;
  clearxy; clearit; clearpen;
enddef;

def digit_three =
  currentpicture := nullpicture;
  pickup pencircle scaled dig_pen;
  lft x1=.08dig_w; y1=.8dig_h;
  x2=.5dig_w; top y2=dig_h; 
  rt x3=.92dig_w; y3=y1;
  z4=(.5dig_w,.52dig_h);
  rt x5=dig_w; y5=.2dig_h;
  x6=.65dig_w; bot y6=0;
  lft x7=0; y7=y5;
  draw z1{up}..z2..z3..{left}z4{right}..z5..z6...{up}z7;
  digit[3] := currentpicture;
  clearxy; clearit; clearpen;
enddef;

def digit_four =
  currentpicture := nullpicture;
  pickup pencircle scaled dig_pen;
  x1=.75dig_w; bot y1=0;
  x2=x1; top y2=dig_h;
  lft x3=0; y3=.3dig_h;
  rt x4=dig_w; y4=y3;
  draw z1--z2--z3--z4;
  digit[4] := currentpicture;
  clearxy; clearit; clearpen;
enddef;

def digit_five =
  currentpicture := nullpicture;
  pickup pencircle scaled dig_pen;
  rt x1=.95dig_w; top y1=dig_h;
  lft x2=.05dig_w; y2=y1;
  lft x3=0; y3=.45dig_h;
  z4=(.5dig_w,.6dig_h);
  rt x5=dig_w; y5=.3dig_h;
  x6=.65dig_w; bot y6=0;
  lft x7=0; y7=.15dig_h;
  draw z1--z2--z3{up}..z4..z5..z6...{up}z7;
  digit[5] := currentpicture;
  clearxy; clearit; clearpen;
enddef;

def digit_six =
  currentpicture := nullpicture;
  pickup pencircle scaled dig_pen;
  rt x1=dig_w; y1=.8dig_h;
  x2=.45dig_w; top y2=dig_h;
  lft x3=0; y3=.5dig_h;
  x4=.5dig_w; bot y4=0;
  rt x5=dig_w; y5=.3dig_h;
  z6=(.53dig_w,.55dig_h);
  z7=(.03dig_w+.6dig_pen,.25dig_h);
  draw z1{up}...z2...z3...z4...z5...{left}z6{left}...{(1,-10)}z7;
  digit[6] := currentpicture;
  clearxy; clearit; clearpen;
enddef;

def digit_seven =
  currentpicture := nullpicture;
  pickup pencircle scaled dig_pen;
  lft x1=0; top y1=dig_h;
  rt x2=dig_w; y2=y1;
  lft x3=.2dig_w; bot y3=0;
  draw z1--z2--z3;
  digit[7] := currentpicture;
  clearxy; clearit; clearpen;
enddef;

def digit_eight =
  currentpicture := nullpicture;
  pickup pencircle scaled dig_pen;
  lft x1=.08dig_w; y1=.75dig_h;
  x2=.5dig_w; top y2=dig_h;
  rt x3=.92dig_w; y3=y1;
  z4=(.5dig_w,.55dig_h);
  rt x5=dig_w; y5=.25dig_h;
  x6=.5dig_w; bot y6=0;
  lft x7=0; y7=y5;
  draw z1...z2...z3...z4...cycle; 
  draw z4...z5...z6...z7...cycle;
  digit[8] := currentpicture;
  clearxy; clearit; clearpen;
enddef;

def digit_nine =
  currentpicture := nullpicture;
  currentpicture := digit[6] rotated 180;
  digit[9] := currentpicture shifted (dig_w,dig_h);
  clearxy; clearit; clearpen;
enddef;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

digit_zero; digit_one; digit_two; digit_three; digit_four;
digit_five; digit_six; digit_seven; digit_eight; digit_nine;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

beginchar(0,24/22size#,23/22size#,1/22size#); "pion czarny";
  pickup pencircle scaled line_thickness;
  lft x1=1/24w; y1=11/24w;
  rt x2=23/24w; y2=11/24w;
  filldraw z1..z2..cycle;
  black_circle := currentpicture;
showit;
endchar;

% stop"";

beginchar(1,24/22size#,23/22size#,1/22size#); "pion czarny z 1";
  currentpicture := black_circle 
       - digit[1] shifted (.5w-.5dig_w,11/24w-.5dig_h);
showit;
endchar;

% stop"";

beginchar(2,24/22size#,23/22size#,1/22size#); "pion czarny z 2";
  currentpicture := black_circle 
       - digit[2] shifted (.5w-.5dig_w,11/24w-.5dig_h);
showit;
endchar;

% stop"";

beginchar(3,24/22size#,23/22size#,1/22size#); "pion czarny z 3";
  currentpicture := black_circle 
       - digit[3] shifted (.5w-.5dig_w,11/24w-.5dig_h);
showit;
endchar;

% stop"";

beginchar(4,24/22size#,23/22size#,1/22size#); "pion czarny z 4";
  currentpicture := black_circle 
       - digit[4] shifted (.5w-.6dig_w,11/24w-.5dig_h);
showit;
endchar;

% stop"";

beginchar(5,24/22size#,23/22size#,1/22size#); "pion czarny z 5";
  currentpicture := black_circle 
       - digit[5] shifted (.5w-.5dig_w,11/24w-.5dig_h);
showit;
endchar;

% stop"";

beginchar(6,24/22size#,23/22size#,1/22size#); "pion czarny z 6";
  currentpicture := black_circle 
       - digit[6] shifted (.5w-.5dig_w,11/24w-.5dig_h);
showit;
endchar;

% stop"";

beginchar(7,24/22size#,23/22size#,1/22size#); "pion czarny z 7";
  currentpicture := black_circle 
       - digit[7] shifted (.5w-.5dig_w,11/24w-.5dig_h);
showit;
endchar;

% stop"";

beginchar(8,24/22size#,23/22size#,1/22size#); "pion czarny z 8";
  currentpicture := black_circle 
       - digit[8] shifted (.5w-.5dig_w,11/24w-.5dig_h);
showit;
endchar;

% stop"";

beginchar(9,24/22size#,23/22size#,1/22size#); "pion czarny z 9";
  currentpicture := black_circle 
       - digit[9] shifted (.5w-.5dig_w,11/24w-.5dig_h);
showit;
endchar;

% stop"";


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

end;

igowh10.mf:

font_identifier:="IGOWH10"; font_size 10pt#;

size#:=10pt#;
line_thickness#:=.04size#;
border_line_thickness#:=.1size#;

%%% 

dig_h#:=63/100size#;
dig_w#:=4/10size#;
dig_pen#:=1/10size#; 

%%% input igowhitei

mode_setup;

define_pixels(size);
define_pixels(line_thickness,border_line_thickness);
define_pixels(dig_h,dig_w,dig_pen);

picture digit[];
picture white_circle;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

def digit_zero =
  currentpicture := nullpicture;
  pickup pencircle scaled dig_pen;
  lft x1=0; y1=.5dig_h;
  x2=.5dig_w; top y2=dig_h;
  rt x3=dig_w; y3=.5dig_h;
  x4=.5dig_w; bot y4=0;
  draw z1...z2...z3...z4...cycle;
  digit[0] := currentpicture;
  clearxy; clearit; clearpen;
enddef;

def digit_one =
  currentpicture := nullpicture;
  pickup pencircle scaled dig_pen;
  x1=.5dig_w; bot y1=0;
  x2=.5dig_w; top y2=dig_h;
  draw z1--z2;
  digit[1] := currentpicture;
  clearxy; clearit; clearpen;
enddef;

def digit_two =
  currentpicture := nullpicture;
  pickup pencircle scaled dig_pen;
  lft x1=0; y1=.75dig_h;
  x2=.5dig_w; top y2=dig_h;
  rt x3=.8dig_w; y3=.9dig_h;
  lft x4=0; bot y4=0;
  draw z1{up}...z2...z3..{(-.8dig_w,-dig_h)}z4;
  z5=z4;
  rt x6=dig_w; bot y6=0;
  draw z5--z6;
  digit[2] := currentpicture;
  clearxy; clearit; clearpen;
enddef;

def digit_three =
  currentpicture := nullpicture;
  pickup pencircle scaled dig_pen;
  lft x1=.08dig_w; y1=.8dig_h;
  x2=.5dig_w; top y2=dig_h; 
  rt x3=.92dig_w; y3=y1;
  z4=(.5dig_w,.52dig_h);
  rt x5=dig_w; y5=.2dig_h;
  x6=.65dig_w; bot y6=0;
  lft x7=0; y7=y5;
  draw z1{up}..z2..z3..{left}z4{right}..z5..z6...{up}z7;
  digit[3] := currentpicture;
  clearxy; clearit; clearpen;
enddef;

def digit_four =
  currentpicture := nullpicture;
  pickup pencircle scaled dig_pen;
  x1=.75dig_w; bot y1=0;
  x2=x1; top y2=dig_h;
  lft x3=0; y3=.3dig_h;
  rt x4=dig_w; y4=y3;
  draw z1--z2--z3--z4;
  digit[4] := currentpicture;
  clearxy; clearit; clearpen;
enddef;

def digit_five =
  currentpicture := nullpicture;
  pickup pencircle scaled dig_pen;
  rt x1=.95dig_w; top y1=dig_h;
  lft x2=.05dig_w; y2=y1;
  lft x3=0; y3=.45dig_h;
  z4=(.5dig_w,.6dig_h);
  rt x5=dig_w; y5=.3dig_h;
  x6=.65dig_w; bot y6=0;
  lft x7=0; y7=.15dig_h;
  draw z1--z2--z3{up}..z4..z5..z6...{up}z7;
  digit[5] := currentpicture;
  clearxy; clearit; clearpen;
enddef;

def digit_six =
  currentpicture := nullpicture;
  pickup pencircle scaled dig_pen;
  rt x1=dig_w; y1=.8dig_h;
  x2=.45dig_w; top y2=dig_h;
  lft x3=0; y3=.5dig_h;
  x4=.5dig_w; bot y4=0;
  rt x5=dig_w; y5=.3dig_h;
  z6=(.53dig_w,.55dig_h);
  z7=(.03dig_w+.6dig_pen,.25dig_h);
  draw z1{up}...z2...z3...z4...z5...{left}z6{left}...{(1,-10)}z7;
  digit[6] := currentpicture;
  clearxy; clearit; clearpen;
enddef;

def digit_seven =
  currentpicture := nullpicture;
  pickup pencircle scaled dig_pen;
  lft x1=0; top y1=dig_h;
  rt x2=dig_w; y2=y1;
  lft x3=.2dig_w; bot y3=0;
  draw z1--z2--z3;
  digit[7] := currentpicture;
  clearxy; clearit; clearpen;
enddef;

def digit_eight =
  currentpicture := nullpicture;
  pickup pencircle scaled dig_pen;
  lft x1=.08dig_w; y1=.75dig_h;
  x2=.5dig_w; top y2=dig_h;
  rt x3=.92dig_w; y3=y1;
  z4=(.5dig_w,.55dig_h);
  rt x5=dig_w; y5=.25dig_h;
  x6=.5dig_w; bot y6=0;
  lft x7=0; y7=y5;
  draw z1...z2...z3...z4...cycle; 
  draw z4...z5...z6...z7...cycle;
  digit[8] := currentpicture;
  clearxy; clearit; clearpen;
enddef;

def digit_nine =
  currentpicture := nullpicture;
  currentpicture := digit[6] rotated 180;
  digit[9] := currentpicture shifted (dig_w,dig_h);
  clearxy; clearit; clearpen;
enddef;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

digit_zero; digit_one; digit_two; digit_three; digit_four;
digit_five; digit_six; digit_seven; digit_eight; digit_nine;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

beginchar(0,24/22size#,23/22size#,1/22size#); "pion bialy";
  pickup pencircle scaled line_thickness;
  lft x1=1/24w; y1=11/24w;
  rt x2=23/24w; y2=11/24w;
  draw z1..z2..cycle;
  white_circle := currentpicture;
showit;
endchar;

% stop"";

beginchar(1,24/22size#,23/22size#,1/22size#); "pion bialy z 1";
  currentpicture := white_circle 
       + digit[1] shifted (.5w-.5dig_w,11/24w-.5dig_h);
showit;
endchar;

% stop"";

beginchar(2,24/22size#,23/22size#,1/22size#); "pion bialy z 2";
  currentpicture := white_circle 
       + digit[2] shifted (.5w-.5dig_w,11/24w-.5dig_h);
showit;
endchar;

% stop"";

beginchar(3,24/22size#,23/22size#,1/22size#); "pion bialy z 3";
  currentpicture := white_circle 
       + digit[3] shifted (.5w-.5dig_w,11/24w-.5dig_h);
showit;
endchar;

% stop"";

beginchar(4,24/22size#,23/22size#,1/22size#); "pion bialy z 4";
  currentpicture := white_circle 
       + digit[4] shifted (.5w-.6dig_w,11/24w-.5dig_h);
showit;
endchar;

% stop"";

beginchar(5,24/22size#,23/22size#,1/22size#); "pion bialy z 5";
  currentpicture := white_circle 
       + digit[5] shifted (.5w-.5dig_w,11/24w-.5dig_h);
showit;
endchar;

% stop"";

beginchar(6,24/22size#,23/22size#,1/22size#); "pion bialy z 6";
  currentpicture := white_circle 
       + digit[6] shifted (.5w-.5dig_w,11/24w-.5dig_h);
showit;
endchar;

% stop"";

beginchar(7,24/22size#,23/22size#,1/22size#); "pion bialy z 7";
  currentpicture := white_circle 
       + digit[7] shifted (.5w-.5dig_w,11/24w-.5dig_h);
showit;
endchar;

% stop"";

beginchar(8,24/22size#,23/22size#,1/22size#); "pion bialy z 8";
  currentpicture := white_circle 
       + digit[8] shifted (.5w-.5dig_w,11/24w-.5dig_h);
showit;
endchar;

% stop"";

beginchar(9,24/22size#,23/22size#,1/22size#); "pion bialy z 9";
  currentpicture := white_circle 
       + digit[9] shifted (.5w-.5dig_w,11/24w-.5dig_h);
showit;
endchar;

% stop"";


end;


第 2 步:运行latex生成test1.tex所需的tfmpk文件。

    %% test1.tex
    \documentclass{article}
    \font\mybl=igobl10
    \font\mywh=igowh10
    \begin{document}
    {\mybl \char0 \char1}   
    {\mywh \char2 \char3}
    \end{document} 

即正常工作。

下一步是测试pdflatex test2.tex

    %% test2.tex
    \documentclass{article}  
    \input showfonts.4ht  
    \begin{document}  
    \showfonts  
    {igobl10}  
    {igowh10}
    {}
    \end{document} 

PDF 文件显示正确的字形。有错误消息,表示缺少某些字符,例如Missing character: There is no h in font igobl10!;但这是意料之中的。

第 4 步:然后我运行,make4ht -m draft test1.tex 收到错误消息

    --- warning --- Couldn't find font `igowh10.htf' (char codes: 0--9)`

我生成了htf文件igobl10.htfigowh10.htf输入

    igobl10 0 9
    ’ ’  ’1’    '0'
    ’ ’  ’1’    '1'
    ’ ’  ’1’    '2'
    ’ ’  ’1’    '3'
    ’ ’  ’1’    '4'
    ’ ’  ’1’    '5'
    ’ ’  ’1’    '6'
    ’ ’  ’1’    '7'
    ’ ’  ’1’    '8'
    ’ ’  ’1’    '9'
    igobl10 0 9

和同样

igobl10 0 9
    ’ ’  ’1’    '0'
    ’ ’  ’1’    '1'
    ’ ’  ’1’    '2'
    ’ ’  ’1’    '3'
    ’ ’  ’1’    '4'
    ’ ’  ’1’    '5'
    ’ ’  ’1’    '6'
    ’ ’  ’1’    '7'
    ’ ’  ’1’    '8'
    ’ ’  ’1’    '9'
    igowh10 0 9

TeX我将这些文件存储在与文件相同的目录中

现在运行make4ht -m draft test1.tex我收到错误消息

    --- warning --- Improper signature at start of file `.htf'
    --- warning --- File `igowh10.htf' starts/ends with character code 0 instead of 9)
    igowh10 0 9
    0:  ’ ’  ’1’    '0'
    1:  ’ ’  ’1’    '1'
    2:  ’ ’  ’1’    '2'
    3:  ’ ’  ’1’    '3'
    4:  ’ ’  ’1’    '4'
    5:  ’ ’  ’1’    '5'
    6:  ’ ’  ’1’    '6'
    7:  ’ ’  ’1’    '7'
    8:  ’ ’  ’1’    '8'
    9:  ’ ’  ’1’    '9'
    10:  igowh10    0 9--- error --- Improper file `igowh10.htf'

如果我注释掉该行{\mywh \char2 \char3}\font\mywh=igowh10在我test1.tex

    [STATUS]  make4ht: Conversion started
    [STATUS]  make4ht: Input file: test1.tex
    igobl10 0 9
    0:  ’ ’  ’1’    '0'
    1:  ’ ’  ’1’    '1'
    2:  ’ ’  ’1’    '2'
    3:  ’ ’  ’1’    '3'
    4:  ’ ’  ’1’    '4'
    5:  ’ ’  ’1’    '5'
    6:  ’ ’  ’1’    '6'
    7:  ’ ’  ’1’    '7'
    8:  ’ ’  ’1’    '8'
    9:  ’ ’  ’1’    '9'
    10:  igobl10 0 9--- error --- Improper file `igobl10.htf'

这与其他错误消息略有不同。

问题:我在这里做错了什么?

答案1

您的.htf文件是正确的,除了它们包含左单引号字​​符而不是直引号,并且第一个字符之前也不应有空格。此问题是由TeX4ht 文档,其中包含错误的引号。我已在 TeX4ht 源中修复了这个问题,因此希望它也能很快在网络上修复。

正确的版本如下所示:

igobl10 0 9
' '  '1'    '0'
' '  '1'    '1'
' '  '1'    '2'
' '  '1'    '3'
' '  '1'    '4'
' '  '1'    '5'
' '  '1'    '6'
' '  '1'    '7'
' '  '1'    '8'
' '  '1'    '9'
igobl10 0 9

igowh10 0 9
' '  '1'    '0'
' '  '1'    '1'
' '  '1'    '2'
' '  '1'    '3'
' '  '1'    '4'
' '  '1'    '5'
' '  '1'    '6'
' '  '1'    '7'
' '  '1'    '8'
' '  '1'    '9'
igowh10 0 9

使用此版本,您将获得以下角色列表:

在此处输入图片描述

相关内容