The automatic generation of Chinese outline font based on stroke extraction

Embed Size (px)

Text of The automatic generation of Chinese outline font based on stroke extraction

  • Vol.10 No.1 J. of Comput. Sci. & Technol. January 1995

    The Automat ic Generat ion of Ch inese Out l ine Font Based on St roke Ext rac t ion

    Ma Xiaohu (--~/~, ~)

    Department of Mathematics, Xuzhou Teachers" College, Xuzhou 221009

    Pan Zhigeng (i~ ~ )~)

    State Key Laboratory of CAD & CG, Zhejiang University, Hangzhou 310027

    Zhang Fuyan (~ ~ ~)

    Department of Computer Science, Nanjing University, Nanjing 210008

    Received January 27, 1993; revised January 24, 1994.

    Abstract

    A new method to obtain spline outline description of Chinese font based on stroke extraction is presented. It has two primary advantages: (1) the quality of Chinese output is greatly improved; (2) the memory requirement is reduced. The method for stroke extraction is discussed in detail and experimental results are presented.

    Keywords : Outline font, Bdzier curve, concave point, convex point, stroke extraction.

    1 In t roduct ion

    Today high quality fonts in most instances (e.g. METAFONT [11, PostScript [2l) are produced from outline definitions of their glyphs. These outline definitions are constructed using straight line segments, circular arcs, conic sections, B+zier curves, or any combination of these. Outline description of Chinese font is an important method for implementing high quality, low cost Chinese character output system [a'4]. To get outline description of character bitmap (also as dot-matrix), we have to obtain a set of line segments or curve segments which describe the outline. The type of segment may be conic spline, Beta-spline, B-spline or Bdzier cubic curve [2-s]. Chinese character is composed of various strokes. The average stroke number is about 15, so it will probably occur that one stroke intersects or attaches to another stroke. The usual method for generating outline description is to treat the Chinese character just as bitmap[ 3] (ignoring the fact that the Cblnese character consists of strokes), so one stroke may be divided into several curve segments (more than necessary, see Fig.l). If characters are scaled up just by scaling up the coordinates of all control points, an acute angle in the original font may result in a smooth angle [4]. In addition, the up part and the down part or the left part and the right part of one identical stroke may lack consistence (see Fig.l).

  • No. 1 Automatic Generation of Chinese Outline Font 43

    To solve this problem, [4] presented a method. The method can preserve the original shape with minimal distortion, but it has two shortcomings. First, it only solves the problem partially, distortion still exists and in some special case (for example, when the scale factor is very large) distortion may be obvious. Second, the memory requirement to store additional control parameters is quite significant. In this paper, we present a new method based on stroke extraction. The basic idea is that we let a stroke be a stroke. The method has three advantages. First, the consistence of a stroke is held. When Chinese character is zoomed with large factor, the method can preserve the original shape without distortion. Second, the outline font file needs less memory space to store control points. Third, the me- thod lays the foundation for analysing the characteristic and calligraphy rules of Chinese character.

    In Section 2, stroke extraction tech- nique is described. In Section 3, curve fitting method for outline segment is presented. In Section 4, we draw a con- clusion and some experimental results are given to demonstrate good perfor- mance of our method.

    iiiiii iiiii

    (b) " - . :'.:::

    .:.:: "~' (a) ,~176176176

    (a) Several curve segments of one stroke. (b) Incons is tence of one stroke.

    Fig. 1

    2 St roke Ext ract ion

    2.1 Some Def in i t ions

    For the convenience of describing techniques for stroke extraction, we first intro- duce some definitions. Let Pl(i = O, 1, 2, . . . , n - 1) be discrete dots that compose the contour of the corresponding character, then we have:

    Def in i t ion 1. DIRECTED LINE SEGMENT PI-P-~2 has direction from Pt to P2.

    Def in i t ion 2. K-IN DIRECTION of point Pi is the direction of directed line segment Pi-k Pi.

    Def in i t ion 3. K-OUT DIRECTION of point Pi is the direction of the directed line segment PiP~+k ~.

    Def in i t ion 4. K-CURVATURE of poin~ Pi is the direction difference between K- IN DIRECTION of Pi and K-OUT DIRECTION of Pi. The idea of K-CURVATURE is similar to that of protractor D].

    For discrete point on the contour of Chinese character dot-matrix, 1-CURVATURE, 2-CURVATURE and 3-CURVATURE can be easily computed by the diagram in Fig.2. In the figure, we assume that the K-IN DIRECTION of a given point is horizontal, from left to right. If K-OUT DIRECTION is the directions shown in Fig.2, then the K-CURVATURE of the point Pi (where 0 _< i < n, and k = 1, 2, 3) is the value along the corresponding direction..

  • 44 J. of Comput. Sci. & Technol. Vol. 10

    2 6\ 3~ I 7~ 4 0 8 - -

    _7/ --3 --I

    -2 _6/

    5 3

    \ \1 / /

    / / l \ \ -5 -4 -3

    /2 j l

    - -0

    ~--i

    9 \ 10\ ~\

    - i t - " - ~] -lO/S _9 /

    ./ \\

    4 3

    /11 f

    - -0

    \ '-4 -3

    1-Curvature 2-Curvature 3-Curvature Fig.2. Computation diagram.

    It is noted that: (1) The addition and subtraction in the above definitions are modulo N opera-

    tion. (2) The distance and curvature value are discrete. The angle around clockwise

    is negative, and the angle around counter-clockwise is positive. When tracing outer- contour, we use counter-clockwise direction; when tracing the inner-contour we use clockwise direction.

    Since the original information of Chinese characters is in the form of dot-matrix, we must determine which points belong to one stroke. To do so, we introduce other two concepts: convex point and concave point. It is very difficult to give out the exact definition of these two concepts, so we just describe the meaning and illustrate them with figures.

    As stated in Section 1, Chinese character is composed of many strokes, and each stroke may intersect or attach to another stroke. The position where strokes intersect, the position where the end of one stroke attaches to that of another stroke, and the position of the inner side of turning stroke corner will have concave points. The k-curvature (k = 1, 2, 3) of these points are negative. The endpoint of a stroke and the position of the outer side of the turning stroke corner may have convex points. The k-curvature (k -- 1, 2, 3) of these points are positive. The concepts of convex and concave point not only are the basis of stroke extraction, but also indicate the features and relation of strokes.

    For the convenience of stroke extraction, we stipulate that concave points appear in pair. According to the precedence relation of the paired concave points, the first traced concave point is called the first concavepoint, referred to as CONCAVE l, and the second traced concave point is called the second concave point, referred to as CONCAVE 2. There are three situations (shown in Fig.3) in total (adjacent (a); coincide(b); interval(c)).

    Def in i t ion 5 (CONCAVE POINT COR_R.ELATION). For a CONCAVE 1 point, if there is a CONCAvE l which meets the following requirements, we will say that the CONCAVE i is related to the CONCA VEI:

    (1) CONCAVE 2 is on the same boundary of one stroke along with the specified

  • No. 1 Automatic Generation of Chinese Outline Font 45

    CONCAVE 1 .

    (2) The direction of CONCAVE 2 is consistent with that of CONCAVE 1, or the direction of CONCAVE e is contrary to that of CONCAVE 1.

    (3) Distance between CONCAVE 1 and CONCAVE e is less than a predefined constant.

    ~176176176176

    a " x

    c;,, *" 9 oo ~ ~ ~176176

    :':::.9 i ~ 9

    . * : 9149 :.'::9

    . 9 9176149

    ~149149149149 9176 o,~ o 9

    ~ 9 ~ i

    ~

    OONOAW.'.. . i......":::: . oo , 9 . 9

    ' " ** ' 9149149149 ~149149

    coNcAvz: / i l ~ ~149176149149176149149176149149176176149149176149176149149149

    ~149149149 o ,o 9176149176176149176

    o 9149149176149149149176 9149176149149149176176149176 ~176149176176176149176176149176149149176149149176149149 ~ ~149176149149

    * ~149149

    o~176176176 oo ,~ o~176176176176176176 ~

    " : ..... " "" :~- : ~CO I~ C k'v'~-' ;:

    9 ooo ,o

    C~) (,h)

    Fig.3. Concave point. Fig.4. Demonstration of relation between CONCAVE 1 and CONCAVE 2.

    The reason why we introduce the concepts of convex point and concave point is that we want to use the following facts in stroke extraction.

    (1) If two strokes intersect, when tracing stroke boundary of one of the two strokes, the situation must be that: go into the boundary of the other stroke from one CONCAVE 1, and go back into the previous boundary from CONCAVE 2 which is related to CONCAVE 1 (see Fig.4(a)).

    (2) CONCAVE 1 near the inner side of the turning stroke corner and CONCAVE 1 near the position where two strokes attach have no related CONCAVE 2 point (see Fig.4(b)).

    2.2 Se lec t ion o f Concave Po in t and Convex Po in t

    For the selection of concave point and convex point, we use some rules to mul- tiscan the points on character contour.

    (1) Concave Point Determination First Scan: Conditions: 1) Be candidate concave point (where 2-curvature is less than or equal to -1) . 2) In a set of n continuous candidate concave points (where n > 2), there are at

    least 2 points whose 2-curvature is less than -2 . Select two points whose 2-curvature is smaller as the concave points.

    Second Scan