1. Summary
This section briefly explains what UDC is, and why UDC migration is necessary when migrating the Solaris desktop environment from CDE to JDS.
1.1 What Is UDC?
UDC (User-Defined Characters) are characters defined by the user, such as characters not defined by the existing character set (i.e., characters not included in the system fonts), or logo symbols, etc., so that they can be handled in the same way as the existing character set. The use of these characters, which are also called "external characters", is not recommended when exchanging communications and document data, but there is a history of their use in Japan and elsewhere, and even now they are used within the closed sphere of shared character data. Solaris version 2.6 or later supports UDC using the sdtudctool tool, which creates and installs UDC fonts for use in the CDE environment.
1.2. UDC on CDE and JDS
When the desktop environment is migrated from CDE to JDS, the desktop applications will be changed from CDE/Motif-based to GNOME/Gtk-based. Fonts are handled very differently by CDE/Motif-based applications and GNOME/Gtk-based applications, so there is a problem that UDC fonts defined for CDE cannot be used in GNOME/Gtk environments. Further, the sdtudctool for CDE is not suitable to create UDC fonts used on JDS, and there is a possibility that this will not be supported in future releases. UDC configuration on CDE and how to use UDC fonts created in CDE on a JDS environment are explained below.
2. UDC configuration on CDE and Procedure for Migrating to JDS
This section explains UDC fonts on a CDE environment created using sdtudctool. Further, the section also introduces how to convert the font format to the one that can be used in JDS, and also refers to the UDC inputs at the end.
2.1. Configuration of UDC Created Using sdtudctool
The sdtudctool generates both bitmap font (pcf) which is used for drawing by the CDE/Motif application and outline fonts (Type 1) which is used by DPS application and the /usr/lib/lp/postscript/jpostprint print utility. These fonts do not have UDC encoding information, but mapping to these fonts from UDC area code points is defined by locale data in the system.
The data generated when end users create UDC using sdtudctool in a Japanese locale is described below.
$HOME/.Xlocale/ja/fonts/UDC/Bitmaps/*.pcf
When drawing character strings in a Japanese locale, these bitmap fonts are used in the external character area of the encoding defined in the locale.
$HOME/.Xlocale/ja/fonts/UDC/Type1/*.pfa
These Type 1 fonts are called UDCnum.pfa (where "num" is an integer from 1 to 69), and one font has a 94-character UDC. Encoding is allocated in order from UDC1 in the locale external character area by the system locale data.
$HOME/.Xlocale/ja/fonts/UDC/CID/*.ps
These "ps" files are resource files which enables DPS applications to use PostScript fonts with UDC. These files are only used by DPS.
Note: If a super user is using sdtudctool, the $HOME/.Xlocale described above becomes /usr/openwin/lib/locale.
Of these three data types, the Type 1 font is used when migrating to JDS.
2.2. Converting from Type 1 to TrueType
You can migrate UDC used on CDE environment to JDS by converting Type 1 fonts to TrueType fonts. A conversion example using the open source font editor fontforge (http://fontforge.sourceforge.net/) is described below.
The script and fontforge Solaris package described here can be downloaded from here.
- Obtain fontforge.
The fontforge binary and source can be obtained from http://fontforge.sourceforge.net/.The following example assumes that the fontforge command has been installed to /opt/sfw/bin.
- Create a script which creates an Unicode encoding sdf file from the Type 1 (pfa) font set.
(The sdf file is a font format for fontforge'd editing use.)
Create the following fontforge script with the name mksdf.pe in the /opt/sfw/share/udcpfa2ttf directory.
#!/opt/sfw/bin/fontforge
pfafile=$1
num=Strtol($2)
sfdfile=$3
Open(pfafile)
Select(0x21,0x7e)
Copy()
Close()
if ($4 == "1")
New()
Reencode("unicode")
else
Open(sfdfile)
endif
i = 0xe000 + 94 * (num ? 1)
Select(i)
Paste()
Select(i, i + 94)
Move(0, -150)
ExpandStroke(40)
Save(sfdfile)
Quit(0)
- Create a fontforge script which creates the TrueType (ttf) font from the sdf file.
Create the following fontforge script with the name mkttf.pe in the /opt/sfw/share/udcpfa2ttf directory.
#!/opt/sfw/bin/fontforge
sfdfile=$1
ttfile=$2
en_US = 0x401
FontName = "EUDC"
FontFamilyName = "EUDC"
FontSubfamilyName = "Regular"
FontVersion = "1.0"
PostScriptName = "EUDC"
Open(sfdfile)
SetFontNames(FontName,FontFamilyName,FontName,FontSubfamilyName)
SetTTFName(en_US, 1, FontFamilyName)
SetTTFName(en_US, 2, FontSubfamilyName)
SetTTFName(en_US, 4, FontName)
SetTTFName(en_US, 5, FontVersion)
SetTTFName(en_US, 6, PostScriptName)
SetPanose(3, 9)
Generate(ttfile, "ttf", 0x80004)
Quit(0)
- Create a perl script to run.
Create the following perl script with the name udcpfa2ttf in the /opt/sfw/bin directory.
#!/usr/bin/perl
use strict;
my $fontforge="/opt/sfw/bin/fontforge";
my $sharedir="/opt/sfw/share/udcpfa2ttf";
my $usage = << "_USAGE";
Usage: $0 <directory> [<ttf file>]
<directory> : Specify UDC/Type1 directory created by sdtudctool
<ttf file> : Specify converted ttf file, default is eudc.ttf
ex $0 \$HOME/.Xlocale/ja/fonts/UDC/Type1
_USAGE
my $directory = shift;
if (not defined $directory) {
die $usage;
}
my $ttfile = shift;
if (not defined $ttfile) {
$ttfile = "eudc.ttf";
}
my $flag=0;
for (my $i = 1; $i < 69; $i++) {
if (-f "$directory/UDC$i.pfa") {
$flag++;
if (! -f $fontforge) {
print STDERR "$fontforge is not found\n";
print STDERR "Please install $fontforge\n";
exit(1);
}
print "Extracting UDC$i.pfa...\n";
system("$fontforge -script $sharedir/mksfd.pe $directory/UDC$i.pfa $i sfdfile.sfd $flag > fontforge.log 2>&1");
}
}
if ($flag == 0) {
print STDERR "No UDC?.pfa font was found in $directory\n";
exit(1);
} else {
system("$fontforge -script $sharedir/mkttf.pe sfdfile.sfd $ttfile >> fontforge.log 2>&1");
exit(0);
}
- Specify the directory containing Type 1 font, and run the script created in step 4.
After running the script, eudc.ttf file will be generated in the current directory.
% /opt/sfw/bin/udcpfa2ttf $HOME/.Xlocale/ja/fonts/UDC/Type1
Extracting UDC1.pfa...
Extracting UDC2.pfa...
Extracting UDC3.pfa...
Extracting UDC4.pfa...
Extracting UDC5.pfa...
Extracting UDC6.pfa...
Extracting UDC7.pfa...
:
Extracting UDC69.pfa...
%
- Copy the generated eudc.ttf file in a directory recognized by fontconfig (e.g., $HOME/.fonts, etc.)
% cp eudc.ttf $HOME/.fonts
The UDC used on CDE can now be used from the GNOME/Gtk application. Just like the EUDC.TTE font created by the Windows external fonts editor, the eudc.ttf font created here is allocated to the Private Use Area (PUA, 0xE000 to 0xF8FF) of Unicode encoding.
2.3. Dictionary of Input Methods
When a UDC is registered using sdtudctool, you can create a file to bulk-register all UDC readings to the ATOK12 and Wnn6 dictionaries using sdtudc_register. The UDC information registered to the input methods dictionary on CDE can also be used by JDS. The UDC migrated to JDS by the method in 2.2 above can be input on JDS refering to user dictionaries in CDE in the same way as users do on CDE. For details of the dictionaries when using JDS on a new system, refer to "Japanese Input System Summery & Transition".
Note 1: Sun Microsystems does not provide support for open source font editor fontforge and scripts included in the downloads. Note 2: For fontforge licenses and copyright, refer to License and Copyright.
Next: Handling UDC Using JDS »
|
|