[Fontinst] Things to update

Lars Hellström Lars.Hellstrom at math.umu.se
Mon Dec 8 17:08:23 CET 2003


The last few months, things in fontinst that need to be updated have
started dropping in, so I suspect I shall try to compile a new release
sometime soon (probably during the Yuletide holidays or thereabout). The
things I can think of right now to fix for that is:

* Make sure the *.mtx files maintained by others are up to date. (I believe
one of them that came with v1.926 wasn't, I newer got around to uploading a
new one to CTAN, and now I've forgotten which one it was anyway.)

* Add an osf2x.tex, for renaming <digit> to <digit>oldstyle with
\reglyphfont. (User suggestion, posted off-list.)

* Fix the bug Walter reported earlier today. (Need to figure out what it is
first.)

* Add the file bbox.sty, as shown below.

Is there anything else?

The last item may require some explanation. Some time ago Yannis
Haralambous contacted me and said he needed bounding box support for glyphs
in order to switch his Omega font metrics generation from Perl scripts to
fontinst. I took it as an excuse to finally hack together the macros for
doing this that have been described in fisource.tex for several years now.
The result can be seen below. I would however be glad if someone interested
in using them could do some betatesting of them before I add them to the
distribution.

Lars Hellström



%%% Begin bbox.sty

\needsfontinstversion{1.926}

\fontinstcc

\def\resetglyphbb#1#2#3#4#5{
   \eval_expr_to\a_count{#2}
   \eval_expr_to\b_count{#3}
   \eval_expr_to\c_count{#4}
   \eval_expr_to\d_count{#5}
   \x_cs\edef{gb-#1
   }{
      {\the\a_count}{\the\b_count}{\the\c_count}{\the\d_count}
   }
}
\def\setglyphbb#1#2#3#4#5{
   \if_undefined{gb-\glyph_name_modifier{#1}}\then
      \resetglyphbb{\glyph_name_modifier{#1}}{#2}{#3}{#4}{#5}
   \fi
}
\def\unsetglyphbb#1{\x_cs\let{gb-#1}=\x_relax}

\def\first_of_four#1#2#3#4{#1}
\def\second_of_four#1#2#3#4{#2}
\def\third_of_four#1#2#3#4{#3}
\def\fourth_of_four#1#2#3#4{#4}

\def\bbleft#1{
   \if_defined{gb-#1}\then
      \expandafter\expandafter \expandafter\first_of_four
      \csname gb-#1\endcsname
   \else
      0
   \fi
}
\def\bbbottom#1{
   \if_defined{gb-#1}\then
      \expandafter\expandafter \expandafter\second_of_four
      \csname gb-#1\endcsname
   \else
      \neg{\depth{#1}}
   \fi
}
\def\bbright#1{
   \if_defined{gb-#1}\then
      \expandafter\expandafter \expandafter\third_of_four
      \csname gb-#1\endcsname
   \else
      \width{#1}
   \fi
}
\def\bbtop#1{
   \if_defined{gb-#1}\then
      \expandafter\expandafter \expandafter\fourth_of_four
      \csname gb-#1\endcsname
   \else
      \height{#1}
   \fi
}


% Make \afmtomtx generate \setglyphbb commands:
\def\afm_char{
   \a_count=-\bbox_lly
   \eval_expr{
      \italcorr_expression\x_width\bbox_llx\bbox_urx\bbox_lly\bbox_ury
   }
   \out_line{
      \ifnum -1<\char_slot
         \string\setrawglyph
      \else
         \string\setnotglyph
      \fi
      {\char_name}
      {\raw_font_name}
      {10pt}
      {\the\char_slot}
      {\the\x_width}
      {\the\bbox_ury}
      {\the\a_count}
      {\the\result}
   }
   \out_line{
      \string\setglyphbb{\char_name}
      {\the\bbox_llx}{\the\bbox_lly}{\the\bbox_urx}{\the\bbox_ury}
   }
}


% Make sure \setglyphbb is transformed OK.
% Slanting of course cannot be done exactly when only the bbox
% is known.
\def\mtxtomtx_setglyphbb#1#2#3#4#5{
   \eval_expr_to\a_count{\add{
      \scale{#2}{\int{x-scale}}
   }{
      \scale{#3}{\int{slant-scale}}
   }}
   \eval_expr_to\b_count{\scale{#3}{\int{y-scale}}}
   \eval_expr_to\c_count{\add{
      \scale{#4}{\int{x-scale}}
   }{
      \scale{#5}{\int{slant-scale}}
   }}
   \eval_expr_to\d_count{\scale{#5}{\int{y-scale}}}
   \out_line{
      \string\setglyphbb{#1}
         {\the\a_count}{\the\b_count}{\the\c_count}{\the\d_count}
   }
}
\def\mtxtomtx#1#2{{
   \ifisstr{etx-name}\then
      \def\do_slot{\x_cs\edef{slots-\slot_name}{\the\slot_number}}
      \directfalse
      \inputetx{\str{etx-name}}
      \edef\a_macro{\string\reencodefont{\str{etx-name}}}
   \else
      \let\a_macro=\empty_command
   \fi
   \_a_true
   \ifnum \int{x-scale}=\int{y-scale}
      \ifnum \int{slant-scale}=\z@
            \_a_false
   \fi \fi
   \if_a_
      \a_count=\int{x-scale}
      \l_inv_scale\a_count{\int{y-scale}}
      \b_count=\int{slant-scale}
      \l_inv_scale\b_count{\int{y-scale}}
      \edef\a_macro{\a_macro
         \string\transformfont{\the\a_count}{\the\b_count}
      }
   \fi
   \open_out{\temp_prefix#2.mtx}
   \edef\raw_font_name{#2}
   \out_line{\percent_char~Filename:~#2.mtx}
   \out_line{\percent_char~Created~by:~tex~\jobname}
   \out_line{\percent_char~Created~using:~\string\mtxtomtx{#1}{#2}}
   \out_line{}
   \out_line{\percent_char~This~file~is~used~by~the~fontinst~package.}
   \out_line{}
   \out_line{\percent_char~THIS~FILE~CAN~BE~DELETED.}
   \out_line{}
   \out_line{\string\relax}
   \out_line{\string\metrics}
   \out_line{}
   \out_line{\string\needsfontinstversion{\fontinstversion}}
   \out_line{}
   \record_transform{#2}{\string\frommtx{#1}}{\a_macro}\iftrue
   \out_line{}
   \let\setint=\mtxtomtx_setint
   \let\setdim=\mtxtomtx_setdim
   \let\setstr=\mtxtomtx_setstr
   \let\setscaledrawglyph=\mtxtomtx_setscaledrawglyph
   \let\setscalednotglyph=\mtxtomtx_setscaledrawglyph
   \let\setkern=\mtxtomtx_setkern
   \let\setglyph=\mtxtomtx_setglyph
   \let\glyphpcc=\mtxtomtx_glyphpcc
   \let\samesize=\mtxtomtx_samesize
   \let\endsetglyph=\mtxtomtx_endsetglyph
   \def\aliased{\string\aliased}
   \let\setglyphbb=\mtxtomtx_setglyphbb
     %Big redefinition for adding just that line
   \inputmtx{#1}
   \out_line{}
   \out_line{\endmetrics_text}
   \close_out{Transformed~metrics}
}}


% Finally, for completeness, the analogous thing for reglyphing.

\def\reglyph_setglyphbb#1#2#3#4#5{
   \command_survivance=0
   \def\glyphname{#1}
   \csname slots-#1\endcsname
   \iftokeep\command_survivance\then
      \out_line{
         \string\setglyphbb{\glyphname}{#2}{#3}{#4}{#5}
      }
   \fi
}
\def\reglyph_font#1#2{{
   \open_out{\temp_prefix#1.mtx}
   \out_line{\percent_char~Filename:~#1.mtx}
   \out_line{\percent_char~Created~by:~tex~\jobname}
   \out_line{\percent_char~Created~using:~\string\reglyphfont{#1}{#2}}
   \out_line{}
   \out_line{\percent_char~This~file~is~used~by~the~fontinst~package.}
   \out_line{}
   \out_line{\percent_char~THIS~FILE~CAN~BE~DELETED.}
   \out_line{}
   \out_line{\string\relax}
   \out_line{\string\metrics}
   \out_line{}
   \out_line{\string\needsfontinstversion{\fontinstversion}}
   \out_line{}
   \record_transform{#1}{\string\frommtx{#2}}{\string\reglyphfont}
      \iftrue
   \out_line{}
   \let\setint=\reglyph_setint
   \let\setdim=\reglyph_setdim
   \let\setstr=\reglyph_setstr
   \let\setscaledrawglyph=\reglyph_setscaledrawglyph
   \let\setscalednotglyph=\reglyph_setscaledrawglyph
   \let\setkern=\reglyph_setkern
   \let\setglyph=\reglyph_setglyph
   \let\glyphpcc=\reglyph_glyphpcc
   \let\samesize=\reglyph_samesize
   \let\endsetglyph=\reglyph_endsetglyph
   \let\setglyphbb=\reglyph_setglyphbb
   \inputmtx{#2}
   \out_line{}
   \out_line{\endmetrics_text}
   \close_out{Reglyphed~metrics}
}}



\normalcc


\endinput
%%% End bbox.sty




More information about the fontinst mailing list