home *** CD-ROM | disk | FTP | other *** search
/ ftp.pasteur.org/FAQ/ / ftp-pasteur-org-FAQ.zip / FAQ / fonts-faq / part9 < prev   
Encoding:
Internet Message Format  |  1996-08-15  |  22.2 KB

  1. Path: senator-bedfellow.mit.edu!bloom-beacon.mit.edu!news.mathworks.com!zombie.ncsc.mil!newsgate.duke.edu!news-feed-1.peachnet.edu!paperboy.wellfleet.com!news3.near.net!amber.ora.com!not-for-mail
  2. From: norm@ora.com (Norman Walsh)
  3. Newsgroups: comp.fonts,comp.answers,news.answers
  4. Subject: comp.fonts FAQ: OS/2 Info
  5. Supersedes: <font-faq-9_817479312@ora.com>
  6. Followup-To: poster
  7. Date: 14 Aug 1996 10:34:55 -0400
  8. Organization: O'Reilly and Associates, Inc.
  9. Lines: 397
  10. Sender: norm@ruby.ora.com
  11. Approved: news-answers-request@MIT.Edu
  12. Distribution: world
  13. Expires: 27 Sep 1996 14:34:08 GMT
  14. Message-ID: <font-faq-9_840033248@ora.com>
  15. References: <font-faq-1_840033248@ora.com>
  16. Reply-To: norm@ora.com (Norman Walsh)
  17. NNTP-Posting-Host: ruby.ora.com
  18. Summary: This posting answers frequently asked questions about fonts.
  19.          It addresses both general font questions and questions that
  20.          are specific to a particular platform.
  21. X-Web-Homepage: http://www.ora.com/homepages/comp.fonts/
  22. Xref: senator-bedfellow.mit.edu comp.fonts:48305 comp.answers:20519 news.answers:79240
  23.  
  24. Archive-name: fonts-faq/part9
  25. Version: 2.1.5
  26.  
  27. Subject: 4. OS/2 Information
  28.   
  29.   [ed: Except as otherwise noted, the entire OS/2 section of the
  30.   comp.fonts FAQ List is derived from the "Draft OS/2 Font FAQ" posted by
  31.   David J. Birnbaum.]
  32.   
  33.   This section if the FAQ is Copyright (C) 1993 by David J. Birnbaum.
  34.   All Rights Reserved.  Reproduced here by permission.
  35.   
  36.   [ed: Since this section of the FAQ is wholly derived from David's
  37.   document, some sections contain information repeated elsewhere in the
  38.   comp.fonts FAQ.]
  39.   
  40.   David Birnbaum's Introduction
  41.   =============================
  42.   
  43.   4 June 1993
  44.   
  45.   A couple of weeks ago I posted an inquiry to comp.fonts,
  46.   comp.os.os2.misc, and the OS2-L ListServ concerning some apparent
  47.   peculiarities in the way OS/2 handles font files. These "peculiarities"
  48.   actually reflect regular, systematic differences in OS/2, Windows, and
  49.   DOS font handling, which are not conveniently described in end-user
  50.   documentation. This posting is intended to spare others some of the
  51.   confusion I encountered as a result of this paradigm shift.
  52.   
  53.   This is the first (draft) distribution of this document and corrections
  54.   and suggestions are welcome. I am grateful to Henry Churchyard, Marc L.
  55.   Cohen, Bur Davis and Kamal Mansour for helpful discussions; they are
  56.   not, of course, responsible for any misinterpretation I may have
  57.   inflicted on their comments.
  58.   
  59. Subject: 4.1. Preliminaries
  60.   
  61.   Character: an informational unit consisting of a value (usually a byte)
  62.   and roughly corresponding to what we think of as letters, numbers,
  63.   punctuation, etc.
  64.   
  65.   Glyph: a presentational unit corresponding roughly to what we think of
  66.   as letters, numbers, punctuation, etc.
  67.   
  68.   Character vs glyph: Glyph and character are not necessarily the same;
  69.   the character <a> may be mapped to a Times Roman Lower Case <a> glyph
  70.   in one font and to a Helvetica Lower Case <a> glyph in another font.
  71.   Change of glyphs normally means a change in style of presentation,
  72.   while change in characters normally means a change in information.
  73.   There are gray areas and the definitions provided above are general,
  74.   approximate, and imprecise.
  75.   
  76.   Character set: an inventory of characters with certain assigned values.
  77.   ASCII is a 7-bit character set that specifies which "character cell"
  78.   (byte value) corresponds to which informational unit.
  79.   
  80.   Code Page: essentially synonymous with character set.
  81.   
  82.   Font: A collection of glyphs. A specific font may be isomorphic with a
  83.   specific character set, containing only glyphs corresponding to
  84.   characters in that set, with these glyphs mapped to the same byte
  85.   values as the characters they are intended to represent. PostScript
  86.   fonts often contain additional (unmapped) characters. Most importantly,
  87.   PostScript fonts may sometimes be remapped by an operating environment,
  88.   which is what leads to the disorienting cross-environment mismatch that
  89.   spurred my original posting.
  90.   
  91.   Fonts may be bitmapped or outline in format; a bitmapped format
  92.   corresponds to a particular size and weight for a particular device or
  93.   device resolution, while a single outline font is used to generate
  94.   multiple sizes as needed. Within an outline font system, different
  95.   weights (bold, semibold, italic, etc.) may be encoded as separate font
  96.   resources (separate outline files used to generate the glyphs) or may
  97.   all be generated from a single outline (slanting characters to make
  98.   "italics," fattening them for "bold," etc.).
  99.   
  100. Subject: 4.2. Fonts under DOS
  101.   
  102.   I used a large assortment of fonts under DOS for intricate multilingual
  103.   work. My setup at that time consisted of a library of bitmapped fonts
  104.   that could be sent to my HP LaserJet II printer, as well as a set of
  105.   fixed-size, fixed-width screen fonts that were supported by my Hercules
  106.   Graphics Card Plus (not the same as Hercules Graphics; the "Plus"
  107.   included an ability to store 3072 screen glyphs and display any of
  108.   these together, while standard character-mode displays were normally
  109.   limited to 256 or 512 such entities).
  110.   
  111.   Using XyWrite as a word processor, I would enter a "Mode" command to
  112.   change fonts and character sets simultaneously; this would make
  113.   different sets of screen glyphs available at the keyboard and would
  114.   insert a font-change command for my printer into the text stream. The
  115.   "Mode" and font-change commands were not displayed on the screen. The
  116.   result was not WYSIWYG, since I was limited to fixed-width screen
  117.   display and since I had far more printer glyphs available than the 3072
  118.   limit imposed by my video card; I used a brightness attribute to
  119.   indicate bold, I used the same screen font for different sizes of
  120.   printer fonts, etc. This worked and worked well, in that I could see
  121.   (for example) Russian, Greek, English, Polish, and other characters
  122.   simultaneously on the screen and I could print documents combining them.
  123.   
  124.   Architecturally, what was going on was that the character sets (code
  125.   pages) and fonts were entirely isomorphic and were hard- coded. If I
  126.   put a particular Russian letter into cell 246 of my screen and printer
  127.   fonts, that character was always there, and any strategy that would let
  128.   me access this cell (remapped keyboards, numeric keypad) was guaranteed
  129.   always to find the same character.
  130.   
  131. Subject: 4.3. Windows
  132.   
  133.   I recently began using PostScript fonts in Windows with AmiPro as my
  134.   word processor. These fonts came with printed cards indicating the
  135.   glyph mappings; I could look at the card and it would tell me that a
  136.   specific character lived in cell 246, and if I entered Alt-0246 at the
  137.   numeric keypad that glyph would appear on the screen. If I loaded the
  138.   font into Fontographer for Windows, these glyphs would be arrayed in
  139.   cells according to the map provided by Adobe with the fonts.
  140.   Fontographer also revealed that these fonts had other, "unmapped"
  141.   glyphs assigned to cells above 255.
  142.   
  143.   Given what appeared to be a hard correspondence among what I saw in
  144.   Fontographer, what was printed in Adobe's maps, and what was displayed
  145.   when I entered something at the keyboard, I naively assumed that
  146.   PostScript fonts were operating much like my bitmapped fonts under DOS.
  147.   There were some obvious differences, the primary one being that glyphs
  148.   of different sizes were all drawn from the same font resource files
  149.   under PostScript, but it appeared as if a glyph lived in a certain cell.
  150.   
  151. Subject: 4.4. Differences between Windows and OS/2
  152.   
  153.   This assumption was incorrect; PostScript fonts can be subdivided into
  154.   two types, one of which observes hard and invariant encodings similar
  155.   to those that apply to my bitmapped fonts, while the other represents a
  156.   completely different font mapping strategy. This difference became
  157.   apparent only when I attempted to share PostScript fonts between
  158.   Windows and OS/2 and got some unexpected results.
  159.   
  160.   A PostScript font under Windows involves two files, a PFB (PostScript
  161.   Font Binary) file, which contains the PostScript instructions needed to
  162.   draw each glyph and some mapping information, and a PFM (Printer Font
  163.   Metrics) file, which encodes width and kerning information. A
  164.   PostScript font under OS/2 also uses the same PFB file, but instead of
  165.   the PFM file it uses an AFM (Adobe Font Metrics) file. The AFM and PFM
  166.   files contain much of the same basic information (although the AFM file
  167.   is somewhat more complete); the most important differences are in
  168.   format (AFM is plain text, PFM is binary) and use (OS/2 uses AFM,
  169.   Windows uses PFM).
  170.   
  171. Subject: 4.5. Installation under Windows and Win-OS/2
  172.   
  173.   The OS/2 2.0 Font Palette tool (see below for changes to be introduced
  174.   with 2.1) by default installs fonts (both PFB and AFM files) into the
  175.   "\os2\dll" directory.  Win-OS/2 by default installs PFB files into
  176.   "\psfonts" and PFM files into "\psfonts\pfm".  These defaults can be
  177.   changed; since OS/2 and Win-OS/2 use the same PFB files, the user can
  178.   save disk space by allowing these to be shared (through installing into
  179.   the same directory, e.g., install OS/2 fonts into the "\psfonts"
  180.   directory instead of "\os2\dll".)  Note that fonts must be intalled and
  181.   removed through the Font Palette; if you copy, move, or delete a font
  182.   file without using the Font Palette, the system configuration files are
  183.   not updated and all hell breaks loose.
  184.   
  185.   Deleting fonts from Win-OS/2 causes the system to update the win.ini
  186.   file to remove references to the font, but does not delete any files
  187.   physically. Deleting fonts from the OS/2 Font Palette updates the
  188.   os2.ini configuration file and physically deletes the AFM and PFB files
  189.   from the disk.  This means that if you are sharing PFB files between
  190.   OS/2 and Win-OS/2, you can delete a Win-OS/2 font without hurting
  191.   native OS/2 operations, since the PFB reamins installed where OS/2
  192.   thinks it is. But if you delete an OS/2 font using the Font Palette,
  193.   the PFB file is erased from the disk even though the win.ini file is
  194.   not updated, so that Win-OS/2 thinks it is still there.
  195.   
  196. Subject: 4.6. FontSpecific PostScript Encoding
  197.   
  198.   Every PFB file contains an "encoding vector"; this is a plain text line
  199.   embedded near the head of the PFB file. Encoding vectors are of two
  200.   types: AdobeStandardEncoding and everything else. Adobe usually uses
  201.   the label "FontSpecific" for fonts that are not encoded according to
  202.   AdobeStandardEncoding, and I use it as a cover term here for any such
  203.   font.
  204.   
  205.   If you look at the readable plain text information at the head of a
  206.   FontSpecific type font, it includes a range of text that begins:
  207.   
  208.          /Encoding 256 array
  209.   
  210.   followed by a bunch of lines, each of which includes a number (which
  211.   corresponds to a cell in the font layout) and the name of the glyph
  212.   that lives in that cell. The unreadable binary data below this array
  213.   specification lists the name of each glyph and the PostScript
  214.   instructions for how the glyph is to be drawn.  There may be PostScript
  215.   code for drawing glyphs that are not included in the mapping array, but
  216.   only glyphs mentioned in the array specification are available to
  217.   applications.
  218.   
  219.   FontSpecific type fonts are comparable to the bitmapped fonts I used
  220.   under DOS. Each character physically is assigned to a specific cell
  221.   within the font file and operating environments are not allowed to
  222.   remap these. The glyph in cell 246 will be the same in both Windows and
  223.   OS/2.
  224.   
  225. Subject: 4.7. AdobeStandardEncoding
  226.   
  227.   AdobeStandardEncoding is a specific mapping of certain glyphs to
  228.   certain cells; in this respect it resembles FontSpecific encoding.
  229.   Because it is standardized, the array is not spelled out in the PFB
  230.   file; the line
  231.   
  232.          /Encoding StandardEncoding def
  233.   
  234.   tells Adobe Type Manager (ATM, either the Windows and Win-OS/2 version
  235.   or the native OS/2 version) that the encoding is "standard," and the
  236.   environments are expected to know what this standard is without having
  237.   the array spelled out in each font file.
  238.   
  239.   Although AdobeStandardEncoding is a real mapping, there is an
  240.   importance difference between it and various FontSpecific mappings:
  241.   operating environments are expected to remap AdobeStandardEncoding
  242.   fonts according to their own requirements.  That is, although
  243.   AdobeStandardEncoding does assign glyphs to cells, no operating
  244.   environment actually uses these assignments and any environment remaps
  245.   the glyphs before rendering them.  Confusion arises because Windows and
  246.   OS/2 remap such fonts in different ways.
  247.   
  248. Subject: 4.8. AdobeStandardEncoding under Windows (and Win-OS/2)
  249.   
  250.   An AdobeStandardEncoding font under Windows is remapped according to a
  251.   character map (code page) that MicroSoft calls Windows ANSI (can other
  252.   code pages be installed in Windows?). This determines which character
  253.   resides in which cell and the font is remapped so that glyphs and
  254.   characters will correspond. Since Fontographer for Windows is a Windows
  255.   application, it displays glyphs not in the cells in which they live
  256.   according to AdobeStandardEncoding, but in the cells to which they get
  257.   reassigned under the remapping to Windows ANSI. There is nothing
  258.   explicit in the PFB file that associates these characters with the
  259.   specific cells in which they appear under Windows.
  260.   
  261. Subject: 4.9. AdobeStandardEncoding under OS/2
  262.   
  263.   OS/2 operates within a set of supported code pages; two system- wide
  264.   code pages are specified in the config.sys file and an application is
  265.   allowed to switch the active code page to any supported code page (not
  266.   just these two). DeScribe, for example, currently operates in code page
  267.   (CP) 850, which includes most letters needed for western European Latin
  268.   alphabet writing. CP 850 does not contain typographic quotes, en- and
  269.   em-dashes, and other useful characters. It does contain the IBM
  270.   "pseudographics," which are useful for drawing boxes and lines with
  271.   monospaced fonts.
  272.   
  273.   When the user inputs a value (through the regular keyboard or the
  274.   numeric keypad), the application checks the active CP, looks up in an
  275.   internal table the name of the character that lives in that cell within
  276.   that CP, and translates it into a unique number that corresponds to one
  277.   of the 383 glyphs supported by OS/2 (the union of all supported code
  278.   pages). This number is passed to PM-ATM (the OS/2 ATM implementation),
  279.   which translate the glyph number into the glyph name that PostScript
  280.   fonts expect and searches the font for that name. The system never
  281.   looks at where a glyph is assigned under the AdobeStandardEncoding
  282.   array; rather, it scans the font looking for the character by name and
  283.   gives it an assignment derived from the active code page. This is the
  284.   remapping that OS/2 performs on AdobeStandardEncoding type fonts.
  285.   
  286.   As a result, a situation arises where, for example, <o+diaeresis> is
  287.   mapped to cell 246 under Windows ANSI but to cell 148 under CP 850.
  288.   Using the identical PFB file, this glyph is accessed differently in the
  289.   two operating environments.
  290.   
  291. Subject: 4.10. Consequences for OS/2 users
  292.   
  293.   If your font has a FontSpecific encoding, there are no unexpected
  294.   consequences; the same glyphs will show up at the same locations in
  295.   both Windows (Win-OS/2) and native OS/2. Regardless of what the active
  296.   code page is, if the font has a FontSpecific encoding OS/2 goes by cell
  297.   value; a specific glyph is hard-coded to a specific cell and OS/2 will
  298.   give you whatever it finds there, even if what it finds disagrees with
  299.   what the active code page would normally predict. In other words,
  300.   FontSpecific encoding means "ignore the mapping of the active code page
  301.   and rely on the mapping hard-coded into the font instead."
  302.   
  303.   If your font has an AdobeStandardEncoding encoding, the following
  304.   details obtain:
  305.   
  306.   1) The same PFB file may have glyphs that are accessible in one
  307.   environment but not another. For example, if DeScribe thinks it is
  308.   operating in CP 850, there is no access to typographic quotes, even if
  309.   those do occur in the PFB file and even if Windows can find them in the
  310.   same exact font file. DeScribe could switch code pages, but if the
  311.   application isn't set up to do so (and DeScribe currently isn't), those
  312.   characters are absolutely inaccessible to the user.
  313.   
  314.   2) If the active code page includes a character that isn't present in
  315.   the font, OS/2 has to improvise. For example, AdobeStandardEncoding
  316.   fonts do not normally include the IBM pseudographics, yet the user who
  317.   inputs the character value for one of these sends the system off to
  318.   look for it. As described above, OS/2 first checks the active font for
  319.   the glyph name that corresponds to that character and, if it finds it,
  320.   displays it.  If the glyph isn't found, OS/2 looks to the system Symbol
  321.   font.  This is not reported back to the user in DeScribe; if I have
  322.   Adobe Minion active (AdobeStandardEncoding, no information anywhere in
  323.   the font files for pseudographics) and input a pseudographic character,
  324.   DeScribe tells me it is still using Adobe Minion, even though it has
  325.   fetched the character it displays and prints from the Symbol font, a
  326.   different font resource file.
  327.   
  328. Subject: 4.11. Advice to the user
  329.   
  330.   OS/2's code page orientation provides some advantages, in that it
  331.   separates the character set (code page) mapping from the encoded font
  332.   mapping. The main inconvenience isn't a loss of function, but a
  333.   disorientation as users become accustomed to the new paradigm.
  334.   
  335.   If you need a glyph that you know is in your PFB file but that isn't in
  336.   the active code page (and if you can't change code pages within your
  337.   application), you can't get at it in OS/2 without tampering with the
  338.   font files. To tamper, you can use font manipulation tools to
  339.   redesignate the PFB file as FontSpecific ("Symbol" character set to
  340.   Fontographer). If you then map the glyphs you need into one of the
  341.   lower 256 cells (with some limitations), they will be accessible in all
  342.   environments. The Fontographer manual does not explain what the
  343.   "Symbol" character encoding label really does, it just tells you not to
  344.   use it except for real symbol fonts. In fact you should use it for any
  345.   font that will not correspond in inventory to the code page supported
  346.   by your application, which means any non-Latin fonts.
  347.   
  348.   You do not have to recode all your fonts, and you wouldn't normally
  349.   want to do so, since Fontographer hinting is not nearly as good as
  350.   Adobe's own hand-tuning and regenerating a font regenerates the hints.
  351.   All you have to do is make sure you have one FontSpecific type font
  352.   installed that includes your typographic quotes, etc. for each typeface
  353.   you need. Within DeScribe, you can then write a macro that will let you
  354.   switch fonts, fetch a character, and switch back, thereby allowing you
  355.   to augment any group of fonts with a single, shared set of typographic
  356.   quotes (or whatever) that you put in a single FontSpecific font.
  357.   Alternatively, OS/2 also supports CP 1004, which does contain
  358.   typographic quotes and other characters used for high-quality
  359.   typography, but the user may not be able to convince an application to
  360.   invoke this code page if it was not designed to do so.
  361.   
  362.   You can have any number of FontSpecific fonts installed, which means
  363.   that there is a mechanism for dealing with unsupported character sets
  364.   (code pages).
  365.   
  366.   You can also tinker with the font files to try to trick the operating
  367.   system. For example, using Fontographer or other utilities, you can
  368.   change the name assigned to a glyph description within the PFB file. If
  369.   you want to use AdobeStandardEncoding and you want to see a specific
  370.   glyph at a specific cell when DeScribe thinks it's using CP 850, you
  371.   have to make sure that the name assigned to the description of that
  372.   glyph is what DeScribe expects to find. OS/2 doesn't care whether, say,
  373.   <o+diaeresis> really looks like <o> with two dots over it, as long as
  374.   it bears the right name.
  375.   
  376.   This second approach is obviously far more complex and provides much
  377.   more opportunity for error. Its advantage is that OS/2 does not support
  378.   case conversion and sorting (other than in machine order) for
  379.   unsupported code pages, since these operations depend on character
  380.   names. Keeping supported names from supported code pages while changing
  381.   the artwork is one way to maintain order and case correspondences while
  382.   increasing the range of glyphs actually supported. I have not
  383.   experimented with this approach, since the use I would get out of the
  384.   adding functionality (over the FontSpecific encoding approach) is not
  385.   worth the amount of effort required.
  386.   
  387. Subject: 4.12. OS/2 2.1 and beyond
  388.   
  389.   OS/2 2.1 will change some aspects of font handling. First, OS/2 2.0
  390.   GA+SP has a bug that can cause OS/2 to crash when an AFM file with more
  391.   than 512 kern pairs is read. This is fixed in 2.1.  (This bug is
  392.   separate from a design limitation in MicroSoft Windows that causes
  393.   large kern tables to be read incorrectly.  This problem is still under
  394.   investigation; watch this space for a report.)
  395.   
  396.   Fonts in 2.1 will be installed by default into the "\psfonts" directory,
  397.   so that they will normally be shared with Win-OS/2 fonts. (The user will
  398.   still be able to specify a directory; all that will change is the
  399.   default). The user will also be able to instruct the Font Palette not to
  400.   delete font files when fonts are uninstalled, so as to avoid clobbering
  401.   a Win-OS/2 font by removing it from native OS/2 use through the Font
  402.   Palette (although the default will still be to delete the physical font
  403.   files).
  404.   
  405.   OS/2 will stop using AFM files and will replace these with OFM files, a
  406.   binary metrics file (different from PFM) that OS/2 will compile from
  407.   the AFM file during font installation. This will speed font loading,
  408.   since the system will not have to parse a plain text metrics file.
  409.   Additionally, the OS/2 PostScript printer driver used to install its
  410.   own, large font files, but will now use the OFM and PFB files, thereby
  411.   saving 50k-200k of disk space per installed font outline.
  412.   
  413.   IBM's long-term goal is to replace the 383-entity inventory of
  414.   supported glyphs with Unicode. This is very much a long-term goal and
  415.   there is not even a hint of when it might become available.  It has its
  416.   own problems, stemming from the fact that Unicode is essentially a
  417.   character standard and glyph and character inventories may differ is
  418.   assorted ways, but it will be a significant step in the proverbial
  419.   right direction.
  420.   
  421.