lout-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Latin Modern fonts


From: Ludovic Courtès
Subject: Re: Latin Modern fonts
Date: Tue, 18 Jan 2005 10:03:36 +0100
User-agent: Mutt/1.5.3i

Hi,

I'm replying to myself since I found a way to fix the problem.  A patch
is attached below.

On Thu, Jan 13, 2005 at 09:17:04AM +0100, Ludovic Courtès wrote:
>   49,15: ignoring unencoded ligature character quoteleft.dup in font file 
> /usr/share/lout/font/lmr10 (line 74)
>   49,15: ignoring unencoded ligature character IJ in font file 
> /usr/share/lout/font/lmr10 (line 84)
>   49,15: ignoring unencoded ligature character ff in font file 
> /usr/share/lout/font/lmr10 (line 113)

Basically those messages are due to the fact that `quoteleft.dup', `IJ',
`ff', etc. are "unencoded" characters, i.e. they don't have an actual
character code (see [1] for the AFM specs):

  C -1 ; WX 583.33333 ; N ff ; B 27 0 628 705 ; L i ffi ; L l ffl ;

The Adobe fonts that come with Lout do not have this problem, simply
because they don't have all those ligatures.  Adding support for the use
of unencoded characters as ligature characters should not be impossible,
I think.  Jeff?

>   C 102 ; WX 305.55556 ; N f ; B 33 0 357 705 ; L f ff ; L i fi ; L k f_k ; L 
> l fl ;

In this particular example, `ff' and `f_k' are unencoded characters so
Lout currently ignores them, hence the warning message.  However, Lout
also ignores all the ligatures for `f' that it has read _before_ the
ignored ligature.  That is, when it reads the `f_k' ligature and decides
to ignore it, it completely clears the list of ligatures for `f' and
therefore forgets about `fi'.

The patch below against Lout 3.30 fixes this.  Jeff, please let me know
if this is ok by you.

Thanks,
Ludovic.

[1] http://partners.adobe.com/public/developer/en/font/5004.AFM_Spec.pdf


diff -ubB --show-c-function /home/ludo/tmp/lout-3.30/z37.c.bak 
/home/ludo/tmp/lout-3.30/z37.c
--- /home/ludo/tmp/lout-3.30/z37.c.bak  2005-01-17 13:40:21.000000000 +0100
+++ /home/ludo/tmp/lout-3.30/z37.c      2005-01-18 09:39:05.000000000 +0100
@@ -317,7 +317,8 @@ static void ReadCharMetrics(OBJECT face,
       }
       else if( StringEqual(command, "L") &&
        BackEnd->uses_font_metrics && ch != '\0' )
-      { if( lig[ch] == 1 )  lig[ch] = (*ligtop) - MAX_CHARS;
+      { int prev_ligtop = *ligtop, prev_lig = lig[ch];
+       if( lig[ch] == 1 ) lig[ch] = (*ligtop) - MAX_CHARS;
        lig[(*ligtop)++] = ch;
        i++;  /* skip L */
        while( buff[i] == ' ' )  i++;
@@ -328,7 +330,10 @@ static void ReadCharMetrics(OBJECT face,
          else
          { Error(37, 1, "ignoring unencoded ligature character %s in font file 
%s (line %d)",
              WARN, &fpos(AFMfilename), command, FileName(fnum), *lnum);
-           lig[ch] = 1;
+           /* Restore ligature pointers as they were before we read this
+              invalid ligature */
+           lig[ch] = prev_lig;
+           *ligtop = prev_ligtop;
          }
          if( *ligtop > 2*MAX_CHARS - 5 )
            Error(37, 2, "too many ligature characters in font file %s (line 
%d)",
@@ -336,6 +341,8 @@ static void ReadCharMetrics(OBJECT face,
          while( buff[i] != ' ' && buff[i] != ';' )  i++;
          while( buff[i] == ' ' ) i++;
        }
+       if (*ligtop != prev_ligtop)
+         /* Add a trailing zero if a ligature was actually read */
        lig[(*ligtop)++] = '\0';
       }
       while( buff[i] != ';' && buff[i] != '\0' )  i++;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]