The present invention is broadly directed to the generation of character images in a computer, for display on a display device, such as a monitor, and/or printing in a document. As background to the concepts which underlie the invention, a process for 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 and executed on a computer is illustrated in the block diagram of
When a user types a character via the keyboard 12, an indication of that event is provided to the application program 10 by the computer's operating system 14. In response, the application program issues a call to the computer's imaging system 18, 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 18 can be a component of the computer's operating system 14. Upon receipt of the request for a character in a particular font, the imaging system accesses a glyph cache 20, 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 22, 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
Each font that is stored in the computer, for example on a hard disk, resides in a file.
Fonts can be classified according to different technologies. Two well-known and widely used font technologies are TrueType and OpenType. 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-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 28a. In general, the 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 24. Each different type of font technology has an associated scaler for processing the data of fonts which conform to that technology. Thus, in the example of
In operation, the application program 10 issues a request for a particular font object. The font object provides an identification of a glyph family, e.g. a particular character such as “lowercase a”, as well as its desired line weight and/or other parameters. 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 receiving the font object, the font server 24 determines the font technology with which that object is associated, and passes the request on to the appropriate scaler 28. The scaler retrieves the necessary data from the font file 26 associated with the identified font, and processes it to meet the parameters specified in the request. The scaler then returns a glyph image to the font server 24, which is provided to the imaging system 18 and stored in the glyph cache 20.
As the individual glyph images are received from the font subsystem 22, they are displayed as a line of characters by the imaging system 18. The imaging system may include a layout engine 30, which adjusts the positions of individual glyphs relative to one another, and performs further modifications of the glyphs, to lay out a complete line of characters. In general, the layout engine receives an input string consisting of a sequence of character 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 file. The layout engine examines the glyph codes relative to certain rules and conditions, and selectively performs various operations on the glyphs. After these processes have been applied to the glyphs in a line, an output string is produced which contains bit-mapped information for drawing the appropriate glyph images.
One of the processes performed by the layout engine is to determine 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. Another example, discussed in detail hereinafter, is to adjust the position of diacritic glyphs relative to the base glyphs that they modify.
Each of the processes performed by the layout engine 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 positioning procedure, the layout processor may refer to tables that contain data relating to kerning, baseline alignment and glyph properties. The font objects associated with the glyphs in a line are employed to select the appropriate tables from the various font files 26. 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 16.
Turning now to the positioning of diacritics, 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 position diacritic glyphs in a manner that would avoid the type of result illustrated in
In operation, the diacritic positioning system employs three items of data to determine where to position a diacritic, namely (1) the base glyph's bounding box, (2) the diacritic glyph's bounding box, and (3) diacritic position data. The bounding boxes for the base glyph and the diacritic glyph are stored in the file 26 for the font. In general, the bounding box is a rectangle that defines the outer edges of the optical image of the glyph. Typically, the bounding box is defined in terms of the top, bottom, left side and right side optical bounds of the glyph.
The third data item, the diacritic position data, is contained within the diacritic positioning system as mark orientation data that is separate from the font itself. Following are examples of mark orientations that can be stored in the diacritic positioning system:
Each diacritic in a character set, e.g. the Unicode character set, has one of these mark orientations associated with it in the diacritic positioning system. Referring to
An illustration of the operation of the diacritics positioning system will be provided with reference to the example depicted in
Thereafter, the glyph for the macron is processed in a similar manner by the layout engine. First, the diacritics positioning system looks up the mark orientation for the macron, which is also MARK ABOVE CENTERED OVER BASE. Therefore, the same two functions are called. When the function “positionMarkAboveHighestMark” is called, the diacritics positioning system is aware that the diaeresis has already been placed above the base glyph. Consequently, it determines the vertical position of the macron glyph to be at the determined height above the glyph for the diaeresis.
A different, but related, problem occurs with Thai fonts. The diacritics that appear above the base character are intentionally designed at two different levels. In
When this type of character is processed by the diacritics positioning system, it looks up the tone mark in the table 32, and determines that it has the mark orientation of MARK ABOVE RIGHT JUTTING OUT ONE THIRD. This orientation references the functions “positionMarkOneThirdPastRightEdge” and “positionMarkAboveHighestMark”. The function “positionMarkOneThirdPastRightEdge” sets the horizontal position of the diacritic's bounding box such that ⅓ of its width extends beyond the right edge of the base character's bounding box. The function “positionMarkAboveHighestMark” operates as described previously, to space the diacritic's glyph ⅓ of the height of its bounding box, for example, above the top edge of the base character's bounding box. The results of these operations are more aesthetically pleasing, as shown in
Another situation that can arise with Thai fonts, where the diacritics are designed at fixed heights, is the possibility that a diacritic can overlap a “tall” base character. An example of this situation is illustrated in
To accommodate this type of situation in the diacritics positioning system, base characters having special characteristics can also be listed in the table 32, with associated mark orientations to be applied to any diacritics that modify them. In this example, the Thai character for the consonant “p” is listed in the table with the associated mark orientation MARK ABOVE LEFT OF RIGHT EDGE BY ONE THIRD AND TOP ALIGNED. When the diacritics positioning system receives a request to draw a diacritic glyph, it checks the table 32 to see if the base character is listed as a special character. If so, it substitutes the mark orientation associated with the special character for the mark orientation normally associated with the diacritic, and calls the functions referenced by the replacement mark orientation. Thus, when positioning the diacritic at the lower level, i.e., the vowel mark, the diacritics positioning system calls the functions “positionMarkLeftOfRightEdgeByOneThird” and “alignMarkWithTopEdge”, that are associated with the substituted mark orientation. The function “positionMarkLeftOfRightEdgeByOneThird” sets the horizontal position of the vowel mark to the left of the right edge of the base glyph's bounding box by ⅓ of the width of the vowel mark's bounding box. The function “alignMarkWithTopEdge” sets the vertical position of the vowel mark so that the upper edge of its bounding box has the same vertical coordinate as the upper edge of the base glyph's bounding box.
For a diacritic at the higher level, overlap with a tall character does not occur. Thus, to draw the tone mark, the diacritics positioning system employs its original mark orientation, i.e., MARK ABOVE RIGHT JUTTING OUT ONE THIRD, and the functions referenced by it. The positioning of the tone mark is carried out relative to the lower vowel mark, rather than the base character. The result is shown in
The operation of the diacritics positioning system, to achieve the foregoing results, is depicted in the flow chart of
Once the appropriate mark orientation has been retrieved, a call is made to the referenced function for determining the horizontal position of the diacritic glyph, at step 62. Thereafter, at step 64, a call is made to the associated function for determining the height of the glyph. It will be appreciated that steps 62 and 64 can be performed in the reverse order. Once the appropriate horizontal and vertical positions have been determined, the diacritic glyph is drawn at those positions, at step 54. The layout engine then continues with the process for drawing the next glyph in the line.
From the foregoing, therefore, it can be seen that the diacritics positioning system of the present invention functions to properly position one or more diacritic glyphs relative to a base glyph. Since the mark orientation and positioning functions are associated with the diacritics positioning system, rather than an individual font, the diacritics positioning system is capable of properly positioning diacritic glyphs for fonts that do not contain complex positioning data. Furthermore, by including positioning information for special base characters, added capabilities are provided to obtain aesthetically pleasing appearances in the resulting characters.
It will be appreciated by those of ordinary skill in the art that the present invention can be embodied in other forms without departing from the spirit or essential characteristics thereof. The foregoing description is therefore considered to be illustrative, and not restrictive. The scope of the invention is indicated by the following claims, and all changes that come within the meaning and range of equivalents are therefore intended to be embraced therein.