Character multifont compression and restoration device
CROSS-REFERENCE TO RELATED APPLICATION 
     This is a Continuation-In-Part of application Ser. No. 07/104,042, filed Oct. 2, 1987, now abandoned. 
    
    
     BACKGROUND OF THE INVENTION 
     1. Field of the Invention 
     The present invention relates to a realtime generating system for generating high quality printed multifont and multiresolution Chinese characters. 
     2. Statement of the Prior Art 
     Chinese character pattern generation in a personal computer system is becoming more and more important for realtime Chinese information processing. The current approaches to the generation of Chinese character patterns in personal computers have many drawbacks. The ordinary Chinese character generating card in a personal computer system uses a &#34;dot matrix&#34; method. Since the dot matrix necessitates very large storage space in the computer, this method can only generate a single resolution and single style Chinese character. Some Chinese character generating systems use the &#34;B-spline&#34; method instead of the entire dot matrix. Such systems require a much smaller storage space and can generate multifont Chinese characters with multiresolutions. However, the Chinese character pattern is generated by means of a mathematical equation, which limits the ability to form a good looking Chinese character pattern. Moreover, the control points for a character must be chosen manually. Therefore, the quality of the Chinese characters generated thereby is rather difficult to control and the resultant appearance of a character isn&#39;t smooth. Furthermore, it cannot generate some of the Chinese character styles, such as the normal style, the running style, and the official style (clerical style), etc. According to the present invention, the aforesaid drawbacks are eliminated by means of a simple hardware circuit, in which high-quality Chinese multifont multiresolution characters multiresolution can be generated in realtime. The present invention is particularly useful for PC systems. 
     SUMMARY OF THE INVENTION 
     The present invention comprises two sub-systems, i.e., a Chinese character compression sub-system, and a printed Chinese character realtime generating sub-system. The Chinese character compression sub-system stores a dot matrix character having one resolution by converting a character pattern into a character outline, and then compressing the character pattern into vector, which is then stored in a ROM. The generating sub-system retrieves, upon being provided with a Chinese character code and the specific resolution, the compressed character vector from the ROM and converts the vector into a character outline. The outline is enlarged or shrunk by means of the vector method into a specific resolution, and the outline in then filled to form the character pattern required. All the processing steps of the printed Chinese character realtime generating sub-system are accomplished in a function card in a PC. The advantages of the present invention in comparison with that of the conventional Chinese character generating systems are as follows: 
     1. The compressed character vector in the present invention is generated automatically by the computer. The quality of the character pattern is easy to control. The present invention reduces the manpower required to do the correcting and thereby reduces costs. 
     2. The present invention requires a very short time to make a compressed character patterns vector of a given character style. At the present time, at least 1000 characters can be made in one day. 
     3. The present invention uses a simple method without using the complicated mathematical equations. The Chinese character pattern can be generated by means of the compressed character pattern vector. The character pattern includes the Ming-dynasty style, the boldface style, the Sung-dynasty style, the formal style, the running style, the official style (clerical style), the seal character and the grass style and others. 
     4. The character pattern generated is visually appealing. 
     5. By means of a one resolution compressed character vector, a multiresolution Chinese character pattern can be generated by means of an enlarging or shrinking method, thereby reducing the amount of storage space required. 
     6. Since the Chinese printed character realtime generating sub-system mounted on a circuit board in a PC, it is not necessary to have a large computer storage means in the present invention. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     FIG. 1 is a block diagram of the sub-system for compressing the Chinese characters according to the present invention. 
     FIG. 2 is a block diagram of the Chinese character compressing module according to the present invention. 
     FIG. 3 is a block diagram of a circuit board to be mounted in a PC for realtime generation of printed Chinese characters according to the present invention. 
     FIGS. 4(a)-4(e) are diagrams for explaining the operation of the outline locating module according to the present invention. 
     FIGS. 5(a)-5(e) are diagrams for explaining the operation of the outline vector generating module according to the present invention. 
     FIGS. 6(a)-6(b) are diagrams for explaining the operation of the outline distinction module according to the present invention. 
     FIG. 7 illustrates the vector data of the compressed Chinese character. 
     FIG. 8 illustrates the Chinese characters after having been enlarged and shrunk. 
    
    
     DETAILED DESCRIPTION 
     The present invention mainly comprises two sub-systems, i.e., a Chinese character compression sub-system and a printed Chinese character realtime generating sub-system. A dot matrix Chinese character is first converted into a compressed Chinese character vectors by the Chinese character compression sub-system. The compressed Chinese character vectors are then stored in a ROM. As soon as the read-in is completed, a high quality Chinese multifont, multiresolution character is generated by the printed Chinese character realtime generating sub-system. FIG. 1 illustrates the Chinese character compression sub-system, which comprises: 
     1. A disk drive 1 for storing the dot matrix Chinese characters and the compressed Chinese character vector; 
     2. A host processor for controlling the operation of the Chinese character compression module. 
     3. A Chinese character compression module 3 for compressing the dot matrix Chinese characters into a vector form so as to occupy less storage space. 
     FIG. 2 is a block diagram of the Chinese character compression module 3. Each of the illustrated modules is a separate firmware entity. First, a dot matrix character is inputted to the compression module 3 from a personal computer (PC) main system via an I/O port. The host processor 2 then controls the activation of each module. As each module completes its specified operation, it informs the host processor 2 which in turn activates the next module. Upon completion of the character compression, the PC main system is so informed by the host processor, and the compressed character data is transmitted to the PC main system via the I/O port. 
     Each of the modules illustrated in FIG. 2 are described in detail below. 
     As previously indicated, the dot matrix character is inputted into the outline locating module 32. The outline locating module 32 locates the stroke outline (or contour) of the Chinese character by first registering each pair of inputs of each of the horizontal segments of the Chinese character, and then registering each pair of end points of each vertical segment of the Chinese character. For example, the Chinese character shown in FIG. 4(a) would be represented as shown in FIG. 4(b). 
     The aforementioned method can locate most of the stroke outline, however, points A-D as shown in FIG. 4(b) cannot be located according to this method. These points A-D are referred to as cross points. They are particularly important when the contour is enlarged. That is, if they are not taken into account, the resultant enlarged character becomes as shown in FIG. 4(c). 
     Accordingly, the cross points must be found and registered. This is accomplished by dividing each segment according to its length, i.e., long, middle, and short. That is, as shown in FIG. 4(d), each of the points of a horizontal long segment is designated as &#34;H&#34;, and each of the points of a vertical long segment are designated as &#34;V&#34;. Additionally, each of those points which exists in both a vertical long segment and a horizontal long segment are designated as &#34;HV&#34;. Accordingly, a cross area can be located, and the cross points can therefore be located by referring to the foregoing contour points. 
     The outline locating module 32 then records, using the frame-surrounding method, the orientation of the lines of the character from the upper side to the lower side of the character and from the left side to the right side of the character. The orientation of lines includes eight directions having direction codes as shown in FIG. 4(e). 
     The outline vector generating module produces contour vectors and further compresses the acquired contour data. That is, module 33 combines successive segments having the same direction into one segment and records the direction code and length thereof. The direction code represents the direction change as shown in FIG. 5(a). Furthermore, module 3 smooths the denticulate portions caused by digitization of diagonal strokes of the Chinese character, for example, protrusion points and recess points as shown in FIG. 5(b). The recess point is so defined that the line segment between any two points located respectively on two sides of a recess point will go through the outer part of the character. The protrusion, of course, is oppositely defined. The aforesaid smoothing is achieved by means of eliminating some recess points to form a somewhat longer segment. A recess point is first selected, and then the slopes of the selected point and its neighboring six points are calculated. If their slopes are relatively the same, the recess point is then eliminated. This procedure is repeated until all such recess points have been deleted. 
     Module 33 further determines the type of each point. Since a new coordinate is otherwise calculated when enlarging or narrowing each point, the points are classified into four types A, B, C, and D. A point type is classified according to the eight direction points, as shown in FIG. 5(c). If P1 appears to be a black point, then 1 is added to the D value. If P2 appears to be a black point, then 1 is added to the C and D values respectively. Thus, each value of A, B, C, and D is determined. An example of the values of a A, B, C, and D is shown as in FIG. 5(d). 
     The formulas for enlarging and narrowing each type of point are as shown below: 
     
         ______________________________________                                    
A:             x&#39; = (x - 1) * ratio + 1                                   
               y&#39; = (y - 1) * ratio + 1                                   
B:             x&#39; = (x - 1) * ratio + 1                                   
               y&#39; = y * ratio                                             
C:             x&#39; = x * ratio                                             
               y&#39; = (y - 1) * ratio + 1                                   
D:             x&#39; = x * ratio + 1                                         
               y&#39; = y * ratio                                             
______________________________________                                    
 
    
     The zooming module 34 enlarges or shrinks the outline into various resolutions so as to select a suitable outline filling control point in the outline of various resolutions. The zooming method is done according to a coordinate transformation equation so as to transform the point coordinate on the outline into a coordinate of a varying resolution. That is, module 34 enlarges and narrows the contours acquired from the equations shown above into various resolutions, and then locates the appropriate contour filling control point among these contours. 
     The filling control point selecting module is used to select the filling control points. That is, in the interior of the contour a blank point is located which is farthest away from the edge of the contour. This point is considered to be the best filling control point for enlarging or narrowing a character, as this point will not possibly fall outside the contour. This point is further checked to determine if it remains the best filling control point in the character contour at various resolutions after enlarging or narrowing of the character. If it is not the best filling control point at various resolutions, a new filling control point is repeatedly located in the same manner until all of the best filling control point at each resolution is located. The inner/outer outline distinction module is used to identify the inner and outer contour. That is, since some strokes form loops, inner and outer contours occur as shown in FIG. 6(a). As shown, contour A is the outer contour, and contour B is the inner contour. They are distinguished by module 36 in the following manner. 
     Referring to FIG. 6(b), the character area is first entirely filled with 0. Then one contour is taken out and the points contained therein are converted from 1 to 0 or from 0 to 1. The successive contours are then taken out according to the same procedure until all such contours are finished. If 0 is converted to 1, the contour is an outer 1, and otherwise it is an inner 1. Since the previously described frame-surrounding sequence is from the upper side to the lower side and from the left side to the right side, the acquired contour sequence can match their width without error resulting from the wrong sequence. 
     The compressed character vector generating module 32 is used to combine the contour vector direction codes produced by module 33 with the filling control points produced by module 34 to form a Chinese character compression vector 38. 
     The data structure of the compressed character vector is shown in FIG. 4. Each character compression vector takes up one record, which includes the outline vector and the filling control point. The outline vector further includes the total number of points on the outline, the coordinates of the initial points, the segment direction, and the repeating number of the segment direction. The filling control point includes the filling control points of characters for various resolutions. The character compression vector 38 is recorded in the ROM of the character generating sub-system 4, the operation of which is described below. 
     FIG. 3 illustrates the structure of the printed Chinese character realtime generating sub-system 4, which comprises: 
     1. A ROM 5 for storing the compressed Chinese character vector, and for re-generating the character outline and the Chinese character pattern. 
     2. A RAM 6. Upon a Chinese character code and a specified Chinese resolution being put in the printed Chinese character realtime generating sub-system 4, the sub-system 4 can, in accordance with the character code and the resolution, 10, locate the compressed character pattern vector in ROM 5. The character pattern vector is then for generating the dot matrix character pattern outline, which is to be stored in RAM for later processing. Simultaneously, the specific resolution value is also loaded into the RAM 6 so as to enlarge or to compress the outline of a character. 
     3. A coordinate transformation unit 7. The dot matrix character pattern outline in the RAM 6 can be enlarged or shrunk into the character outline of a specific resolution. During the course of enlarging or shrinking, the dot coordinate on the outline is transformed into the corresponding dot coordinate on the enlarged or shrunk outline of a given resolution using the following equations: 
     
         X&#39;=X * r.sub.x                                             (I) 
    
     
         Y&#39;=Y * r.sub.y                                             (II) 
    
     OR 
     
         X&#39;=(X-1) * r.sub.x +1                                      (III) 
    
     
         Y&#39;=(Y-1) * r.sub.y +1                                      (IV) 
    
     in which X and Y stand for the conventional coordinates, X&#39; and Y&#39; stand for the coordinates transformed, r x  stands for the enlarged or shrunk multiple (or times) in the lateral coordinate direction, and r y  stands for the enlarged or shrunk multiple in the longitudinal coordinate direction. The equations for shrinking the character pattern are equations III and IV. Before selecting the equation for enlarging the character pattern, a point on the character outline must be distinguished as to whether it is an inner outline point or an outer outline point so as to determine the moving direction during enlarging. If that point is moving to the right, equation I is used for coordinate transformation; if that point is moving downward, equation II is used; if that point is moving to the left, equation III is used; if that point is moving upward, equation IV is used. Since each of the coordinate transforming equations simply involves a multiplying operation transforming equations simply involves a multiplying operations and an addition operation, only a simple hardware circuit is required. 
     4. An outline filler 8. After a character outline has been enlarged or shrunk into a specific resolution, the outline filling control point must be retrieved from the ROM 5 so as to fill the outline into a Chinese character. According to the present invention, the filling method is to fill the outline from the control point to move rightwards, upwards, leftwards and downwards. The cursor is moved rightwards to fill black points directly to the edge of the outline, then, the cursor is moved one step upwards, or leftwards, or downwards before starting to move rightwards again. In case of being unable to move rightwards, upwards, leftwards, or downwards, the cursor is moved one step backwards from the previous black point, then, the aforesaid steps are repeated. The same filling steps are repeated until the entire outline is filled. After the outline has been filled, the procedure of forming a Chinese character is completed. A Chinese character pattern can then be printed on the printer or displayed through the system bus 9 and the memory buffer 11. 
     FIG. 7 is an illustration of the resultant characters which are generated according to the present invention. 
     Briefly, the system of the present invention can operate automatically, instead of being operated manually, to input a dot matrix Chinese character into a &#34;Chinese character compression sub-system&#34; so as to obtain a compressed character vector, which is then coupled with the circuit board of a PC. The circuit board with a simple hardware circuit can perform the enlargement, the shrinkage, and the outline filling operation so as to obtain a high quality Chinese character. 
     The system according to the present invention can save manpower, time and basic cost so as to output a large number of Chinese character patterns with various styles and various resolutions within a short period of time using circuit board of a PC. The system of the present invention not only can generate various character patterns such as the formal style, the running style, the official style and others, but also can be used in Chinese electronic publishing and Chinese Desktop publishing operations. It is deemed that the present invention can improve and elevate the Chinese computer utilization.