[Foxet] fonts again

Adam Lindsay atl at comp.lancs.ac.uk
Mon Apr 4 16:58:04 CEST 2005


On 4 Apr 2005, at 13:17, Bruce D'Arcus wrote:

> You mean there's no way for foxet to determine what fonts are  
> available, so it needs to basically guess?

XeTeX is able to guess the Bold/Italic alternatives, given the Regular  
alternative. I use this in the "wildcard" typescripts, and just hacked  
up a demo [you deserve what you get if you try this in production...]  
that can be woven into foXet. I add the following definitions into the  
environment file:

\def\setFOfontname
    
{\edef\xFOfontname{FO:\FOfontfamily:\FOfontweight:\FOfontstyle: 
\FOfontvariant}%
    \doifdefined{XeTeXversion}{\directsetup{fe:font:xetex:guess}}% new  
bit
    \doifelsefontsynonym{\xFOfontname}
      {\let\FOfontname\xFOfontname}
      {\edef\xFOfontname{FO:\FOfontfamily:\FOfontweight:\FOfontstyle}%
       \doifelsefontsynonym{\xFOfontname}
         {\let\FOfontname\xFOfontname}
         {\edef\xFOfontname{FO:\FOfontfamily:\FOfontstyle}%
          \doifelsefontsynonym{\xFOfontname}
            {\let\FOfontname\xFOfontname}
            {\edef\xFOfontname{FO:\FOfontfamily:\FOfontweight}%
             \doifelsefontsynonym{\xFOfontname}
               {\let\FOfontname\xFOfontname}
               {\edef\xFOfontname{FO:\FOfontfamily}%
                \doifelsefontsynonym{\xFOfontname}
                  {\let\FOfontname\xFOfontname}
                  {}}}}}}

\startsetups fe:font:xetex:guess

   % XeTeX is good at guessing a few names, so we emulate the Xserif  
wildcard typescripts
   \doifelse\FOfontweight{bold}
   	{\doifelse\FOfontstyle{italic}
   	   
{\definefontsynonym[FO:\FOfontfamily:bold:italic]["\FOfontfamily/ 
BI"][encoding=uc]}
   	  {\definefontsynonym[FO:\FOfontfamily:bold]        
["\FOfontfamily/B"] [encoding=uc]}}
   	{\doifelse\FOfontstyle{italic}
   	  {\definefontsynonym[FO:\FOfontfamily:italic]      
["\FOfontfamily/I"] [encoding=uc]}
   	  {\definefontsynonym[FO:\FOfontfamily]            ["\FOfontfamily"]  
   [encoding=uc]}}

\stopsetups

Which works a charm on the following file:

<?xml version='1.0'?>

<!-- foxet test file - Hans Hagen - PRAGMA ADE - www.pragma-ade.com -->

<fo:root xmlns:fo='http://www.w3.org/1999/XSL/Format'>

     <fo:layout-master-set>
         <fo:simple-page-master master-name='test' margin='.5cm'>
             <fo:region-body margin='.5cm'/>
         </fo:simple-page-master>
     </fo:layout-master-set>

     <fo:page-sequence master-reference='test' initial-page-number='123'>
         <fo:flow flow-name='xsl-region-body'>
             <fo:block-container font-family='Baskerville'>
				<fo:block>Baskerville</fo:block>
                 <fo:block font-weight='bold'>Baskerville Bold</fo:block>
                 <fo:block-container font-style='italic'>
	                <fo:block>Baskerville Italic</fo:block>
     	            <fo:block font-weight='bold'>Baskerville Bold  
Italic</fo:block>
	            </fo:block-container>
             </fo:block-container>
             <fo:block-container font-family='Cochin'>
				<fo:block>Cochin</fo:block>
                 <fo:block font-weight='bold'>Cochin Bold</fo:block>
                 <fo:block-container font-style='italic'>
	                <fo:block>Cochin Italic</fo:block>
     	            <fo:block font-weight='bold'>Cochin Bold  
Italic</fo:block>
	            </fo:block-container>
             </fo:block-container>
<!--            <fo:block-container font-family='Hoefler Text'>
				<fo:block>Hoefler</fo:block>
                 <fo:block font-weight='bold'>Hoefler Bold</fo:block>
                 <fo:block-container font-style='italic'>
	                <fo:block>Hoefler Italic</fo:block>
     	            <fo:block font-weight='bold'>Hoefler Bold  
Italic</fo:block>
	            </fo:block-container>
             </fo:block-container> -->
        </fo:flow>
     </fo:page-sequence>
</fo:root>


However (hi Hans!), when there's a font family with a space in it,  
ConTeXt falters:

kpathsea: Illegal fontname `FO:HoeflerFO:Hoefler': contains ':'

! Font \**\definedfont**=FO:HoeflerFO:Hoefler not loadable: Metric  
(TFM) file o
r ATSUI font not found.
<to be read again>
                    T
\lastfontname ->FO:HoeflerFO:Hoefler T
                                       ext at 10.0pt
\definefontlocal ...me #1\endcsname \lastfontname
                                                   \relax
\dododefinefont ...ontspec {#2}\rawfontidentifier
                                                   \let  
\localrelativefontsiz...

\dodefinedfont ...\string \definedfont \endcsname
                                                   \the \everydefinedfont
\@@su:fo:font:setup ...dfont [\FOfontdefinition ]}
                                                   \fi \fi
...
l.32 ^^I^^I^^I^^I<fo:block>
                            Hoefler</fo:block>


> Life is too short for me to spend ages learning the intricacies of  
> ConTeXt.  I really don't have the time.

And yet you have time to get deep into FO?
Well, different strokes for different folks, I suppose...




-------------- next part --------------
A non-text attachment was scrubbed...
Name: fonttest.pdf
Type: application/pdf
Size: 45917 bytes
Desc: not available
Url : http://www.ntg.nl/pipermail/foxet/attachments/20050404/25badbbc/fonttest-0001.pdf


More information about the Foxet mailing list