Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

What is the easiest way to express replacement rules like “If a letter follows, replace ‘s’ by ‘ſ’” and “If a non-letter/word-boundary follows, replace ‘g’ by ‘g.final’” in a pl file?

Context

I am still trying to get my blackletter font to work with some flavour of LaTeX. I made a lot of progress adapting it to vanilla pdflatex. (Using a perl script that writes the ligatures part for the pl file, because FontForge does not export ligatures to tfm. That script is also in that repository.)

I have difficulties finding the documentation for the language of pl files. I think there is one which I had found earlyer, but I cannot find it again.

Does the declaration (BOUNDARYCHAR O 14) define which character to use for typesetting spaces?

Does that mean that if I want dots and commas to also behave as word boundaries, I need to add them explicitly, expanding the likes of

(BOUNDARYCHAR O 14)
...
(LABEL BOUNDARYCHAR)
(LIG O 167 O 30)
(LIG O 166 O 27)
(STOP)
(LABEL O 163)
(LIG O 14 O 33)
(STOP)

to

(BOUNDARYCHAR O 14)
...
(LABEL BOUNDARYCHAR)
(LIG O 167 O 30)
(LIG O 166 O 27)
(STOP)
(LABEL O 54)
(LIG O 167 O 30)
(LIG O 166 O 27)
(STOP)
(LABEL O 56)
(LIG O 167 O 30)
(LIG O 166 O 27)
(STOP)
(LABEL O 163)
(LIG O 14 O 33)
(LIG O 54 O 33)
(LIG O 56 O 33)
(STOP)

and even more if I also want other non-letters to be word boundaries? Since both letters and non-letters are quite a few, changing “If a non-letter follows, replace ‘ſ’ by ‘s’” to “If a letter follows, replace ‘s’ by ‘ſ’” does not seem easier, either. Is there good way to do this, preferably one where I don't have to list half the characters in my font for every (LABEL) block?

share|improve this question
    
The manual should be the pltotf source code documentation (texdoc pltotf in TeX Live should find it). –  Khaled Hosny Oct 30 '12 at 5:24
    
regarding your question whether BOUNDARYCHAR defines which character is used for typesetting spaces, with any flavor of tex, spaces are not set from a character (except for the special case of cmtt, which contains a "visible space" glyph ro be used on request in verbatim strings). instead, they are set as explicit commands to advance by a specified amount in the horizontal direction. the meaning of BOUNDARYCHAR is given in the pltotf manual cited by khaled. –  barbara beeton Oct 30 '12 at 13:19
    
Have you considered using fontinst to do this? It makes this stuff a lot easier since it will basically generate the pl and vpl files for you, along with map and encoding files. –  cfr Dec 13 '13 at 4:28
1  
How would fontinst know that I want the substitution "If a letter follows, replace s→ſ" (or even v→v.final, which is definitely non-standard) to generate the appropriate .pl files? –  Anaphory Dec 13 '13 at 12:54
    
v->v.final is easy. fontinst can definitely do this. You just write the rules in the .etx file correctly and fontinst will transform things as necessary.venturisadf supports 'end-of-word swashes' automatically in this way i.e. you only get the swash at the end of the word. You could technically say the equivalent of 'if a letter follows...' but it would be easier to put longs in the standard position for 's' and then set the regular s as as the non-standard end-of-word case (as for v.final). You need to set a slot aside to mark the right boundary of words. Everything else is just ligatures. –  cfr Jan 3 at 4:04
add comment

1 Answer

I have always done this with fontinst. However, if you do want to do this directly, I think you need something like this:

(BOUNDARYCHAR O 14)

This doesn't define a space for TeX. It is a slot. You don't need to put anything in it, even. In fact, it is much easier if you don't need to use the slot for any character i.e. if you can spare a slot just to mark the boundary. It marks a word end for TeX. To get a different character at the end of a word, you create a ligature consisting of that character and you tell TeX to use that ligature whenever the regular character is followed by your boundary character. Your code tries to do the ligatures the wrong way around.

Suppose that h is a character which should be typeset differently at the end of a word. Then when you get to h in the pl file, you would do this:

(LABEL C h)
(LIG O 14 O 158)

where the h.final is from slot 158. You handle the longs/s in the same way. If longs is in slot 145, say:

(LABEL O 145)
(LIG O 14 O C s)

(You may need to use O and the slot number rather than 'C s' - I'm not certain.)

Disclaimer: I have never tried editing these files directly. I've read them to debug my code or to check things or for curiosity, but I've never done it this way. I've always produced them using fontinst.

But TeX reads the line token-by-token. So you want it to find the longs, say, and then find the word boundary and to switch to the regular s in that case. Your code would replace a word boundary followed by an h, say, with h.final. Not only is that not what you want but it won't work because if h is the next character, it cannot be an end-of-word boundary.

Don't worry about what constitutes a word boundary. Let TeX worry about what constitutes a word boundary - you just figure out what is meant to happen at the word boundary.

This is easier to do than it is to explain, although I do think fontinst could save you a good deal of work!

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.