Computers & Writing Systems
SIL Reprise Tutorial
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.
The legacy font and initial mapping table, and some test data are supplied in the following download:
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:
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.
Oh, and of course, you need the SIL Reprise program itself, downloaded and copied to a folder that is named on your PATH.
The following files are supplied in the tutorial files archive
Legacy Mapping workbook for tutorial legacy font
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:
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.
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).
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 theand 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.
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!
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.
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.
Let's get rid of that last Reprise warning. To do so, add to your TECkit mapping the line:
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.
Now it is time to test our third attempt. But an important warning first!
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.
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-2020 SIL International, all rights reserved, unless otherwise noted elsewhere on this page.