#!/usr/local/bin/fontforge
# Time-stamp: <2005-02-05 19:06:36 ralf> 
# Copyright 2004, 2005 Ralf Stubner
# See the file COPYING (GNU General Public License) for license
# conditions. 

# prepare and copy SC and OsF
# MergeFonts() doesn't like in the references in Palladio-SC
Open("Palladio-SC.sfd");
Select("zero","nine", "a","z", "grave","caron");
SelectMore("ae");
SelectMore("lslash");
SelectMore("oslash");
SelectMore("oe");
SelectMore("adieresis","iogonek", "dcroat","thorn"); 
SelectMore("commaaccent");
UnlinkReference();
Copy();

Open("uplr8a.pfb");
# proper setup with names etc
fontname="TeXPalladioL-SC";
fontfamily="TeX Palladio L";
fullname="TeX Palladio L Small Caps & Old Style Figures";
copyright=$copyright+", Copyright 2004, 2005 Ralf Stubner.";
copyright=AddGPL(copyright);
copyright=AddException(copyright);
fontversion="1.001";

SetFontNames(fontname,fontfamily,fullname,"",copyright,fontversion);
# No UniqueID (needs recent ff to work properly)
SetUniqueID(-1);
# use OtherSubrs from URW (needs recent ff to work properly)
ReadOtherSubrsFile("URW-OtherSubrs.ps");

# paste OsF and SC
Select("zero","nine", "a","z", "grave","caron");
SelectMore("ae");
SelectMore("lslash");
SelectMore("oslash");
SelectMore("oe");
SelectMore("adieresis","iogonek", "dcroat","thorn"); 
SelectMore("commaaccent");
Clear();
Paste();

# ligatures
Select("fi","fl");
BuildComposite();
UnlinkReference();

Select("s");
width=CharInfo("Width");
Copy();
Select("germandbls");
Clear();
Paste();
Move(width,0); 
PasteInto();

# dotlessi
Select("i");
Copy();
Select("dotlessi");
Paste();

# build q and real accents
Select("q");
SelectMore("lslash");
SelectMore("oslash");
SelectMore("aogonek");
SelectMore("ccedilla");
SelectMore("eogonek");
SelectMore("uogonek");
SelectMore("scedilla");
SelectMore("iogonek");
SelectMore("dcroat");
RemoveOverlap();
Simplify();
RoundToInt();

# underscore
Select("underscore");
Scale(100,116,0,0);
Move(0,-15);

# emdash
Select("emdash");
Scale(75,100,0,0);
Move(125,0);
SetWidth(1000);
RoundToInt();


# kerning
RemoveAllKerns();
MergeKern("pplrc9d-kern.afm");

# hinting
ChangePrivateEntry("BlueValues","[-20 0 469 481 487 499 692 712]");

Save("TeXPalladioL-SC.sfd");
# generte Type1, scale generate TTF
Generate("fplrc8a.pfb","",3); 
# ScaleToEm(2048);
# Generate("fplrc8a.ttf","",0x80); 

Quit(0);

