Home

Contact Us

General

Initiative B@bel

WSI Guidelines

Encoding

Principles

Unicode

Training

Tutorials

PUA

Conversion

Resources

Utilities

TECkit

Maps

Resources

Input

Principles

Utilities

Tutorials

Resources

Type Design

Principles

Design Tools

Formats

Resources

Font Downloads

Gentium

Doulos

IPA

Rendering

Principles

Technologies

OpenType

Graphite

Resources

Font FAQ

Links

Glossary


NRSI: Computers & Writing Systems

SIL HOME | SIL SOFTWARE | SUPPORT | DONATE

You are here: Rendering > Resources
Short URL: http://scripts.sil.org/Reprise_tutorial

SIL Reprise Tutorial

Bob Hallissy, 2007-02-19

Introduction

This tutorial will guide you through the process of using SIL Reprise to creating a Unicode “smart font” from a legacy font that was built using the SIL Encore 3 Font System. The tutorial assumes you are using Microsoft Windows XP.

Prerequisites

The legacy font and initial mapping table, and some test data are supplied in the following download:

Files for Reprise tutorial
Bob Hallissy, 2007-02-21
Download "Reprise_tutorial_files.zip", ZIP archive, 258KB [1396 downloads]

You should download this archive and unpack it to a new folder that will then be your working directory for this tutorial.

You should now review the requirements for using Reprise:

  • Permission to modify the font: As this is an SIL Encore font, you have permission to modify it.
  • Source for TECkit mapping: The mapping for this tutorial is supplied in TECkit-syntax source form.
  • TECkit compiler: Start a Command Prompt (aka DOS box) and type in the command TECkit_compile.exe followed by  Enter . If you get the compiler’s “usage” message then you are set. If, however, you get a message that ‘TECkit_compile.exe’ is not recognized... then you have some work to do: If you haven’t downloaded and unpacked the TECkit zip archive then you should do that now. Once you have done that you should modify your system’s PATH variable to include the folder where you unpacked TECkit. (You edit the PATH from Control Panel / System / Advanced / Environment Variables , select Path from the System variables and click  Edit . Add the correct folder name to the end of the string, separating it from what precedes by a semicolon.
  • If you want to create an OpenType font for use in applications such as Toolbox, Paratext, Office or XeTeX, then you will need Microsoft VOLT which, although free, does require you to register with the  MSN VOLT Community. If you have trouble obtaining VOLT, please contact me via my feedback form.
  • If you want to create a Graphite font for use in FieldWorks, then you will need the Graphite compiler. To see if that is already on your system, start a Command Prompt and type in the command grcompiler.exe followed by  Enter . If you get the compiler’s “usage” message then you are set. If, however, you get a message that ‘grcompiler.exe’ is not recognized... then you have some work to do. The steps are analogous to those above for the TECkit compiler, so won’t be repeated here.

You should download and install the Doulos SIL Unicode font. This will be useful in viewing the Legacy Mapping Workbook and also the test data documents.

You may also benefit from having SIL ViewGlyph and  Unibook programs installed and available on your system.

Oh, and of course, you need the SIL Reprise program itself, downloaded and copied to a folder that is named on your PATH.

Files supplied

The following files are supplied in the tutorial files archive

  • TESTESR.ttf — the legacy font that we will be converting to Unicode. The font name is Test Test SILSophia. You should go ahead and install this font in your system, which you can do by dragging it to your system fonts folder.
  • TESTESR.map — this is the draft of a TECkit mapping for our legacy font. This exactly as generated by the Encore2Unicode utility except that the header lines have been edited so that the map compiles. As always, remember that Encore2Unicode generates draft mappings that almost always need hand tweaking before they are ready for production work. This test case is no different, as we'll see.
  • Test Test Legacy Mapping Workbook.xls — This Excel spreadsheet is derived from Creating a Chart of Your Legacy Mapping and has been filled in according to what is in our legacy font. This might have been done by the person developing the map and, although not actually necessary for this tutorial, is provided to give you a jump-start on understanding where the interesting parts of our font are. In particular, the spreadsheet has highlighting on the rows that represent the non-standard characters in this font. For those who do not have Excel, the highlighted rows are reproduced here:

Legacy Mapping workbook for tutorial legacy font



  • TestData (Legacy).txt — this is a plain-text file that contains some test data in our legacy encoding, and should be viewed with the legacy font.
  • TestData (Unicode).txt — this is a plain-text file that contains test data in Unicode, including both composed and decomposed sequences involving the combining acute, and should be viewed with a Unicode font such as Doulos SIL or a successfully Reprised version of the legacy font.
  • TestData.doc — this Word document contains the test data in legacy and Unicode. The legacy data is formatted with our legacy font, Test Test SILSophia, and the Unicode is provided twice: once formatted once with Doulos SIL for reference (so you know what the Unicode text ought to look like), and once formatted with what will be our Reprised font, Test Test SILSophia Reprise. Of course you don't yet have that font, so the last section of the document will not yet look like the first.
  • TestData.wpx — a WorldPad document containing the same test data, in Unicode. (However it does not include both composed and decomposed sequences as FieldWorks applications normalize all data. Currently FieldWorks renders NFC if the font has no Graphite smarts and NFD if it does.)

Understanding the legacy encoding

Looking at the Test Test Legacy Mapping Workbook.xls (or the above graphic) or, alternatively, examining the font using ViewGlyph or Unibook, we find there are 6 special characters in this font, that is 6 that are not standard characters in the Windows character set — these will be the focus of the tutorial. These are:

  • xC6, xE6 — Upper and Lower case eng
  • xD7, xF7 — a combining mark (small x above) in two glyph versions: one for upper case vowels, and one for lower case vowels.
  • x8C, x9C — special composite glyphs for upper and lower case i plus the combining small x above).

Note that this legacy font is not from any existing project, but was made up for the purposes of this exercise. In particular, the use of combining x above was chosen particularly because there are no Unicode composite characters using this diacritic, and that gives us something interesting to work with.

In addition to the above special characters, the hypothetical project from which this font came also requires the acute accent on the 5 vowels. Of course those are in their "normal" Windows font locations. But they do add some interesting cases to deal with.

First attempt

If everything is unpacked and, as needed, installed, you can try using SIL Reprise. If you don't have one already, start a Command Prompt and change directory to working folder you created earlier (the one containing the legacy font and mapping). Then the Reprise command line would be:

reprise testesr.map testesr.ttf out.ttf

or, if you wanted to produce GDL source as well:

reprise -g out.gdl testesr.map testesr.ttf out.ttf

Now if you try this, you will get some errors from Reprise:

Conflicting mapping rules for U+033D /  _
    (lines 205 and 237); Rule on 237 ignored
Mapping does not specify whether it wants NFC or NFD. Therefore the Reprised
    font may not work as well as it could.

If you get some other error messages, then do not continue, but carefully recheck your steps to this point.

Ignoring the second message for the moment, let's look at the first error: Conflicting mapping rules. Looking in the mapping file at lines 205 and 237 we find:

0xD7 <> U+033D ; combining_x_above -- SILID 0133 (space glyph ignored) + SILID 6064
0xF7 <> U+033D ; combining_x_above -- SILID 0133 (space glyph ignored) + SILID 6064

Note that when mapping from Unicode back to legacy, U+033D COMBINING X ABOVE is on both rules (with identical, empty, context). Which of these ambiguous rules should TECkit use? As it turns out, TECkit silently chooses the earlier of such conflicting lines. In our font that would mean that xD7 would always be used no matter what vowel it was with. In order to get our font to work properly we need to disambiguate these rules.

We know from our review of the font that legacy character xD7 is for upper case vowels, and xF7 is for lower case vowels. So we need to change one of these into a contextual rule. Let's make the upper case one the contextual rule. So we change it to look something like:

0xD7 <> U+033D  / [TallVowel] ; combining_x_above -- SILID 0133 (space glyph ignored) + SILID 6064

and we have to add the class definition for TallVowel (after the header but before it is used. Somewhere around line 21 would be reasonable:

UniClass [TallVowel] = ( U+0041 U+0045 U+004F U+0055 )

Note that we intentionally omit U+0049  LATIN CAPITAL LETTER I from this class because upper and lower case i are handled with the ligature rules already created by Encore2Unicode (see rules for legacy codes x8C and x9C in the mapping file).

Second attempt

After making the above edits and saving your mapping file, you should try Reprise again using the same command line as given above. You should now just get one error about NFC/NFD.

Compiling font with VOLT

If you want to build OpenType smarts into your font, now is the time to launch Microsoft VOLT (it should be on your Start menu) and open up the file that Reprise created (out.ttf). When you do that, you should see something like the following:

Reprise Tutorial — Second attempt



It may be fun for you to look at the Lookups and Glyph Groups (by double-clicking) to see their relation to things in the mapping file. For starters, you'll find the upper and lower case i ligature rules in the ccmp_nctx_N1 lookup.

When you are ready, click on the  Compile  and  Save  buttons and then quit VOLT — you have compiled the OpenType code!

Compiling font for Graphite

If you want to compile Graphite smarts into the font (you can do this whether or not you compiled the OpenType code), at the command prompt execute the following command:

grcompiler.exe out.gdl out.ttf final.ttf

You should see a number of messages from the compiler, similar to:

Graphite Compiler Version 3.0
Copyright  2002-2006, SIL International.  All rights reserved.
GDL file: out.gdl
Input TT file: out.ttf
Output TT file: final.ttf
Output font name: T
Silf table version (default): 2.0

Parsing file out.gdl...
Initial processing...
Checking for errors...
Compiling...
Compilation successful!

If you get other error messages, make sure that you specified -g along with a file name on the Reprise command line in order to create the GDL source, and that you supplied the same file name as the first parameter to grcompiler.

Note

If you have to re-run Reprise for any reason, e.g., you forgot to supply the -g option, remember to launch VOLT and re-compile the OpenType rules.

Install the font

Using Windows Explorer, drag the final font from the work folder to the system fonts folder.

Congratulations! You have completed your first Reprised font. Well, I suppose we should test it!

Testing

There is no one perfect strategy for testing fonts. Ultimately you have to try it out with real data in the application you will be using and see whether it works. In this case I've provided some test data to exercise some things that should work in the font.

Using Microsoft Word or OpenOffice Writer

Open up the file TestData.doc in either Microsoft Word or OpenOffice Writer.

Tip

TestData.doc uses styles to selectively format various characters, so if you want to change the fonts used in the document it is best to do so by modifying the appropriate style.

For example, in Word click on Format / Styles and Formatting, make sure at the bottom of the task pane that Show Available Styles. Then drift your cursor over style you want to modify, such as Data - Reprise, and from the dropdown menu select Modify....

Opening up TestData.doc, you'll see three sections: Legacy font, Unicode font, and Reprise font. In each case, just below the test data, character codes are shown in hex.

An important difference between the Legacy and Unicode text is that in Unicode some of the combining character sequences are shown twice. This is because Unicode has more than one representation of, for example capital A plus acute.

If you use Microsoft Word, you might see something like the following:

Reprise Tutorial — Second attempt





Note particularly the lower right-hand section where Unicode decomposed data is displayed: the acute marks are not right. Worse, the dot on the lower case i didn't get removed to account for the acute:

Improperly rendered combining marks



Testing Graphite smarts with WorldPad

If you have compiled Graphite smarts into the font, you can test it with WorldPad. Launch the TestData.wpx file and you should see something similar to the following:

Reprise Tutorial — Second attempt



Between Word and WorldPad examples, we finally begin to understand the implication of that other Reprise warning that we ignored: with neither ExpectsNFC nor ExpectsNFD in the mapping, Reprise doesn't generate any rules to handle composed or decomposed sequences.

Third attempt

Let's get rid of that last Reprise warning. To do so, add to your TECkit mapping the line:

RHSFlags    (ExpectsNFC)

up near the top, around line 17 or so. After saving your map, re-run Reprise, VOLT, and/or grcompiler to build a new font. Reprise should not generate any errors now. If you launch VOLT, you should see something like the following:

Reprise tutorial — Third attempt



Notice the additional Lookup named precompositions. This lookup does the work of detecting and composing sequences that are supported by the font.

Re-testing

Now it is time to test our third attempt. But an important warning first!

Important note!

There is an important thing to remember when replacing fonts with newer ones. Before removing fonts from your Fonts folder, be sure to quit all applications that might be using the font, including Word, Notepad, Writer, FieldWorks, ViewGlyph, your email client, etc.

Most users never run into this problem because they rarely remove fonts, and even if they do they aren't trying to replace them with newer ones. Windows will get confused in the process if an application is using one of the fonts.

If you do get into a situation where Windows seems to be confused regarding any particular font, the best bet is to re-boot the computer.

So to test your new font, quit Word, Writer, or whatever you were using, then delete the old font from your Fonts folder and drag the new one in. Now you can re-launch your test document.

Congratulations!

At this point you should have a successful, working, Unicode font. For more information about Reprise, see the sidebar at the top of this page.

If you have information, success stories, or bug reports you would like to give me about this tutorial or about Reprise, please visit my feedback page.


© 2003-2017 SIL International, all rights reserved, unless otherwise noted elsewhere on this page.
Provided by SIL's Non-Roman Script Initiative. Contact us here.