home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / answers / fonts-faq / part6 < prev    next >
Internet Message Format  |  1993-09-22  |  23KB

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