Solaris 8 Software Developer Supplement

Associating Each Font With the Shared Object That Maps the Intermediate Code Points to the Presentation Forms in the Fonts Encoding

Note –

The Current TrueType Engine employed by mp(1) is capable of dealing only with format 4 and PlatformID 3 cmap. That is, you can only configure Microsoft .ttf files. Additionally, the character map encoding has to be Unicode or Symbol for the TrueType font engine to work correctly. Because most of the .ttf fonts in the Solaris environment are obeying these restrictions, you can map all TrueType fonts in Solaris software within the mp.conf file.

When you create a shared object for mapping a font that corresponds to an X Logical Fonts Description (XLFD) , consider the following. If you are mapping a pcf/type1 font, then create the shared object that maps from the intermediate code range to the encoding specified by XLFD. For example:


The corresponding pcf font is:


This font is encoded in iso8859-8, so shared objects have to map between intermediate code and corresponding iso8859-8 code points.

But if a TrueType font with XLFD:


has the corresponding font:


In this situation, map between the intermediate code and Unicode, because the cmap encoding for the previous TrueType font is in Unicode. In the example of this TrueType font, if a sample intermediate code in the en_US.UTF-8 locale that corresponds to a Hebrew character (produced by the PLS layer) is 0xe50000e9, you need to consider the following. Because the font is Unicode encoded, design the function within the corresponding .so module in such a way that when you are passing 0xe50000e9, the output corresponds to presentation form in Unicode. The example here is 0x000005d9.

The function prototype for the <mapping function> should be:

unsigned int function(unsigned int inter_code_pt)

The following are optional keyword/value pairs that you can use in mp.conf:

PresentationForm        WC/PLSOutput

The default value is PLSOutput. If the user is specifying "WC", then the intermediate code points that are generated are Wide Characters. For CTL printing, this default value should be used.

If the locale is non-CTL locale and has the value for the keyword is PLSOutput, it is ignored and the mp(1) generates wide-character codes instead.

You can use the following optional keyword/value pairs if the locale supports CTL. These variables can assume any of the possible values given on the right side of the table.









Default is TEXT_SHAPED 

The following example illustrates the steps that you need to follow when you add a new PCF, TrueType, or Type1 printer-resident font to the configuration file.

Replace the font for displaying characters in the range 0x00000021 - 0x0000007f with a TrueType font instead of the currently configured PCF font.

Before adding a new font, look at various components in the configuration file that correspond to the currently configured font, as shown next.

FontNameAlias   iso88591R       PCF     /usr/openwin/lib/X11/fonts/75dpi/courR18PCF.Z
FontNameAlias   iso88591B       PCF     /usr/openwin/lib/X11/fonts/75dpi/courB18PCF.Z
FontGroup       iso88591         PCF       iso88591R iso88591B
MapCode2Font    0x00000020      0x0000007f      iso88591
CnvCode2Font    iso88591R _xuiso88591 /usr/lib/lp/locale/$LANG/mp/
CnvCode2Font    iso88591B _xuiso88591 /usr/lib/lp/locale/$LANG/mp/

Suppose you selected /usr/openwin/lib/locale/ja/X11/fonts/TT/HG-MinchoL.ttf as your candidate for doing the mapping in the en_US.UTF-8 locale. Because this is a Unicode character-mapped TrueType font file, in the mapping function within the .so module you only need to have a function that directly returns the incoming ucs-2 code points.

unsigned short _ttfjis0201(unsigned short ucs2) {

Save this in a ttfjis0201.c file. Create a shared object as follows.

cc -G -Kpic -o ttfjis0201.c

But if you are mapping a PCF file, such as /usr/openwin/lib/locale/ja/X11/fonts/75dpi/gotmrk20.pcf.Z, then look in the fonts.dir file in the /usr/openwin/lib/locale/ja/X11/fonts/75dpi/ directory. Become familiar with the encoding, corresponding to XLFD, which is:


If jisx0201 is the encoding, prepare a shared object that maps from ucs-2 to jisx0201. You need to obtain the mapping table for creating the .so module (if one is not already provided). For a Unicode locale, find the mappings from the many charsets to Unicode under Follow these mappings, in order to write a xu2jis0201.c file:

 unsigned short _xu2jis0201(unsigned short ucs2) {
                         if(ucs2 >= 0x20 && ucs2 <= 0x7d )
                                 return (ucs2);
                                 return (0x7e);
                         if(ucs2 >= 0xff61 && ucs2 <= 0xff9f)
                                 return (ucs2 - 0xff60 + 0xa0);

When you create a mapping file, include all the UCS-2 to jisx0201 cases.

cc  -G -o xu2jis0201.c

This example creates a shared object file.

Add this font by adding the following lines to the corresponding sections of mp.conf. The following example shows how to add the TrueType font. The PCF font follows the same pattern except that you change the keyword to PCF instead of TrueType.

FontNameAlias   jis0201R TrueType
FontGroup     jus0201        TrueType  		jis0201R
MapCode2Font		 	0x0020 	0x007f 		jis0201
CnvCode2Font  		jis0201R 		 _ttfjis0201 <.so path>

# this line needs to be deleted from mp.conf before adding.

MapCode2Font    0x0020  0x007f  jis0201 CnvCode2Font
jis0201R  _ttfjis0201 <.so path>
where the .so path points to the file.

Invoking mp(1) with the changed mp.conf file causes the range 0x0020-0x007f to be printed in the new font. Map the other Japanese character ranges too with the same .so file, for example, the range 0x0000FF61 0x0000FF9F.

To maintain backward compatibility, the /usr/openwin/lib/locale/$LANG/print/ file, if it exists, is used to create output in the current locale, where $LANG is one of the locale components. In that situation, no configuration file mechanism is used.

Refer to /usr/lib/lp/locale/en_US.UTF-8/mp/mp.conf, which is a sample mp.conf file.