diff --git a/en_US.ISO8859-1/articles/fonts/article.sgml b/en_US.ISO8859-1/articles/fonts/article.sgml index a15a3ef658..8d8291fdae 100644 --- a/en_US.ISO8859-1/articles/fonts/article.sgml +++ b/en_US.ISO8859-1/articles/fonts/article.sgml @@ -1,988 +1,988 @@ - + %man; ]>
Fonts and FreeBSD A Tutorial Dave Bodenstab
imdave@synet.net
Wed Aug 7, 1996 This document contains a description of the various font files that may be used with FreeBSD and the syscons driver, X11, Ghostscript and Groff. Cookbook examples are provided for switching the syscons display to 80x60 mode, and for using type 1 fonts with the above application programs.
Introduction There are many sources of fonts available, and one might ask how they might be used with FreeBSD. The answer can be found by carefully searching the documentation for the component that one would like to use. This is very time consuming, so this tutorial is an attempt to provide a shortcut for others who might be interested. Basic terminology There are many different font formats and associated font file suffixes. A few that will be addressed here are: .pfa, .pfb Postscript type 1 fonts. The .pfa is the Ascii form and .pfb the Binary form. .afm The font metrics associated with a type 1 font. .pfm The printer font metrics associated with a type 1 font. .ttf A TrueType font .fot An indirect reference to a TrueType font (not an actual font) .fon, .fnt Bitmapped screen fonts The .fot file is used by Windows as sort of a symbolic link to the actual TrueType font (.ttf) file. The .fon font files are also used by Windows. I know of no way to use this font format with FreeBSD. What font formats can I use? Which font file format is useful depends on the application being used. FreeBSD by itself uses no fonts. Application programs and/or drivers may make use of the font files. Here is a small cross reference of application/driver to the font type suffixes: Driver syscons .fnt Application Ghostscript .pfa, .pfb, .ttf X11 .pfa, .pfb Groff .pfa, .afm Povray .ttf The .fnt suffix is used quite frequently. I suspect that whenever someone wanted to create a specialized font file for their application, more often than not they chose this suffix. Therefore, it is likely that files with this suffix are not all the same format; specifically, the .fnt files used by syscons under FreeBSD may not be the same format as a .fnt file one encounters in the MSDOS/Windows environment. I have not made any attempt at using other .fnt files other than those provided with FreeBSD. Setting a virtual console to 80x60 line mode First, an 8x8 font must be loaded. To do this, /etc/rc.conf should contain the line (change the font name to an appropriate one for your locale): font8x8="iso-8x8" # font 8x8 from /usr/share/syscons/fonts/* (or NO). The command to actually switch the mode is &man.vidcontrol.1;: &prompt.user; vidcontrol VGA_80x60 Various screen orientated programs, such as &man.vi.1;, must be able to determine the current screen dimensions. As this is achieved this through ioctl calls to the console driver (such as &man.syscons.4;) they will correctly determine the new screen dimensions. To make this more seamless, one can embed these commands in the startup scripts so it takes place when the system boots. To do this is add this line to /etc/rc.conf allscreens_flags="VGA_80x60" # Set this vidcontrol mode for all virtual screens References: &man.rc.conf.5;, &man.vidcontrol.1;. Using type 1 fonts with X11 X11 can use either the .pfa or the .pfb format fonts. The X11 fonts are located in various subdirectories under /usr/X11R6/lib/X11/fonts. Each font file is cross referenced to its X11 name by the contents of the fonts.dir file in each directory. There is already a directory named Type1. The most straight forward way to add a new font is to put it into this directory. A better way is to keep all new fonts in a separate directory and use a symbolic link to the additional font. This allows one to more easily keep track of ones fonts without confusing them with the fonts that were originally provided. For example: Create a directory to contain the font files &prompt.user; mkdir -p /usr/local/share/fonts/type1 &prompt.user; cd /usr/local/share/fonts/type1 Place the .pfa, .pfb and .afm files here One might want to keep readme files, and other documentation for the fonts here also &prompt.user; cp /cdrom/fonts/atm/showboat/showboat.pfb . &prompt.user; cp /cdrom/fonts/atm/showboat/showboat.afm . Maintain an index to cross reference the fonts &prompt.user; echo showboat - InfoMagic CICA, Dec 1994, /fonts/atm/showboat >>INDEX Now, to use a new font with X11, one must make the font file available and update the font name files. The X11 font names look like: -bitstream-charter-medium-r-normal-xxx-0-0-0-0-p-0-iso8859-1 | | | | | | | | | | | | \ \ | | | | | \ \ \ \ \ \ \ +----+- character set | | | | \ \ \ \ \ \ \ +- average width | | | | \ \ \ \ \ \ +- spacing | | | \ \ \ \ \ \ +- vertical res. | | | \ \ \ \ \ +- horizontal res. | | | \ \ \ \ +- points | | | \ \ \ +- pixels | | | \ \ \ foundry family weight slant width additional style A new name needs to be created for each new font. If you have some information from the documentation that accompanied the font, then it could serve as the basis for creating the name. If there is no information, then you can get some idea by using &man.strings.1; on the font file. For example: &prompt.user; strings showboat.pfb | more %!FontType1-1.0: Showboat 001.001 %%CreationDate: 1/15/91 5:16:03 PM %%VMusage: 1024 45747 % Generated by Fontographer 3.1 % Showboat 1991 by David Rakowski. Alle Rechte Vorbehalten. FontDirectory/Showboat known{/Showboat findfont dup/UniqueID known{dup /UniqueID get 4962377 eq exch/FontType get 1 eq and}{pop false}ifelse {save true}{false}ifelse}{false}ifelse 12 dict begin /FontInfo 9 dict dup begin /version (001.001) readonly def /FullName (Showboat) readonly def /FamilyName (Showboat) readonly def /Weight (Medium) readonly def /ItalicAngle 0 def /isFixedPitch false def /UnderlinePosition -106 def /UnderlineThickness 16 def /Notice (Showboat 1991 by David Rakowski. Alle Rechte Vorbehalten.) readonly def end readonly def /FontName /Showboat def --stdin-- Using this information, a possible name might be: -type1-Showboat-medium-r-normal-decorative-0-0-0-0-p-0-iso8859-1 The components of our name are: Foundry Lets just name all the new fonts type1. Family The name of the font. Weight Normal, bold, medium, semibold, etc. From the &man.strings.1; output above, it appears that this font has a weight of medium. Slant roman, italic, oblique, etc. Since the ItalicAngle is zero, roman will be used. Width Normal, wide, condensed, extended, etc. Until it can be examined, the assumption will be normal. Additional style Usually omitted, but this will indicate that the font contains decorative capital letters. Spacing proportional or monospaced. Proportional is used since isFixedPitch is false. All of these names are arbitrary, but one should strive to be compatible with the existing conventions. A font is referenced by name with possible wild cards by an X11 program, so the name chosen should make some sense. One might begin by simply using …-normal-r-normal-…-p-… as the name, and then use &man.xfontsel.1; to examine it and adjust the name based on the appearance of the font. So, to complete our example: Make the font accessible to X11 &prompt.user; cd /usr/X11R6/lib/X11/fonts/Type1 &prompt.user; ln -s /usr/local/share/fonts/type1/showboat.pfb . Edit fonts.dir and fonts.scale, adding the line describing the font and incrementing the number of fonts which is found on the first line. &prompt.user; ex fonts.dir :1p 25 :1c 26 . :$a showboat.pfb -type1-showboat-medium-r-normal-decorative-0-0-0-0-p-0-iso8859-1 . :wq fonts.scale seems to be identical to fonts.dir &prompt.user; cp fonts.dir fonts.scale Tell X11 that things have changed &prompt.user; xset fp rehash Examine the new font &prompt.user; xfontsel -pattern -type1-* References: &man.xfontsel.1;, &man.xset.1;, The X Windows System in a Nutshell, O'Reilly & Associates. Using type 1 fonts with Ghostscript Ghostscript references a font via its Fontmap file. This must be modified in a similar way to the X11 fonts.dir file. Ghostscript can use either the .pfa or the .pfb format fonts. Using the font from the previous example, here is how to use it with Ghostscript: Put the font in Ghostscript's font directory &prompt.user; cd /usr/local/share/ghostscript/fonts &prompt.user; ln -s /usr/local/share/fonts/type1/showboat.pfb . Edit Fontmap so Ghostscript knows about the font &prompt.user; cd /usr/local/share/ghostscript/4.01 &prompt.user; ex Fontmap :$a /Showboat (showboat.pfb) ; % From CICA /fonts/atm/showboat . :wq Use Ghostscript to examine the font &prompt.user; gs prfont.ps Aladdin Ghostscript 4.01 (1996-7-10) Copyright (C) 1996 Aladdin Enterprises, Menlo Park, CA. All rights reserved. This software comes with NO WARRANTY: see the file PUBLIC for details. Loading Times-Roman font from /usr/local/share/ghostscript/fonts/tir_____.pfb... /1899520 581354 1300084 13826 0 done. GS>Showboat DoFont Loading Showboat font from /usr/local/share/ghostscript/fonts/showboat.pfb... 1939688 565415 1300084 16901 0 done. >>showpage, press <return> to continue<< >>showpage, press <return> to continue<< >>showpage, press <return> to continue<< GS>quit References: fonts.txt in the Ghostscript 4.01 distribution Using type 1 fonts with Groff Now that the new font can be used by both X11 and Ghostscript, how can one use the new font with groff? First of all, since we are dealing with type 1 postscript fonts, the groff device that is applicable is the ps device. A font file must be created for each font that groff can use. A groff font name is just a file in /usr/share/groff_font/devps. With our example, the font file could be /usr/share/groff_font/devps/SHOWBOAT. The file must be created using tools provided by groff. The first tool is afmtodit. This is not normally installed, so it must be retrieved from the source distribution. I found I had to change the first line of the file, so I did: &prompt.user; cp /usr/src/gnu/usr.bin/groff/afmtodit/afmtodit.pl /tmp &prompt.user; ex /tmp/afmtodit.pl :1c #!/usr/bin/perl -P- . :wq This tool will create the groff font file from the metrics file (.afm suffix.) Continuing with our example: Many .afm files are in Mac format… ^M delimited lines We need to convert them to unix style ^J delimited lines &prompt.user; cd /tmp &prompt.user; cat /usr/local/share/fonts/type1/showboat.afm | tr '\015' '\012' >showboat.afm Now create the groff font file &prompt.user; cd /usr/share/groff_font/devps &prompt.user; /tmp/afmtodit.pl -d DESC -e text.enc /tmp/showboat.afm generate/textmap SHOWBOAT The font can now be referenced with the name SHOWBOAT. If ghostscript is used to drive the printers on the system, then nothing more needs to be done. However, if true postscript printers are used, then the font must be down loaded to the printer in order for the font to be used (unless the printer happens to have the showboat font built in or on an accessible font disk.) The final step is to create a down loadable font. The pfbtops tool is used to create the .pfa format of the font, and the download file is modified to reference the new font. The download file must reference the internal name of the font. This can easily be determined from the groff font file as illustrated: Create the .pfa font file &prompt.user; pfbtops /usr/local/share/fonts/type1/showboat.pfb >showboat.pfa Of course, if the .pfa file is already available, just use a symbolic link to reference it. Get the internal font name &prompt.user; fgrep internalname SHOWBOAT internalname Showboat Tell groff that the font must be down loaded &prompt.user; ex download :$a Showboat showboat.pfa . :wq To test the font: &prompt.user; cd /tmp &prompt.user; cat >example.t <<EOF .sp 5 .ps 16 This is an example of the Showboat font: .br .ps 48 .vs (\n(.s+2)p .sp .ft SHOWBOAT ABCDEFGHI .br JKLMNOPQR .br STUVWXYZ .sp .ps 16 .vs (\n(.s+2)p .fp 5 SHOWBOAT .ft R To use it for the first letter of a paragraph, it will look like: .sp 50p \s(48\f5H\s0\fRere is the first sentence of a paragraph that uses the showboat font as its first letter. Additional vertical space must be used to allow room for the larger letter. EOF &prompt.user; groff -Tps example.t >example.ps To use ghostscript/ghostview &prompt.user; ghostview example.ps To print it &prompt.user; lpr -Ppostscript example.ps References: /usr/src/gnu/usr.bin/groff/afmtodit/afmtodit.man, &man.groff.font.5;, &man.groff.char.7;, &man.pfbtops.1;. Converting TrueType fonts to a groff/postscript format for groff This potentially requires a bit of work, simply because it depends on some utilities that are not installed as part of the base system. They are: ttf2pf TrueType to postscript convertsion utilities. This allows conversion of a TrueType font to an ascii font metric (.afm) file. Currently available at http://sunsite.icm.edu.pl/pub/GUST/contrib/BachoTeX98/ttf2pf. Note: These files are postscript programs and must be downloaded to disk by holding down the Shift key when clicking on the link. Otherwise, your browser may try to launch ghostview to view them. The files of interest are: GS_TTF.PS PF2AFM.PS ttf2pf.ps The funny upper/lower case is due to their being intended also for DOS shells. ttf2pf.ps makes use of the others as upper case, so any renaming must be consistent with this. (Actually, GS_TTF.PS and PFS2AFM.PS are supposedly part of the ghostscript distribution, but it's just as easy to use these as an isolated utility. FreeBSD doesn't seem to include the latter.) You also may want to have these installed to /usr/local/share/groff_font/devps(?). afmtodit Creates font files for use with groff from ascii font metrics file. This usually resides in the directory, /usr/src/contrib/groff/afmtodit, and requires some work to get going. If you're paranoid about working in the /usr/src tree, simply copy the contents of the above directory to a work location. In the work area, you'll need to make the utility. Just type: # make -f Makefile.sub afmtodit You may also need to copy /usr/contrib/groff/devps/generate/textmap to /usr/share/groff_font/devps/generate if it doesn't already exist. Once all these utilities are in place, you're ready to commence: Create the .afm file by typing: % gs -dNODISPLAY -q -- ttf2pf.ps TTF_name PS_font_name AFM_name Where, TTF_name is your TrueType font file, PS_font_name is the file name for the .pfa file, AFM_name is the name you wish for the .afm file. If you do not specify output file names for the .pfa or .afm files, then default names will be generated from the TrueType font file name. This also produces a .pfa file, the ascii postscript font metrics file (.pfb is for the binrary form). This won't be needed, but could (I think) be useful for a fontserver. For example, to convert the 30f9 Barcode font using the default file names, use the following command: % gs -dNODISPLAY -- ttf2pf.ps 3of9.ttf Aladdin Ghostscript 5.10 (1997-11-23) Copyright (C) 1997 Aladdin Enterprises, Menlo Park, CA. All rights reserved. This software comes with NO WARRANTY: see the file PUBLIC for details. Converting 3of9.ttf to 3of9.pfa and 3of9.afm. If you want the converted fonts to be stored in A.pfa and B.afm, then use this command: % gs -dNODISPLAY -- ttf2pf.ps 3of9.ttf A B Aladdin Ghostscript 5.10 (1997-11-23) Copyright (C) 1997 Aladdin Enterprises, Menlo Park, CA. All rights reserved. This software comes with NO WARRANTY: see the file PUBLIC for details. Converting 3of9.ttf to A.pfa and B.afm. Create the groff postscript file: Change directories to /usr/share/groff_font/devps so as to make the following command easier to execute. You'll probably need root priviledges for this. (Or, if you're paranoid about working there, make sure you reference the files DESC, text.enc and generate/textmap as being in this directory.) % afmtodit -d DESC -e text.enc file.afm \ generate/textmap PS_font_name Where, file.afm is the AFM_name created by ttf2pf.ps above, and PS_font_name is the font name used from that command, as well as the name that &man.groff.1; will use for references to this font. For example, assuming you used the first tiff2pf.ps command above, then the 3of9 Barcode font can be created using the command: % afmtodit -d DESC -e text.enc 3of9.afm \ generate/textmap 3of9 Ensure that the resulting PS_font_name file (e.g., 3of9 in the example above) is located in the directory /usr/share/groff_font/devps by copying or moving it there. Note that if ttf2pf.ps assigns a font name using the one it finds in the TrueType font file and you want to use a different name, you must edit the .afm file prior to running afmtodit. This name must also match the one used in the Fontmap file if you wish to pipe &man.groff.1; into &man.gs.1;. Can TrueType fonts be used with other programs? The TrueType font format is used by Windows, Windows 95, and Mac's. It is quite popular and there are a great number of fonts available in this format. Unfortunately, there are few applications that I am aware of that can use this format: Ghostscript and Povray come to mind. Ghostscript's support, according to the documentation, is rudimentary and the results are likely to be inferior to type 1 fonts. Povray version 3 also has the ability to use TrueType fonts, but I rather doubt many people will be creating documents as a series of raytraced pages :-). This rather dismal situation may soon change. The FreeType Project is currently developing a useful set of FreeType tools: The freetype module is included with XFree86 4.x. For more information please see the FreeBSD Handbook or the XFree86 4.0.2 Fonts page. The xfsft font server for X11 can serve TrueType fonts in addition to regular fonts. Though currently in beta, it is said to be quite useable. See Juliusz Chroboczek's page for further information. Porting instructions for FreeBSD can be found at Stephen Montgomery's software page. xfstt is another font server for X11, available under ftp://sunsite.unc.edu/pub/Linux/X11/fonts. A program called ttf2bdf can produce BDF files suitable for use in an X environment from TrueType files. Linux binaries are said to be available from ftp://crl.nmsu.edu/CLR/multiling/General/. For people requiring the use of Asian TrueType fonts, the XTT font server may be worth a look. Information about XTT can be found at URL: http://hawk.ise.chuo-u.ac.jp/student/person/tshiozak/study/freebsd-at-random/x-tt/index-en.html. and others … The FreeType Projects page is a good starting point for information on these and other free TrueType projects. Where can additional fonts be obtained? Many fonts are available on the Internet. They are either entirely free, or are share-ware. In addition, there are many inexpensive CDROMs available that contain many fonts. Some Internet locations (as of August 1996) are: ftp://ftp.winsite.com (Formerly CICA) http://www.simtel.net/simcgi-bin/dosfind.cgi + url="http://www.simtel.net/">http://www.simtel.net/ ftp://ftp.coast.net/ http://af-pc-plloyd.ecel.uwa.edu.au/fonts/index.html http://www.esselte.com/letraset/index.html http://www.inil.com/users/elfring/esf.htm Additional questions What use are the .pfm files? Can one generate the .afm file from a .pfa or .pfb? How to generate the groff character mapping files for postscript fonts with non-standard character names? Can xditview and devX?? devices be setup to access all the new fonts? It would be good to have examples of using TrueType fonts with povray and ghostscript.
diff --git a/en_US.ISO_8859-1/articles/fonts/article.sgml b/en_US.ISO_8859-1/articles/fonts/article.sgml index a15a3ef658..8d8291fdae 100644 --- a/en_US.ISO_8859-1/articles/fonts/article.sgml +++ b/en_US.ISO_8859-1/articles/fonts/article.sgml @@ -1,988 +1,988 @@ - + %man; ]>
Fonts and FreeBSD A Tutorial Dave Bodenstab
imdave@synet.net
Wed Aug 7, 1996 This document contains a description of the various font files that may be used with FreeBSD and the syscons driver, X11, Ghostscript and Groff. Cookbook examples are provided for switching the syscons display to 80x60 mode, and for using type 1 fonts with the above application programs.
Introduction There are many sources of fonts available, and one might ask how they might be used with FreeBSD. The answer can be found by carefully searching the documentation for the component that one would like to use. This is very time consuming, so this tutorial is an attempt to provide a shortcut for others who might be interested. Basic terminology There are many different font formats and associated font file suffixes. A few that will be addressed here are: .pfa, .pfb Postscript type 1 fonts. The .pfa is the Ascii form and .pfb the Binary form. .afm The font metrics associated with a type 1 font. .pfm The printer font metrics associated with a type 1 font. .ttf A TrueType font .fot An indirect reference to a TrueType font (not an actual font) .fon, .fnt Bitmapped screen fonts The .fot file is used by Windows as sort of a symbolic link to the actual TrueType font (.ttf) file. The .fon font files are also used by Windows. I know of no way to use this font format with FreeBSD. What font formats can I use? Which font file format is useful depends on the application being used. FreeBSD by itself uses no fonts. Application programs and/or drivers may make use of the font files. Here is a small cross reference of application/driver to the font type suffixes: Driver syscons .fnt Application Ghostscript .pfa, .pfb, .ttf X11 .pfa, .pfb Groff .pfa, .afm Povray .ttf The .fnt suffix is used quite frequently. I suspect that whenever someone wanted to create a specialized font file for their application, more often than not they chose this suffix. Therefore, it is likely that files with this suffix are not all the same format; specifically, the .fnt files used by syscons under FreeBSD may not be the same format as a .fnt file one encounters in the MSDOS/Windows environment. I have not made any attempt at using other .fnt files other than those provided with FreeBSD. Setting a virtual console to 80x60 line mode First, an 8x8 font must be loaded. To do this, /etc/rc.conf should contain the line (change the font name to an appropriate one for your locale): font8x8="iso-8x8" # font 8x8 from /usr/share/syscons/fonts/* (or NO). The command to actually switch the mode is &man.vidcontrol.1;: &prompt.user; vidcontrol VGA_80x60 Various screen orientated programs, such as &man.vi.1;, must be able to determine the current screen dimensions. As this is achieved this through ioctl calls to the console driver (such as &man.syscons.4;) they will correctly determine the new screen dimensions. To make this more seamless, one can embed these commands in the startup scripts so it takes place when the system boots. To do this is add this line to /etc/rc.conf allscreens_flags="VGA_80x60" # Set this vidcontrol mode for all virtual screens References: &man.rc.conf.5;, &man.vidcontrol.1;. Using type 1 fonts with X11 X11 can use either the .pfa or the .pfb format fonts. The X11 fonts are located in various subdirectories under /usr/X11R6/lib/X11/fonts. Each font file is cross referenced to its X11 name by the contents of the fonts.dir file in each directory. There is already a directory named Type1. The most straight forward way to add a new font is to put it into this directory. A better way is to keep all new fonts in a separate directory and use a symbolic link to the additional font. This allows one to more easily keep track of ones fonts without confusing them with the fonts that were originally provided. For example: Create a directory to contain the font files &prompt.user; mkdir -p /usr/local/share/fonts/type1 &prompt.user; cd /usr/local/share/fonts/type1 Place the .pfa, .pfb and .afm files here One might want to keep readme files, and other documentation for the fonts here also &prompt.user; cp /cdrom/fonts/atm/showboat/showboat.pfb . &prompt.user; cp /cdrom/fonts/atm/showboat/showboat.afm . Maintain an index to cross reference the fonts &prompt.user; echo showboat - InfoMagic CICA, Dec 1994, /fonts/atm/showboat >>INDEX Now, to use a new font with X11, one must make the font file available and update the font name files. The X11 font names look like: -bitstream-charter-medium-r-normal-xxx-0-0-0-0-p-0-iso8859-1 | | | | | | | | | | | | \ \ | | | | | \ \ \ \ \ \ \ +----+- character set | | | | \ \ \ \ \ \ \ +- average width | | | | \ \ \ \ \ \ +- spacing | | | \ \ \ \ \ \ +- vertical res. | | | \ \ \ \ \ +- horizontal res. | | | \ \ \ \ +- points | | | \ \ \ +- pixels | | | \ \ \ foundry family weight slant width additional style A new name needs to be created for each new font. If you have some information from the documentation that accompanied the font, then it could serve as the basis for creating the name. If there is no information, then you can get some idea by using &man.strings.1; on the font file. For example: &prompt.user; strings showboat.pfb | more %!FontType1-1.0: Showboat 001.001 %%CreationDate: 1/15/91 5:16:03 PM %%VMusage: 1024 45747 % Generated by Fontographer 3.1 % Showboat 1991 by David Rakowski. Alle Rechte Vorbehalten. FontDirectory/Showboat known{/Showboat findfont dup/UniqueID known{dup /UniqueID get 4962377 eq exch/FontType get 1 eq and}{pop false}ifelse {save true}{false}ifelse}{false}ifelse 12 dict begin /FontInfo 9 dict dup begin /version (001.001) readonly def /FullName (Showboat) readonly def /FamilyName (Showboat) readonly def /Weight (Medium) readonly def /ItalicAngle 0 def /isFixedPitch false def /UnderlinePosition -106 def /UnderlineThickness 16 def /Notice (Showboat 1991 by David Rakowski. Alle Rechte Vorbehalten.) readonly def end readonly def /FontName /Showboat def --stdin-- Using this information, a possible name might be: -type1-Showboat-medium-r-normal-decorative-0-0-0-0-p-0-iso8859-1 The components of our name are: Foundry Lets just name all the new fonts type1. Family The name of the font. Weight Normal, bold, medium, semibold, etc. From the &man.strings.1; output above, it appears that this font has a weight of medium. Slant roman, italic, oblique, etc. Since the ItalicAngle is zero, roman will be used. Width Normal, wide, condensed, extended, etc. Until it can be examined, the assumption will be normal. Additional style Usually omitted, but this will indicate that the font contains decorative capital letters. Spacing proportional or monospaced. Proportional is used since isFixedPitch is false. All of these names are arbitrary, but one should strive to be compatible with the existing conventions. A font is referenced by name with possible wild cards by an X11 program, so the name chosen should make some sense. One might begin by simply using …-normal-r-normal-…-p-… as the name, and then use &man.xfontsel.1; to examine it and adjust the name based on the appearance of the font. So, to complete our example: Make the font accessible to X11 &prompt.user; cd /usr/X11R6/lib/X11/fonts/Type1 &prompt.user; ln -s /usr/local/share/fonts/type1/showboat.pfb . Edit fonts.dir and fonts.scale, adding the line describing the font and incrementing the number of fonts which is found on the first line. &prompt.user; ex fonts.dir :1p 25 :1c 26 . :$a showboat.pfb -type1-showboat-medium-r-normal-decorative-0-0-0-0-p-0-iso8859-1 . :wq fonts.scale seems to be identical to fonts.dir &prompt.user; cp fonts.dir fonts.scale Tell X11 that things have changed &prompt.user; xset fp rehash Examine the new font &prompt.user; xfontsel -pattern -type1-* References: &man.xfontsel.1;, &man.xset.1;, The X Windows System in a Nutshell, O'Reilly & Associates. Using type 1 fonts with Ghostscript Ghostscript references a font via its Fontmap file. This must be modified in a similar way to the X11 fonts.dir file. Ghostscript can use either the .pfa or the .pfb format fonts. Using the font from the previous example, here is how to use it with Ghostscript: Put the font in Ghostscript's font directory &prompt.user; cd /usr/local/share/ghostscript/fonts &prompt.user; ln -s /usr/local/share/fonts/type1/showboat.pfb . Edit Fontmap so Ghostscript knows about the font &prompt.user; cd /usr/local/share/ghostscript/4.01 &prompt.user; ex Fontmap :$a /Showboat (showboat.pfb) ; % From CICA /fonts/atm/showboat . :wq Use Ghostscript to examine the font &prompt.user; gs prfont.ps Aladdin Ghostscript 4.01 (1996-7-10) Copyright (C) 1996 Aladdin Enterprises, Menlo Park, CA. All rights reserved. This software comes with NO WARRANTY: see the file PUBLIC for details. Loading Times-Roman font from /usr/local/share/ghostscript/fonts/tir_____.pfb... /1899520 581354 1300084 13826 0 done. GS>Showboat DoFont Loading Showboat font from /usr/local/share/ghostscript/fonts/showboat.pfb... 1939688 565415 1300084 16901 0 done. >>showpage, press <return> to continue<< >>showpage, press <return> to continue<< >>showpage, press <return> to continue<< GS>quit References: fonts.txt in the Ghostscript 4.01 distribution Using type 1 fonts with Groff Now that the new font can be used by both X11 and Ghostscript, how can one use the new font with groff? First of all, since we are dealing with type 1 postscript fonts, the groff device that is applicable is the ps device. A font file must be created for each font that groff can use. A groff font name is just a file in /usr/share/groff_font/devps. With our example, the font file could be /usr/share/groff_font/devps/SHOWBOAT. The file must be created using tools provided by groff. The first tool is afmtodit. This is not normally installed, so it must be retrieved from the source distribution. I found I had to change the first line of the file, so I did: &prompt.user; cp /usr/src/gnu/usr.bin/groff/afmtodit/afmtodit.pl /tmp &prompt.user; ex /tmp/afmtodit.pl :1c #!/usr/bin/perl -P- . :wq This tool will create the groff font file from the metrics file (.afm suffix.) Continuing with our example: Many .afm files are in Mac format… ^M delimited lines We need to convert them to unix style ^J delimited lines &prompt.user; cd /tmp &prompt.user; cat /usr/local/share/fonts/type1/showboat.afm | tr '\015' '\012' >showboat.afm Now create the groff font file &prompt.user; cd /usr/share/groff_font/devps &prompt.user; /tmp/afmtodit.pl -d DESC -e text.enc /tmp/showboat.afm generate/textmap SHOWBOAT The font can now be referenced with the name SHOWBOAT. If ghostscript is used to drive the printers on the system, then nothing more needs to be done. However, if true postscript printers are used, then the font must be down loaded to the printer in order for the font to be used (unless the printer happens to have the showboat font built in or on an accessible font disk.) The final step is to create a down loadable font. The pfbtops tool is used to create the .pfa format of the font, and the download file is modified to reference the new font. The download file must reference the internal name of the font. This can easily be determined from the groff font file as illustrated: Create the .pfa font file &prompt.user; pfbtops /usr/local/share/fonts/type1/showboat.pfb >showboat.pfa Of course, if the .pfa file is already available, just use a symbolic link to reference it. Get the internal font name &prompt.user; fgrep internalname SHOWBOAT internalname Showboat Tell groff that the font must be down loaded &prompt.user; ex download :$a Showboat showboat.pfa . :wq To test the font: &prompt.user; cd /tmp &prompt.user; cat >example.t <<EOF .sp 5 .ps 16 This is an example of the Showboat font: .br .ps 48 .vs (\n(.s+2)p .sp .ft SHOWBOAT ABCDEFGHI .br JKLMNOPQR .br STUVWXYZ .sp .ps 16 .vs (\n(.s+2)p .fp 5 SHOWBOAT .ft R To use it for the first letter of a paragraph, it will look like: .sp 50p \s(48\f5H\s0\fRere is the first sentence of a paragraph that uses the showboat font as its first letter. Additional vertical space must be used to allow room for the larger letter. EOF &prompt.user; groff -Tps example.t >example.ps To use ghostscript/ghostview &prompt.user; ghostview example.ps To print it &prompt.user; lpr -Ppostscript example.ps References: /usr/src/gnu/usr.bin/groff/afmtodit/afmtodit.man, &man.groff.font.5;, &man.groff.char.7;, &man.pfbtops.1;. Converting TrueType fonts to a groff/postscript format for groff This potentially requires a bit of work, simply because it depends on some utilities that are not installed as part of the base system. They are: ttf2pf TrueType to postscript convertsion utilities. This allows conversion of a TrueType font to an ascii font metric (.afm) file. Currently available at http://sunsite.icm.edu.pl/pub/GUST/contrib/BachoTeX98/ttf2pf. Note: These files are postscript programs and must be downloaded to disk by holding down the Shift key when clicking on the link. Otherwise, your browser may try to launch ghostview to view them. The files of interest are: GS_TTF.PS PF2AFM.PS ttf2pf.ps The funny upper/lower case is due to their being intended also for DOS shells. ttf2pf.ps makes use of the others as upper case, so any renaming must be consistent with this. (Actually, GS_TTF.PS and PFS2AFM.PS are supposedly part of the ghostscript distribution, but it's just as easy to use these as an isolated utility. FreeBSD doesn't seem to include the latter.) You also may want to have these installed to /usr/local/share/groff_font/devps(?). afmtodit Creates font files for use with groff from ascii font metrics file. This usually resides in the directory, /usr/src/contrib/groff/afmtodit, and requires some work to get going. If you're paranoid about working in the /usr/src tree, simply copy the contents of the above directory to a work location. In the work area, you'll need to make the utility. Just type: # make -f Makefile.sub afmtodit You may also need to copy /usr/contrib/groff/devps/generate/textmap to /usr/share/groff_font/devps/generate if it doesn't already exist. Once all these utilities are in place, you're ready to commence: Create the .afm file by typing: % gs -dNODISPLAY -q -- ttf2pf.ps TTF_name PS_font_name AFM_name Where, TTF_name is your TrueType font file, PS_font_name is the file name for the .pfa file, AFM_name is the name you wish for the .afm file. If you do not specify output file names for the .pfa or .afm files, then default names will be generated from the TrueType font file name. This also produces a .pfa file, the ascii postscript font metrics file (.pfb is for the binrary form). This won't be needed, but could (I think) be useful for a fontserver. For example, to convert the 30f9 Barcode font using the default file names, use the following command: % gs -dNODISPLAY -- ttf2pf.ps 3of9.ttf Aladdin Ghostscript 5.10 (1997-11-23) Copyright (C) 1997 Aladdin Enterprises, Menlo Park, CA. All rights reserved. This software comes with NO WARRANTY: see the file PUBLIC for details. Converting 3of9.ttf to 3of9.pfa and 3of9.afm. If you want the converted fonts to be stored in A.pfa and B.afm, then use this command: % gs -dNODISPLAY -- ttf2pf.ps 3of9.ttf A B Aladdin Ghostscript 5.10 (1997-11-23) Copyright (C) 1997 Aladdin Enterprises, Menlo Park, CA. All rights reserved. This software comes with NO WARRANTY: see the file PUBLIC for details. Converting 3of9.ttf to A.pfa and B.afm. Create the groff postscript file: Change directories to /usr/share/groff_font/devps so as to make the following command easier to execute. You'll probably need root priviledges for this. (Or, if you're paranoid about working there, make sure you reference the files DESC, text.enc and generate/textmap as being in this directory.) % afmtodit -d DESC -e text.enc file.afm \ generate/textmap PS_font_name Where, file.afm is the AFM_name created by ttf2pf.ps above, and PS_font_name is the font name used from that command, as well as the name that &man.groff.1; will use for references to this font. For example, assuming you used the first tiff2pf.ps command above, then the 3of9 Barcode font can be created using the command: % afmtodit -d DESC -e text.enc 3of9.afm \ generate/textmap 3of9 Ensure that the resulting PS_font_name file (e.g., 3of9 in the example above) is located in the directory /usr/share/groff_font/devps by copying or moving it there. Note that if ttf2pf.ps assigns a font name using the one it finds in the TrueType font file and you want to use a different name, you must edit the .afm file prior to running afmtodit. This name must also match the one used in the Fontmap file if you wish to pipe &man.groff.1; into &man.gs.1;. Can TrueType fonts be used with other programs? The TrueType font format is used by Windows, Windows 95, and Mac's. It is quite popular and there are a great number of fonts available in this format. Unfortunately, there are few applications that I am aware of that can use this format: Ghostscript and Povray come to mind. Ghostscript's support, according to the documentation, is rudimentary and the results are likely to be inferior to type 1 fonts. Povray version 3 also has the ability to use TrueType fonts, but I rather doubt many people will be creating documents as a series of raytraced pages :-). This rather dismal situation may soon change. The FreeType Project is currently developing a useful set of FreeType tools: The freetype module is included with XFree86 4.x. For more information please see the FreeBSD Handbook or the XFree86 4.0.2 Fonts page. The xfsft font server for X11 can serve TrueType fonts in addition to regular fonts. Though currently in beta, it is said to be quite useable. See Juliusz Chroboczek's page for further information. Porting instructions for FreeBSD can be found at Stephen Montgomery's software page. xfstt is another font server for X11, available under ftp://sunsite.unc.edu/pub/Linux/X11/fonts. A program called ttf2bdf can produce BDF files suitable for use in an X environment from TrueType files. Linux binaries are said to be available from ftp://crl.nmsu.edu/CLR/multiling/General/. For people requiring the use of Asian TrueType fonts, the XTT font server may be worth a look. Information about XTT can be found at URL: http://hawk.ise.chuo-u.ac.jp/student/person/tshiozak/study/freebsd-at-random/x-tt/index-en.html. and others … The FreeType Projects page is a good starting point for information on these and other free TrueType projects. Where can additional fonts be obtained? Many fonts are available on the Internet. They are either entirely free, or are share-ware. In addition, there are many inexpensive CDROMs available that contain many fonts. Some Internet locations (as of August 1996) are: ftp://ftp.winsite.com (Formerly CICA) http://www.simtel.net/simcgi-bin/dosfind.cgi + url="http://www.simtel.net/">http://www.simtel.net/ ftp://ftp.coast.net/ http://af-pc-plloyd.ecel.uwa.edu.au/fonts/index.html http://www.esselte.com/letraset/index.html http://www.inil.com/users/elfring/esf.htm Additional questions What use are the .pfm files? Can one generate the .afm file from a .pfa or .pfb? How to generate the groff character mapping files for postscript fonts with non-standard character names? Can xditview and devX?? devices be setup to access all the new fonts? It would be good to have examples of using TrueType fonts with povray and ghostscript.
diff --git a/fr_FR.ISO8859-1/articles/fonts/article.sgml b/fr_FR.ISO8859-1/articles/fonts/article.sgml index 146bd45422..6d320e04e8 100755 --- a/fr_FR.ISO8859-1/articles/fonts/article.sgml +++ b/fr_FR.ISO8859-1/articles/fonts/article.sgml @@ -1,775 +1,775 @@ %man; %urls; %abstract; %artheader; %translators; %authors; %mailing-lists; ]>
FreeBSD et les polices de caractères Un guide utilisateur Dave Bodenstab &artheader.copyright; imdave@synet.net Mercredi 7 Aout 1996 Ce document décrit les différents fichiers de polices de caractères qui peuvent être utilisés avec FreeBSD et le pilote syscons, X11, GhostScript et Groff. Des exemples immédiatement applicables sont donnés pour passer l'affichage à la console en mode 80x60 et pour se servir des polices “Type 1” avec les programmes d'application précités. &abstract.license; &abstract.disclaimer; &trans.a.haby; Introduction Il y a de nombreuses sources de polices de caractères disponibles, et l'on peut se demander comment les utiliser avec FreeBSD. La réponse peut être obtenue en détaillant attentivement la documentation du composant voulu. Cela peut prendre beaucoup de temps, ce guide essaie donc de fournir un raccourci pour les autres personnes que cela intéresserait. Terminologie élémentaire Il y a de nombreux formats de polices de caractères avec chacun son propre suffixe de nom de fichier. Quelques uns d'entre eux seront discutés dans ce document: .pfa, .pfb Polices PostScript “Type 1”. .pfa est le format Ascii et .pfb le format Binaire. .afm Le fichier de dimensions d'une police “Type 1”. .pfm Le fichier de dimensions pour l'impression d'une police “Type 1”. .ttf Police “True Type”. .fot Référence indirecte à une police “True Type” (ce n'est pas la police elle-même). .fon, .fnt Police de caractères “bitmap” pour affichage à l'écran. Les fichiers .fot sont employés par Windows un peu de la même façon que des liens symboliques vers le fichiers de police “True Type” (.ttf). Les fichiers .fon sont aussi utilisés par Windows. Je ne connais pas de moyen de se servir de ces fichiers avec FreeBSD. Quels formats de polices de caractères puis-je utiliser? Le format de fichier de police de caractères utile dépend de l'application. FreeBSD lui-même n'utilise pas de police de caractères. Ce sont les programmes d'application et/ou les pilotes qui se servent éventuellement de ces fichiers. Voici un petit tableau associant application/pilote de périphérique et suffixe des fichiers de police de caractères: .fnt .pfa .pfb .ttf .afm Pilote syscons Oui GhostScript Oui Oui Oui X11 Oui Oui Groff Oui Oui Povray Oui Le suffixe .fnt est assez fréquemment utilisé. Je soupçonne que lorsque quelqu'un veut créer un fichier de police de caractères spécialisé pour son application, il choisit la plupart du temps ce suffixe. Il y a donc des chances pour que des fichiers avec ce suffixe n'aient pas tous le même format; en particulier, les fichiers .fnt utilisés par le pilote syscons de FreeBSD n'auront peut-être pas le même format qu'un fichier .fnt utilisé dans l'environnement DOS/Windows. Je n'ai jamais essayé d'utiliser d'autres fichiers .fnt que ceux fournis avec FreeBSD. Configurer une console virtuelle en mode 80x60 lignes Il faut d'abord charger une police de caractères 8x8. Le fichier /etc/sysconfigN.d.T.: /etc/rc.conf dans les versions récentes de FreeBSD. doit donc contenir les lignes: # choose font 8x8 from /usr/share/syscons/fonts/* (or NO for default) font8x8=/usr/share/syscons/fonts/cp437-8x8.fnt La commande pour changer de mode d'affichage est vidcontrol 1: bash$ vidcontrol VGA_80x60 Différents programmes en mode plein-écran, tel vi 1, doivent pouvoir déterminer la taille actuelle de l'écran. Elle peut être configurée avec stty 1: bash$ stty crt rows 60 columns 80 Pour rendre cela moins fastidieux, ces commandes peuvent être introduites dans une procédure exécutée au démarrage du système. Voici une façon de le faire: Modifiez /etc/sysconfig comme expliqué plus haut, Ajoutez les lignes suivantes à /etc/rc.local: for tty in /dev/ttyv? do vidcontrol VGA_80x60 <$tty >/dev/null 2>&1 done Ajoutez les lignes suivantes à /etc/profile: TTYNAME=`basename \`tty\`` if expr "$TTYNAME" : 'ttyv' > /dev/null then stty crt rows 60 columns 80 fi Références: stty 1, vidcontrol 1. X11 et les polices “Type 1” X11 peut employer les formats de police de caractères .pfa et .pfb. Il y a une référence croisée de chaque fichier sur son nom X11 par l'intermédiaire du fichier fonts.dir de chaque répertoire. Il y a déjà un répertoire appelé Type1. La façon la plus immédiate d'ajouter une police de caractères est de la mettre dans ce répertoire. Une meilleure manière de procéder est de mettre toutes les nouvelle polices dans un répertoire distinct et d'utiliser un lien symbolique sur ces nouvelles polices. Il est alors plus facile de distinguer ses propres polices de celles qui sont fournies d'origine. Par exemple: Créer un repertoire pour les fichiers de police de caractères. bash$ mkdir -p /usr/local/share/fonts/type1 bash$ cd /usr/local/share/fonts/type1 Y mettre les fichiers .pfa, .pfb et .afm. On peut aussi vouloir y conserver les fichiers README et autres documentations concernant les polices de caractères. bash$ cp /cdrom/fonts/atm/showboat/showboat.pfb . bash$ cp /cdrom/fonts/atm/showboat/showboat.afm . Tenir à jour un index pour créer les références croisées sur les polices. bash$ echo showboat - InfoMagic CICA, Dec 1994, /fonts/atm/showboat >>INDEX Pour pouvoir maintenant utiliser une nouvelle police de caractères, il faut mettre le fichier à disposition, et mettre à jour le fichier des noms de polices. Les noms de police X11 se présentent comme suit: -bitstream-charter-medium-r-normal-xxx-0-0-0-0-p-0-iso8859-1 | | | | | | | | | | | | \ \ | | | | | \ \ \ \ \ \ \ +----+- jeu de caractères | | | | \ \ \ \ \ \ \ +- largeur moyenne | | | | \ \ \ \ \ \ +- espacement | | | \ \ \ \ \ \ +- résolution verticale | | | \ \ \ \ \ +- résolution horizontale | | | \ \ \ \ +- points | | | \ largeur \ +- pixels | | | \ \ casse famille graisse inclinaison style supplémentaire Il faut créer un nouveau nom pour chaque nouvelle police. Si la documentation qui l'accompagne vous donne quelques informations, elle peut servir de base pour définir ce nom. Si vous n'avez aucune information, vous pouvez utiliser la commande strings 1 sur le fichier de police. Par exemple: bash$ strings showboat.pfb | more %!FontType1-1.0: Showboat 001.001 %%CreationDate: 1/15/91 5:16:03 PM %%VMusage: 1024 45747 % Generated by Fontographer 3.1 % Showboat 1991 by David Rakowski. Alle Rechte Vorbehalten. FontDirectory/Showboat known{/Showboat findfont dup/UniqueID known{dup /UniqueID get 4962377 eq exch/FontType get 1 eq and}{pop false}ifelse {save true}{false}ifelse}{false}ifelse 12 dict begin /FontInfo 9 dict dup begin /version (001.001) readonly def /FullName (Showboat) readonly def /FamilyName (Showboat) readonly def /Weight (Medium) readonly def /ItalicAngle 0 def /isFixedPitch false def /UnderlinePosition -106 def /UnderlineThickness 16 def /Notice (Showboat 1991 by David Rakowski. Alle Rechte Vorbehalten.) readonly def end readonly def /FontName /Showboat def --stdin-- A partir de ces informations, le nom pourrait être: -type1-Showboat-medium-r-normal-decorative-0-0-0-0-p-0-iso8859-1 Les composantes de ce nom sont: Casse Appelons simplement toutes nos nouvelles polices type1. Famille Le nom de la police. Graisse Normal, gras, médium, semi-gras, etc. D'après les résultats de strings 1 ci-dessus, la police a une graisse médium. Inclinaison roman, italique ou oblique. Comme ItaliqueAngle vaut 0, nous utiliserons roman. Largeur Normale, large, condensée, étendue, etc. Jusqu'à ce que nous la déterminions à l'usage, nous supposerons qu'elle est normale. Style supplémentaire Habituellement non renseigné, mais nous nous en servons pour indiquer que la police contient des majuscules décoratives. Espacement Proportionnel ou fixe. Comme isFixedPitch est faux, nous utilisons Proportionnel. Tous ces noms sont arbitraires, mais il faut essayer de rester compatible avec les conventions existantes. Une police est connue d'une application X11 sous un nom qui peut éventuellement comporter des caractères de substitution, il faut donc choisir un nom significatif. On peut commencer en utilisant simplement: ...-normal-r-normal-...-p-... comme nom, puis se servir de xfontsel 1 pour visualiser la police et affiner son nom en fonction de ce à quoi elle ressemble. Donc, pour compléter notre exemple: Rendre la police accessible à X11 bash$ cd /usr/X11R6/lib/X11/fonts/Type1 bash$ ln -s /usr/local/share/fonts/type1/showboat.pfb . Editer fonts.scale et fonts.dir pour y ajouter une ligne décrivant la nouvelle police et incrémenter le nombre de polices qui est défini en première ligne bash$ ex fonts.dir :1p 25 :1c 26 . :$a showboat.pfb -type1-showboat-medium-r-normal-decorative-0-0-0-0-p-0-iso8859-1 . :wq fonts.scale et fonts.dir sont apparemment identiques bash$ cp fonts.dir fonts.scale Informer X11 des modifications bash$ xset fp rehash Visualiser la nouvelle police bash$ xfontsel -pattern -type1-* Références: xfontsel 1, xset 1, The X Window System in a Nutshell, O'Reilly & Associates. Utiliser les polices “Type 1” avec GhostScript GhostScript référence les polices via son fichier Fontmap. Il doit donc être modifié de la même façon que le fichier X11 fonts.dir. GhostScript peut utiliser des fichiers de police de caractères aux formats .pfa ou .pfb. Voici comment nous utiliserions la police de l'exemple précédent avec GhostScript: Mettre la police dans le répertoire des polices de GhostScript bash$ cd /usr/local/share/ghostscript/fonts bash$ ln -s /usr/local/share/fonts/type1/showboat.pfb . Editer le fichier Fontmap pour que GhostScript ait connaissance de la nouvelle police bash$ cd /usr/local/share/ghostscript/4.01 bash$ ex Fontmap :$a /Showboat (showboat.pfb) ; % From CICA /fonts/atm/showboat :wq Utiliser GhostScript pour visualiser la police bash$ gs prfont.ps Aladdin Ghostscript 4.01 (1996-7-10) Copyright (C) 1996 Aladdin Enterprises, Menlo Park, CA. All rights reserved. This software comes with NO WARRANTY: see the file PUBLIC for details. Loading Times-Roman font from /usr/local/share/ghostscript/fonts/tir_____.pfb... /1899520 581354 1300084 13826 0 done. GS> Showboat DoFont Loading Showboat font from /usr/local/share/ghostscript/fonts/showboat.pfb... 1939688 565415 1300084 16901 0 done. >>showpage, press <return> to continue<< >>showpage, press <return> to continue<< >>showpage, press <return> to continue<< GS> quit Références: fonts.txt de la distribution de GhostScript 4.01. Utiliser les polices “Type 1” avec Groff Maintenant que nous pouvons utiliser la nouvelle police avec X11 et GhostScript, comment faire pour s'en servir aussi avec groff? Tout d'abord, comme nous nous occupons de polices PostScript “Type 1”, le périphérique groff à utiliser est ps. Il faut créer un fichier de police pour chaque police utilisée par groff. Le nom d'une police groff se résume à un fichier dans le répertoire /usr/share/groff_font/devps. Dans notre exemple, ce pourrait être /usr/share/groff_font/devps/SHOWBOAT. Il faut créer ce fichier avec les outils fournis par groff. Le premier outil est afmtodit. Il n'est pas normalement installé et doit donc être extrait de la distribution sous forme de sources. Je me suis aperçu qu'il fallait modifier la première ligne du fichier, voici donc ce que j'ai fait: bash$ cp /usr/src/gnu/usr.bin/groff/afmtodit/afmtodit.pl /tmp bash$ ex /tmp/afmtodit.pl :1c #!/usr/bin/perl -P- . :wq Cet outil crée le fichier de police groff à partir du fichier de dimensions de la police (suffixe .afm). Pour continuer avec notre exemple: De nombreux fichiers .afm sont au format Mac... avec des lignes terminées par des ^M Il faut les convertir au style Unix avec des lignes terminées par des ^J bash$ cd /tmp bash$ cat /usr/local/share/fonts/type1/showboat.afm | tr '\015' '\012' >showboat.afm Créons maintenant le fichier de police groff bash$ cd /usr/share/groff_font/devps bash$ /tmp/afmtodit.pl -d DESC -e text.enc /tmp/showboat.afm generate/textmap SHOWBOAT La police peut maintenant être référencée par le nom SHOWBOAT. Si l'on utilise GhostScript pour piloter les imprimantes du système, il n'y a rien d'autre à faire. Si, par contre, l'on utilise de vraies imprimantes PostScript, il faut alors charger la police sur l'imprimante pour pouvoir l'utiliser (à moins que l'imprimante ne dispose de la police “showboat” en interne ou sur une disquette de polices accessible). La dernière étape consiste à créer la police chargeable. L'outil pfbtops est utilisé pour créer le format .pfa de la police et le fichier download est modifié pour faire référence à la nouvelle police. Le fichier download doit indiquer le nom interne de la police. Ce nom peut être facilement connu à l'aide du fichier de police groff, comme le montre l'exemple: Créer le fichier de police .pfa bash$ fgrep internalname SHOWBOAT internalname Showboat Dire à groff qu'il faut charger la police bash$ ex download :$a Showboat showboat.pfa . :wq Pour tester la police: bash$ cd /tmp bash$ cat >exemple.t <<EOF .sp 5 .ps 15 C'est un exemple de police Showboat: .br .ps 48 .vs (\n(.s+2)p .sp .ft SHOWBOAT ABCDEFGHI .br JKLMNOPQR .br STUVWXYZ .sp .ps 16 .vs (\n(.s+2)p .fp 5 SHOWBOAT .ft 5 Utilisée comme première lettre d'un paragraphe. Cela ressemblera à: .sp50p \s(48\f5V\s0\fRoici la première phrase d'un paragraphe qui utilise la police showboat pour sa première lettre. Il faut augmenter l'espacement vertical pour laisser de la place pour la première lettre. EOF bash$ groff -Tps exemple.t >exemple.ps Pour utiliser GhostScript/GhostView bash$ ghostview exemple.ps Pour l'imprimer bash$ lpr -Ppostscript exemple.ps Références: /usr/src/gnu/usr.bin/groff/afmtodit/afmtodit.man, groff_font 5, groff_char 5, pfbtops 1. Peut-on utiliser des polices “True Type”? Le format de police “True Type” est utilisée par Windows, Windows 95 et le Macintosh. Il est assez répandu et il y a de nombreuses polices de ce format disponibles. Malheureusement, je connais peu d'applications qui puissent utiliser ce format: GhostScript et Povray viennent à l'esprit. Le support par GhostScript est, d'après la documentation, assez rudimentaire et il y a des chances que le résultat soit moins bon qu'avec les polices “Type 1”. Povray version 3 est aussi capable d'utiliser des des polices “True Type”, mais je doute que beaucoup de personnes créent des documents sous forme de pages générées par lancer de rayon :-). Il est difficile d'utiliser une police “True Type” avec groff parce que groff a besoin d'un fichier de description de la police, et je ne connais pas d'outil pour déterminer les dimensions d'une police “True Type”. De plus, il faudrait charger la police sur les imprimantes PostScript avec le format approprié et, de nouveau, groff ne peut gérer de cette façon les polices “True Type”. Cette situation plutôt désolante changera peut-être bientôt. Le Projet FreeType développe actuellement un ensemble d'utilitaire FreeType: Le serveur de polices xfsft pour X11 peut gérer les polices “TrueType” en plus des polices ordinaires. Bien que ce soit encore une version béta, elle a la réputation d'être à peu près utilisable. Voyez la page de Juliusz Chroboczek pour plus d'informations. Il y a des instructions de portage sous FreeBSD sur la page logicielle de Stephen Montgomery. xfstt est un autre serveur X11, disponible sur ftp://sunsite.unc.edu/pub/Linux/X11/fonts. Il y a un programme appelé ttf2bdf qui peut créer des fichiers BDF utilisables en environnement X à partir de fichiers “TrueType”. Les binaires pour Linux sont censés être disponibles sur ftp://crl.nmsu.edu/CLR/multiling/General/. Pour les personnes qui ont besoin de polices “True Type” asiatiques, il peut valoir la peine de jetter un coup d'oeil au serveur de polices XTT. Il y a des informations sur XTT à l'adresse: http://hawk.ise.chuo-u.ac.jp/student/person/tshiozak/study/freebsd-at-random/x-tt/index-en.html. et d'autres ... Où peut-on trouver des polices supplémentaires? Il y a de nombreuses polices disponibles sur l'Internet. Elles sont soit complètement gratuites ou en “partagiciel”. Il y a aussi de nombreux CD-ROMs peux onéreux qui contiennent beaucoup de polices. Voici quelques sites Internet (au mois d'Août 1996): ftp://ftp.winsite.com (auparavant CICA), - http://www.simtel.net/simcgi-bin/dosfind.cgi, + http://www.simtel.net/, ftp://ftp.coast.net/, http://af-pc-plloyd.ecel.uwa.edu.au/fonts/index.html, http://www.esselte.com/letraset/index.html, http://www.inil.com/users/elfring/esf.htm. D'autres questions Que sont que les fichiers .pfm? Peut-on générer des fichiers .afm à partir de fichiers .pfa ou .pfb? Comment générer des fichiers de correspondance de caractères pour groff pour les polices PostScript dont les caractères ont des noms qui ne sont pas standard? Les périphériques xditview et devX?? peuvent-ils être configurés pour accéder aux nouvelles polices? Il serait bien d'avoir des exemples d'utilisation de polices “True Type” avec GhostScript et Povray.
diff --git a/fr_FR.ISO_8859-1/articles/fonts/article.sgml b/fr_FR.ISO_8859-1/articles/fonts/article.sgml index 146bd45422..6d320e04e8 100755 --- a/fr_FR.ISO_8859-1/articles/fonts/article.sgml +++ b/fr_FR.ISO_8859-1/articles/fonts/article.sgml @@ -1,775 +1,775 @@ %man; %urls; %abstract; %artheader; %translators; %authors; %mailing-lists; ]>
FreeBSD et les polices de caractères Un guide utilisateur Dave Bodenstab &artheader.copyright; imdave@synet.net Mercredi 7 Aout 1996 Ce document décrit les différents fichiers de polices de caractères qui peuvent être utilisés avec FreeBSD et le pilote syscons, X11, GhostScript et Groff. Des exemples immédiatement applicables sont donnés pour passer l'affichage à la console en mode 80x60 et pour se servir des polices “Type 1” avec les programmes d'application précités. &abstract.license; &abstract.disclaimer; &trans.a.haby; Introduction Il y a de nombreuses sources de polices de caractères disponibles, et l'on peut se demander comment les utiliser avec FreeBSD. La réponse peut être obtenue en détaillant attentivement la documentation du composant voulu. Cela peut prendre beaucoup de temps, ce guide essaie donc de fournir un raccourci pour les autres personnes que cela intéresserait. Terminologie élémentaire Il y a de nombreux formats de polices de caractères avec chacun son propre suffixe de nom de fichier. Quelques uns d'entre eux seront discutés dans ce document: .pfa, .pfb Polices PostScript “Type 1”. .pfa est le format Ascii et .pfb le format Binaire. .afm Le fichier de dimensions d'une police “Type 1”. .pfm Le fichier de dimensions pour l'impression d'une police “Type 1”. .ttf Police “True Type”. .fot Référence indirecte à une police “True Type” (ce n'est pas la police elle-même). .fon, .fnt Police de caractères “bitmap” pour affichage à l'écran. Les fichiers .fot sont employés par Windows un peu de la même façon que des liens symboliques vers le fichiers de police “True Type” (.ttf). Les fichiers .fon sont aussi utilisés par Windows. Je ne connais pas de moyen de se servir de ces fichiers avec FreeBSD. Quels formats de polices de caractères puis-je utiliser? Le format de fichier de police de caractères utile dépend de l'application. FreeBSD lui-même n'utilise pas de police de caractères. Ce sont les programmes d'application et/ou les pilotes qui se servent éventuellement de ces fichiers. Voici un petit tableau associant application/pilote de périphérique et suffixe des fichiers de police de caractères: .fnt .pfa .pfb .ttf .afm Pilote syscons Oui GhostScript Oui Oui Oui X11 Oui Oui Groff Oui Oui Povray Oui Le suffixe .fnt est assez fréquemment utilisé. Je soupçonne que lorsque quelqu'un veut créer un fichier de police de caractères spécialisé pour son application, il choisit la plupart du temps ce suffixe. Il y a donc des chances pour que des fichiers avec ce suffixe n'aient pas tous le même format; en particulier, les fichiers .fnt utilisés par le pilote syscons de FreeBSD n'auront peut-être pas le même format qu'un fichier .fnt utilisé dans l'environnement DOS/Windows. Je n'ai jamais essayé d'utiliser d'autres fichiers .fnt que ceux fournis avec FreeBSD. Configurer une console virtuelle en mode 80x60 lignes Il faut d'abord charger une police de caractères 8x8. Le fichier /etc/sysconfigN.d.T.: /etc/rc.conf dans les versions récentes de FreeBSD. doit donc contenir les lignes: # choose font 8x8 from /usr/share/syscons/fonts/* (or NO for default) font8x8=/usr/share/syscons/fonts/cp437-8x8.fnt La commande pour changer de mode d'affichage est vidcontrol 1: bash$ vidcontrol VGA_80x60 Différents programmes en mode plein-écran, tel vi 1, doivent pouvoir déterminer la taille actuelle de l'écran. Elle peut être configurée avec stty 1: bash$ stty crt rows 60 columns 80 Pour rendre cela moins fastidieux, ces commandes peuvent être introduites dans une procédure exécutée au démarrage du système. Voici une façon de le faire: Modifiez /etc/sysconfig comme expliqué plus haut, Ajoutez les lignes suivantes à /etc/rc.local: for tty in /dev/ttyv? do vidcontrol VGA_80x60 <$tty >/dev/null 2>&1 done Ajoutez les lignes suivantes à /etc/profile: TTYNAME=`basename \`tty\`` if expr "$TTYNAME" : 'ttyv' > /dev/null then stty crt rows 60 columns 80 fi Références: stty 1, vidcontrol 1. X11 et les polices “Type 1” X11 peut employer les formats de police de caractères .pfa et .pfb. Il y a une référence croisée de chaque fichier sur son nom X11 par l'intermédiaire du fichier fonts.dir de chaque répertoire. Il y a déjà un répertoire appelé Type1. La façon la plus immédiate d'ajouter une police de caractères est de la mettre dans ce répertoire. Une meilleure manière de procéder est de mettre toutes les nouvelle polices dans un répertoire distinct et d'utiliser un lien symbolique sur ces nouvelles polices. Il est alors plus facile de distinguer ses propres polices de celles qui sont fournies d'origine. Par exemple: Créer un repertoire pour les fichiers de police de caractères. bash$ mkdir -p /usr/local/share/fonts/type1 bash$ cd /usr/local/share/fonts/type1 Y mettre les fichiers .pfa, .pfb et .afm. On peut aussi vouloir y conserver les fichiers README et autres documentations concernant les polices de caractères. bash$ cp /cdrom/fonts/atm/showboat/showboat.pfb . bash$ cp /cdrom/fonts/atm/showboat/showboat.afm . Tenir à jour un index pour créer les références croisées sur les polices. bash$ echo showboat - InfoMagic CICA, Dec 1994, /fonts/atm/showboat >>INDEX Pour pouvoir maintenant utiliser une nouvelle police de caractères, il faut mettre le fichier à disposition, et mettre à jour le fichier des noms de polices. Les noms de police X11 se présentent comme suit: -bitstream-charter-medium-r-normal-xxx-0-0-0-0-p-0-iso8859-1 | | | | | | | | | | | | \ \ | | | | | \ \ \ \ \ \ \ +----+- jeu de caractères | | | | \ \ \ \ \ \ \ +- largeur moyenne | | | | \ \ \ \ \ \ +- espacement | | | \ \ \ \ \ \ +- résolution verticale | | | \ \ \ \ \ +- résolution horizontale | | | \ \ \ \ +- points | | | \ largeur \ +- pixels | | | \ \ casse famille graisse inclinaison style supplémentaire Il faut créer un nouveau nom pour chaque nouvelle police. Si la documentation qui l'accompagne vous donne quelques informations, elle peut servir de base pour définir ce nom. Si vous n'avez aucune information, vous pouvez utiliser la commande strings 1 sur le fichier de police. Par exemple: bash$ strings showboat.pfb | more %!FontType1-1.0: Showboat 001.001 %%CreationDate: 1/15/91 5:16:03 PM %%VMusage: 1024 45747 % Generated by Fontographer 3.1 % Showboat 1991 by David Rakowski. Alle Rechte Vorbehalten. FontDirectory/Showboat known{/Showboat findfont dup/UniqueID known{dup /UniqueID get 4962377 eq exch/FontType get 1 eq and}{pop false}ifelse {save true}{false}ifelse}{false}ifelse 12 dict begin /FontInfo 9 dict dup begin /version (001.001) readonly def /FullName (Showboat) readonly def /FamilyName (Showboat) readonly def /Weight (Medium) readonly def /ItalicAngle 0 def /isFixedPitch false def /UnderlinePosition -106 def /UnderlineThickness 16 def /Notice (Showboat 1991 by David Rakowski. Alle Rechte Vorbehalten.) readonly def end readonly def /FontName /Showboat def --stdin-- A partir de ces informations, le nom pourrait être: -type1-Showboat-medium-r-normal-decorative-0-0-0-0-p-0-iso8859-1 Les composantes de ce nom sont: Casse Appelons simplement toutes nos nouvelles polices type1. Famille Le nom de la police. Graisse Normal, gras, médium, semi-gras, etc. D'après les résultats de strings 1 ci-dessus, la police a une graisse médium. Inclinaison roman, italique ou oblique. Comme ItaliqueAngle vaut 0, nous utiliserons roman. Largeur Normale, large, condensée, étendue, etc. Jusqu'à ce que nous la déterminions à l'usage, nous supposerons qu'elle est normale. Style supplémentaire Habituellement non renseigné, mais nous nous en servons pour indiquer que la police contient des majuscules décoratives. Espacement Proportionnel ou fixe. Comme isFixedPitch est faux, nous utilisons Proportionnel. Tous ces noms sont arbitraires, mais il faut essayer de rester compatible avec les conventions existantes. Une police est connue d'une application X11 sous un nom qui peut éventuellement comporter des caractères de substitution, il faut donc choisir un nom significatif. On peut commencer en utilisant simplement: ...-normal-r-normal-...-p-... comme nom, puis se servir de xfontsel 1 pour visualiser la police et affiner son nom en fonction de ce à quoi elle ressemble. Donc, pour compléter notre exemple: Rendre la police accessible à X11 bash$ cd /usr/X11R6/lib/X11/fonts/Type1 bash$ ln -s /usr/local/share/fonts/type1/showboat.pfb . Editer fonts.scale et fonts.dir pour y ajouter une ligne décrivant la nouvelle police et incrémenter le nombre de polices qui est défini en première ligne bash$ ex fonts.dir :1p 25 :1c 26 . :$a showboat.pfb -type1-showboat-medium-r-normal-decorative-0-0-0-0-p-0-iso8859-1 . :wq fonts.scale et fonts.dir sont apparemment identiques bash$ cp fonts.dir fonts.scale Informer X11 des modifications bash$ xset fp rehash Visualiser la nouvelle police bash$ xfontsel -pattern -type1-* Références: xfontsel 1, xset 1, The X Window System in a Nutshell, O'Reilly & Associates. Utiliser les polices “Type 1” avec GhostScript GhostScript référence les polices via son fichier Fontmap. Il doit donc être modifié de la même façon que le fichier X11 fonts.dir. GhostScript peut utiliser des fichiers de police de caractères aux formats .pfa ou .pfb. Voici comment nous utiliserions la police de l'exemple précédent avec GhostScript: Mettre la police dans le répertoire des polices de GhostScript bash$ cd /usr/local/share/ghostscript/fonts bash$ ln -s /usr/local/share/fonts/type1/showboat.pfb . Editer le fichier Fontmap pour que GhostScript ait connaissance de la nouvelle police bash$ cd /usr/local/share/ghostscript/4.01 bash$ ex Fontmap :$a /Showboat (showboat.pfb) ; % From CICA /fonts/atm/showboat :wq Utiliser GhostScript pour visualiser la police bash$ gs prfont.ps Aladdin Ghostscript 4.01 (1996-7-10) Copyright (C) 1996 Aladdin Enterprises, Menlo Park, CA. All rights reserved. This software comes with NO WARRANTY: see the file PUBLIC for details. Loading Times-Roman font from /usr/local/share/ghostscript/fonts/tir_____.pfb... /1899520 581354 1300084 13826 0 done. GS> Showboat DoFont Loading Showboat font from /usr/local/share/ghostscript/fonts/showboat.pfb... 1939688 565415 1300084 16901 0 done. >>showpage, press <return> to continue<< >>showpage, press <return> to continue<< >>showpage, press <return> to continue<< GS> quit Références: fonts.txt de la distribution de GhostScript 4.01. Utiliser les polices “Type 1” avec Groff Maintenant que nous pouvons utiliser la nouvelle police avec X11 et GhostScript, comment faire pour s'en servir aussi avec groff? Tout d'abord, comme nous nous occupons de polices PostScript “Type 1”, le périphérique groff à utiliser est ps. Il faut créer un fichier de police pour chaque police utilisée par groff. Le nom d'une police groff se résume à un fichier dans le répertoire /usr/share/groff_font/devps. Dans notre exemple, ce pourrait être /usr/share/groff_font/devps/SHOWBOAT. Il faut créer ce fichier avec les outils fournis par groff. Le premier outil est afmtodit. Il n'est pas normalement installé et doit donc être extrait de la distribution sous forme de sources. Je me suis aperçu qu'il fallait modifier la première ligne du fichier, voici donc ce que j'ai fait: bash$ cp /usr/src/gnu/usr.bin/groff/afmtodit/afmtodit.pl /tmp bash$ ex /tmp/afmtodit.pl :1c #!/usr/bin/perl -P- . :wq Cet outil crée le fichier de police groff à partir du fichier de dimensions de la police (suffixe .afm). Pour continuer avec notre exemple: De nombreux fichiers .afm sont au format Mac... avec des lignes terminées par des ^M Il faut les convertir au style Unix avec des lignes terminées par des ^J bash$ cd /tmp bash$ cat /usr/local/share/fonts/type1/showboat.afm | tr '\015' '\012' >showboat.afm Créons maintenant le fichier de police groff bash$ cd /usr/share/groff_font/devps bash$ /tmp/afmtodit.pl -d DESC -e text.enc /tmp/showboat.afm generate/textmap SHOWBOAT La police peut maintenant être référencée par le nom SHOWBOAT. Si l'on utilise GhostScript pour piloter les imprimantes du système, il n'y a rien d'autre à faire. Si, par contre, l'on utilise de vraies imprimantes PostScript, il faut alors charger la police sur l'imprimante pour pouvoir l'utiliser (à moins que l'imprimante ne dispose de la police “showboat” en interne ou sur une disquette de polices accessible). La dernière étape consiste à créer la police chargeable. L'outil pfbtops est utilisé pour créer le format .pfa de la police et le fichier download est modifié pour faire référence à la nouvelle police. Le fichier download doit indiquer le nom interne de la police. Ce nom peut être facilement connu à l'aide du fichier de police groff, comme le montre l'exemple: Créer le fichier de police .pfa bash$ fgrep internalname SHOWBOAT internalname Showboat Dire à groff qu'il faut charger la police bash$ ex download :$a Showboat showboat.pfa . :wq Pour tester la police: bash$ cd /tmp bash$ cat >exemple.t <<EOF .sp 5 .ps 15 C'est un exemple de police Showboat: .br .ps 48 .vs (\n(.s+2)p .sp .ft SHOWBOAT ABCDEFGHI .br JKLMNOPQR .br STUVWXYZ .sp .ps 16 .vs (\n(.s+2)p .fp 5 SHOWBOAT .ft 5 Utilisée comme première lettre d'un paragraphe. Cela ressemblera à: .sp50p \s(48\f5V\s0\fRoici la première phrase d'un paragraphe qui utilise la police showboat pour sa première lettre. Il faut augmenter l'espacement vertical pour laisser de la place pour la première lettre. EOF bash$ groff -Tps exemple.t >exemple.ps Pour utiliser GhostScript/GhostView bash$ ghostview exemple.ps Pour l'imprimer bash$ lpr -Ppostscript exemple.ps Références: /usr/src/gnu/usr.bin/groff/afmtodit/afmtodit.man, groff_font 5, groff_char 5, pfbtops 1. Peut-on utiliser des polices “True Type”? Le format de police “True Type” est utilisée par Windows, Windows 95 et le Macintosh. Il est assez répandu et il y a de nombreuses polices de ce format disponibles. Malheureusement, je connais peu d'applications qui puissent utiliser ce format: GhostScript et Povray viennent à l'esprit. Le support par GhostScript est, d'après la documentation, assez rudimentaire et il y a des chances que le résultat soit moins bon qu'avec les polices “Type 1”. Povray version 3 est aussi capable d'utiliser des des polices “True Type”, mais je doute que beaucoup de personnes créent des documents sous forme de pages générées par lancer de rayon :-). Il est difficile d'utiliser une police “True Type” avec groff parce que groff a besoin d'un fichier de description de la police, et je ne connais pas d'outil pour déterminer les dimensions d'une police “True Type”. De plus, il faudrait charger la police sur les imprimantes PostScript avec le format approprié et, de nouveau, groff ne peut gérer de cette façon les polices “True Type”. Cette situation plutôt désolante changera peut-être bientôt. Le Projet FreeType développe actuellement un ensemble d'utilitaire FreeType: Le serveur de polices xfsft pour X11 peut gérer les polices “TrueType” en plus des polices ordinaires. Bien que ce soit encore une version béta, elle a la réputation d'être à peu près utilisable. Voyez la page de Juliusz Chroboczek pour plus d'informations. Il y a des instructions de portage sous FreeBSD sur la page logicielle de Stephen Montgomery. xfstt est un autre serveur X11, disponible sur ftp://sunsite.unc.edu/pub/Linux/X11/fonts. Il y a un programme appelé ttf2bdf qui peut créer des fichiers BDF utilisables en environnement X à partir de fichiers “TrueType”. Les binaires pour Linux sont censés être disponibles sur ftp://crl.nmsu.edu/CLR/multiling/General/. Pour les personnes qui ont besoin de polices “True Type” asiatiques, il peut valoir la peine de jetter un coup d'oeil au serveur de polices XTT. Il y a des informations sur XTT à l'adresse: http://hawk.ise.chuo-u.ac.jp/student/person/tshiozak/study/freebsd-at-random/x-tt/index-en.html. et d'autres ... Où peut-on trouver des polices supplémentaires? Il y a de nombreuses polices disponibles sur l'Internet. Elles sont soit complètement gratuites ou en “partagiciel”. Il y a aussi de nombreux CD-ROMs peux onéreux qui contiennent beaucoup de polices. Voici quelques sites Internet (au mois d'Août 1996): ftp://ftp.winsite.com (auparavant CICA), - http://www.simtel.net/simcgi-bin/dosfind.cgi, + http://www.simtel.net/, ftp://ftp.coast.net/, http://af-pc-plloyd.ecel.uwa.edu.au/fonts/index.html, http://www.esselte.com/letraset/index.html, http://www.inil.com/users/elfring/esf.htm. D'autres questions Que sont que les fichiers .pfm? Peut-on générer des fichiers .afm à partir de fichiers .pfa ou .pfb? Comment générer des fichiers de correspondance de caractères pour groff pour les polices PostScript dont les caractères ont des noms qui ne sont pas standard? Les périphériques xditview et devX?? peuvent-ils être configurés pour accéder aux nouvelles polices? Il serait bien d'avoir des exemples d'utilisation de polices “True Type” avec GhostScript et Povray.