« PreviousContinue »
AUTOMATIC SYNTHESIS OF FONT TABLES
FOR CHARACTER LAYOUT
FIELD OF THE INVENTION
The present invention relates to the display and printing of font characters, and more particularly to a method and system for automatically synthesizing font tables that determine the manner in which images of characters are processed for printing and display.
BACKGROUND OF THE INVENTION
The continued evolution of application programs, such as word processing and desktop publishing programs, has provided users with a great deal of versatility and control in the appearance of documents created with these types of programs. A significant factor in this area is the ability to influence the layout of textual and symbolic characters on a page. Initially, the character fonts that were available for use in these types of programs were relatively static, in the sense that their shapes and positioning were rigidly fixed according to a predefined set of rules. As new fonts have been developed, the technology pertaining to the appearance and layout of characters has also evolved, so that new capabilities are continuously being added to fonts. As a result, it is now possible to control a number of different parameters which determine the appearance and layout of characters in a line of text. Examples of these parameters include the identification of the specific glyphs that define the appearances of the characters, substitution of contextual letterforms and ligatures, the positioning of the glyphs relative to one another, hanging punctuation, and optical alignment of a line of characters.
To provide these types of capabilities, a given font is comprised of more than just the glyphs which determine the appearances of the individual characters. In particular, the font definition consists of a number of data tables that relate to various parameters which control the implementation of the font. For instance, a TrueType font comprises a file that may contain up to thirty or more tables that determine the layout and other characteristics of the font. Examples of the types of data in these tables include kerning, i.e. spacing between characters, the metrics or dimensions of glyphs, variable properties such as line widths, and the like. The information provided by these tables is employed for a number of different purposes. For instance, some processes may rely upon a table of the names of various font styles, to display in a menu or dialog box. Another use of the tables occurs when a line of characters is to be laid out for display or printing purposes. One example of a technology which lays out a line of text pursuant to the data in such tables is described in U.S. Pat. No. 5,416,898, the disclosure of which is incorporated herein by reference.
As font technology continues to evolve over time, new capabilities are constantly being added, to enhance the versatility and control over the appearance of characters. The added capabilities are generally accompanied by new data tables. An unfortunate consequence of this development is the fact that older fonts may not contain all of the tables necessary to conform to the latest capabilities. As an example, if an attempt is made to employ an older font which does not contain the latest tables, during the operation of a line layout processor that makes use of the newer tables, the results can range from an unaesthetic appearance to linguistically incorrect text.
In an effort to overcome the limitations associated with the use of older fonts, various tools have been made available to permit font developers to add new tables to existing fonts. However, there may be a reluctance by developers to alter the contents of a font once it has been accepted. Furthermore, even if a font is updated to incorporate the newer data tables, users must become aware of, and acquire, the updated fonts before they can be successfully used with the newer font processing technologies.
Accordingly, it is desirable to provide a mechanism via which data tables that are needed to properly process the glyphs of a font can be automatically synthesized if they are not part of the original font definition. Further in this regard, it is desirable to be able to synthesize and employ such tables in a manner which does not affect the original definition of the font.
SUMMARY OF THE INVENTION
In accordance with the present invention, these objectives are achieved by means of a method and system in which one or more font tables are automatically synthesized as needed, and placed in an annex file that is associated with the original font. When a character or string of text is requested by an application program, for example, a computer's font system first checks the original definition of the font, to see if it contains the tables that are necessary to display or print the requested characters. If the font itself does not contain the tables, the font system examines an associated annex file to see if the appropriate tables exist. If so, the table is accessed and its data is employed to process font data. If the table does not exist, it is automatically synthesized and placed in the annex, where its data is then utilized.
Using an annex file that is associated with a font, rather than physically adding the tables to the fonts themselves, provides several advantages. In particular, the actual font data is not affected by the creation of the new table. Consequently, font management systems that employ font protection, for example by performing checksums or calculating digital signatures for font data, will continue to operate properly. Furthermore, since the annex file is persistent and survives across successive boots of the computer, the effort required to synthesize a table is only expended once per font, and thereafter available for all subsequent uses of the font.
In one embodiment, the synthesis of a table is carried out by first creating a font map. The font map is constructed by analyzing a glyph repertoire associated with the font, to identify certain types of data associated with each glyph. The data in the font map is then used to compute tables which identify specific types of mappings between glyphs, or other characteristics associated with individual glyphs. These tables are stored in the annex, and their data is employed for various font processing techniques. In another embodiment, a table is created by reformatting and/or translating data that is already present in a font, to place it in a structure that can be used by a particular process.
The foregoing features of the invention, and the advantages provided thereby, are explained in greater detail hereinafter with reference to specific embodiments illustrated in the accompanying drawings.
BRIEF DESCRIPTION OF THE DRAWINGS
FIG. 1 is a general block diagram of the components of an exemplary computer system;
FIG. 2 is a block diagram illustrating the general architecture of software components involved in the implementation of the present invention;
FIG. 3 is a more detailed view of the architecture of the font subsystem; 5
FIG. 4 is a flow chart of the general procedures that are carried out in a line layout processor;
FIG. 5 is a schematic illustration of the relationship of a font suitcase and an annex file;
FIG. 6 is a flow chart of the general procedure for 10 obtaining and synthesizing font data tables;
FIG. 7 is a schematic illustration of one example of the synthesis of a data table; and
FIG. 8 is a schematic illustration of another example of the synthesis of a data table. 15
To facilitate an understanding of the present invention, it is described hereinafter in the context of a specific imple- 20 mentation thereof. In particular, reference is occasionally made to features of the invention that are employed in connection with TrueType fonts, as well as line layout technology that is intended to be used with this type of font. It will be appreciated, however, that the practical applica- 25 tions of the invention are not limited to this particular example. For instance, the following embodiments have been demonstrated to work with PostScript fonts as well. Likewise, the data tables that are synthesized need not be only those which are used for line layout. The principles 30 which underlie the invention can be utilized in connection with a number of different types of font technologies and font handling systems in which it is useful to employ font tables that determine the characteristics of a font.
The present invention is broadly directed to the generation 35 of character images in a computer, for display on a display device, such as a monitor, and/or printing in a document. While the particular hardware components of a computer system do not form a part of the invention itself, they are briefly described herein to provide a thorough understanding 40 of the manner in which the features of the invention cooperate with the components of a computer system to produce desired results. Referring to FIG. 1, a typical computer system includes a computer 10 having a variety of peripheral devices 12 connected thereto. The computer 10 includes a 45 central processing unit 14 and associated memory. This memory generally includes a main working memory which is typically implemented in the form of a random access memory 16, a static memory that can comprise a read only memory 18, and a permanent storage device, such as a 50 magnetic or optical disk 20. The CPU 14 communicates with each of these forms of memory through an internal bus 22. The peripheral devices 12 include a data entry device such as a keyboard 24, and a pointing or cursor control device 26 such as a mouse, trackball, pen or the like. A display device 55 28, such as a CRT monitor or a LCD screen, provides a visual display of the information that is being processed within the computer, for example the contents of a document or a computer generated image. A tangible copy of this information can be provided through a printer 30, or similar 60 such device. Each of these external peripheral devices communicates with the CPU 14 by means of one or more input/output ports 32 on the computer.
As further background to the concepts which underlie the present invention, one process which makes use of data 65 tables synthesized in accordance with the invention, namely the generation and laying out of images of characters and
symbols, will first be described. The general architecture of software programs that are loaded into the RAM 16 and executed on the computer is illustrated in the block diagram of FIG. 2. In a typical situation, the user interacts with one or more application programs 34, such as a word processing program, a desktop publishing program, or a graphics program. In operation, as the user types words via the keyboard 24, the application program issues requests to the computer's operating system 36 to have the characters corresponding to the keystrokes drawn on the display 28. Similarly, when the user enters a command to print a document, the application program issues requests to the operating system which cause the corresponding characters to be printed via the printer 30. For illustrative purposes, the following description of the operation of the present invention will be provided for the example in which characters are drawn on the screen of the display 28 in response to user-entered keystrokes. It will be appreciated, however, that similar operations are carried out in connection with the printing of characters in a document on the printer 30.
When a user types a character via the keyboard 24, an indication of that event is provided to the application program 34 by the computer's operating system 36. In response, the application program issues a call to the computer's imaging system 38, to draw the character corresponding to the keystroke at a particular location on the display. That call includes a character code that designates a particular letter or other item of text, and style information which contains an identification of the font for the corresponding character. The imaging system 38 is a component of the computer's operating system 36. In the case of the Macintosh operating system, for example, the imaging system could be QuickDraw or QuickDraw GX.
Upon receipt of the request for a character in a particular font, the imaging system accesses a glyph cache 40, which contains bitmap images of characters. If the requested character has been previously displayed in the designated style, its image will be stored in the glyph cache, and immediately provided to the imaging system. If, however, the requested character is not stored in the cache, a call is made to a font subsystem 42, to obtain the requested image. The call to the font subsystem identifies a particular font object, a point size, a resolution and any possible variations.
The structure of the font subsystem is illustrated in FIG. 3. Within the font subsystem 42, the management of requested font objects is handled by a font server 44. In general, when a request for a font is received from an application program, for instance via the imaging system 38, the font server is responsible for locating the font or, if it is not available, the best substitute for it. The font server also retrieves the fonts that have been requested, and supplies them to the imaging system. The font server may also be responsible for displaying a font selection dialog box from which the user can choose a desired font, and/or providing a list of available fonts to the application program, to be displayed in a font menu.
Each font that is stored in the computer, for example on the hard disk 20, resides in a file that is sometimes referred to as a suitcase. FIG. 3 illustrates a number of suitcases 46 that respectively store fonts labeled 1 through n. Each suitcase contains all of the data tables and other associated information that forms the definition of a font.
Fonts can be classified according to different technologies. Two well-known and widely used font technologies are TrueType and Type 1. These types of fonts are known as outline fonts, since their typeface designs, or glyphs, are specified by vectors which define the outlines of their
shapes. Other types of fonts might fall into a category that is referred to as bit-mapped, or screen fonts, in which each pixel of a glyph is defined. Each of these technologies has a different set of rules for processing font data to satisfy a particular request. For instance, the characters of a bit- 5 mapped font may be stored on the computer for a particular point size, e.g., 12 point. If the user requests the characters to be displayed at a different size, the pixel data must be processed to rescale the images of the characters. This processing is carried out in a font scaler 48a. In general, the 10 font scaler operates in accordance with a set of rules for interpreting and processing the stored font data so as to satisfy specific requests from the font server 44. Each different type of font technology has an associated scaler for processing the data of fonts which conform to that technol- 15 ogy. Thus, in the example of FIG. 3, a TrueType scaler 48b and a Type 1 scaler 48c are contained within the font subsystem.
In operation, the application program 34 issues a request for a particular font object. The font object provides an 20 identification of a glyph family, e.g. a particular character such as "lowercase a", as well as its desired line weight and stress. The request from the application program also identifies any style variations to be applied to the character, such as italic, bold, underline, superscript, and the like. Upon 25 receiving the font object, the font server 44 determines the font technology with which that object is associated, and passes the request on to the appropriate scaler 48. The scaler retrieves the necessary data from the suitcase 46 associated with the identified font, and processes it to meet the param- 30 eters specified in the request. The scaler then returns a glyph image to the font server 44, which is provided to the imaging system 38 and stored in the glyph cache 40.
As the individual glyph images are received from the font subsystem 42, they are displayed as a line of characters by 35 the imaging system 38. The imaging system may include additional technology for processing and manipulating the glyph images before they are displayed. For example, the imaging system may include a line layout processor, which adjusts the positions of individual glyphs relative to one 40 another, and performs further modifications of the glyphs, to lay out a complete line of characters. An example of the general procedures that are carried out in the line layout processor is illustrated in FIG. 4. The line layout processor receives an input string consisting of a sequence of character 45 codes and associated style information. As a first step, the character codes are mapped to glyph codes specific to the font. This mapping is performed in accordance with a data table stored in the font suitcase. The layout processor examines the glyph codes relative to certain rules and 50 conditions, and selectively performs three major types of operations on the glyphs. These three operations constitute metamorphosis, positioning and justification. After these three processes have been applied to the glyphs in a line, an output string is produced which contains bit-mapped infor- 55 mation for drawing the appropriate glyph images.
Metamorphosis encompasses a variety of procedures via which the initial set of glyphs identified by the input string are transformed into a different set of glyphs. Some of the transformations can be independent of the context within 60 which they appear. For instance, when a glyph for the letter T is followed by a glyph for the letter 'i' in a word, these two glyphs can be transformed into an 'fi' ligature, in which the two separate glyphs appear to be joined. Another example of such transformation is the automatic conversion 65 of numbers into Roman numeral form. Other types of transformations are dependent upon the context in which
they appear, and are usually determined by rules pertaining to a specific language. For instance, two letters may be transposed if they appear at the end of a word, rather than in the middle of a word.
After the identities of glyphs have been changed in the metamorphosis step, the line layout processor determines whether the positions of any of the glyphs should be adjusted, relative to one another. For instance, in the case of the word 'To', it may be desirable to shift the position of the glyph for the letter 'o' to the left, to avoid the appearance of a large space between the two letters. Similarly, it may be appropriate to adjust the vertical position of a hyphen, so that it is centered with respect to the two characters between which it appears.
After the general positioning of the individual glyphs takes place, the final process in the layout of the line is the justification of the entire line. In this process, the intercharacter spacing is adjusted, as appropriate, to provide the desired type of justification. In some alphabets, the justification may be provided by extending the letters themselves, rather than by adjusting the spacing. For instance, the Arabic alphabet uses extension bars, known as kashidas, to increase the geometric length of a word, while keeping all characters connected to one another. The justification process determines whether the use of kashidas and/or intercharacter spacing adjustment is required, and revises the glyph images accordingly.
Each of these major processes relies upon the data contained in one or more font tables to carry out the appropriate adjustments to a sequence of glyphs. For instance, during the metamorphosis procedure, the layout processor may refer to a ligature table and a metamorphosis table to identify the appropriate glyph identity changes to be carried out. In operation, the layout processor employs the font objects associated with the glyphs in the input string to retrieve the tables corresponding to those fonts. These tables are then examined as part of the procedure to determine the types of glyph identity changes that need to be made. Similarly, during the positioning procedure, the layout processor may refer to tables that contain data relating to kerning, baseline alignment, tracking and glyph properties. During the justification procedure, the layout processor employs a justification table. In each case, the font objects associated with the glyphs in a line are employed to select the appropriate tables from the various font suitcases 46.
After the glyphs in a line have been appropriately processed through the layout procedure, an output string of pixel values is produced, to control the display of the line of characters on the display device 28. For more detailed information regarding the line layout procedures, and the manner in which the font data tables are employed in such procedures, reference is made to the aforementioned U.S. Pat. No. 5,416,898.
Turning now to the specifics of the present invention, it may be the case that one or more of the fonts that are employed in a document does not include all of the tables that are necessary for the layout processor to perform all of its operations on the glyphs. This may be particularly true in the case of older fonts that were created before the capabilities of the layout processor were developed. In addition to the layout processor, other operations that occur within the computer may require information from data tables in the font. For instance, to display a menu of font styles, an application program may need to access a table of names. If the table is not present, the menu cannot be displayed. In accordance with the present invention, tables that are required to process fonts, for example within the layout