Song posted character generation system based on stroke segments and generation method thereof

By constructing the stroke skeleton and basic stroke segment dataset, using the Bezier curve to generate the stroke skeleton, and performing stroke segment combination and parameter adjustment, the problem of time-consuming and visual consistency of traditional Song-Text font design is solved, and efficient Song-Text font generation is achieved.

CN120279566APending Publication Date: 2025-07-08GUANGZHOU ACADEMY OF FINE ARTS
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202510371504.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-27
Publication Date
2025-07-08

AI Technical Summary

Technical Problem

Traditional Song-Type design relies on manual experience, which is time-consuming and labor-intensive, making it difficult to achieve visual consistency, and the modular pen-tiles combination is difficult to adapt to the geometric characteristics of Song-Type characters, and requires a lot of manual fine-tuning.

Method used

By constructing the stroke skeleton and basic stroke segment datasets of Song-style characters, a Bézier curve is used to generate a brush-shaped frame, combining the origin of the brush segment and the anchor point of the skeleton, combining the stroke segments and parameter adjustments are performed to generate the Song-style characters.

Benefits of technology

It improves the efficiency of Song-style characters design, reduces repetitive labor, and ensures the visual unity and consistency of the characters.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120279566A_ABST
    Figure CN120279566A_ABST
Patent Text Reader

Abstract

The invention provides a stroke segment-based Song poetry generation system and method, and the method comprises the steps: constructing a data set of basic stroke segments of Song poetry strokes and a skeleton, generating a new font through the combined rendering of the skeleton and the stroke segments, and carrying out the adjustment of font parameters, thereby obtaining the required font of Song poetry. Therefore, the font design of a plurality of characters is completed with a small number of basic stroke segments and corresponding skeletons, and the font parameters are adjusted to be standard Song posted characters, so that the development speed of new Song posted character font development is greatly reduced, repeated labor during development of different fonts is avoided, and the font design efficiency is greatly improved. Meanwhile, when the stroke segments are placed, the original points of the stroke segments coincide with the skeleton anchor points of the skeleton, accurate positioning of the positions of the stroke segments on the skeleton is achieved, the problem of generated font dislocation caused by misplacement of the stroke segments is solved, and then the visual uniformity of the font of the Song posted character is guaranteed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of font generation, and in particular to a Song-style font generation system based on stroke segments and a generation method thereof. Background Art

[0002] In the glyph exploration stage, the design of traditional Song fonts is highly dependent on manual experience, and the style features need to be repeatedly scrutinized. The most time-consuming part is undoubtedly the fine-tuning of each character shape. This process requires designers to repeatedly draw a large number of glyph outlines to achieve style matching, especially when dealing with basic strokes such as horizontal, vertical, and folded strokes. Repetitive labor is time-consuming and labor-intensive, and inefficient.

[0003] Existing technologies attempt to generate Chinese characters through modular stroke combinations, but their fixed stroke libraries and static parameters are difficult to adapt to the unique geometric features of Song fonts. Details such as the triangular dot at the end of horizontal strokes and the gradual thickness of vertical strokes still require manual intervention. Designers often need to fine-tune the anchor point coordinates for thousands of characters one by one, which consumes more than 70% of the design cycle. In addition, traditional tools lack a structured control mechanism, and local modifications can easily cause overall disproportion, making it difficult to ensure the visual consistency of the font library.

[0004] Therefore, it is necessary to provide a Song font generation system based on stroke segments and a generation method thereof to solve the above problems. Summary of the invention

[0005] Based on the technical problems in the prior art, the present invention provides a Song-style character generation system based on stroke segments and a generation method thereof.

[0006] A method for generating Song typeface based on stroke segments comprises the following steps: S1: skeleton extraction: extracting the skeleton of Song typeface strokes, generating a stroke skeleton data set, and obtaining skeleton anchor points corresponding to the skeleton; S2: stroke segment extraction: extracting the basic stroke segments of each stroke in Song typeface, and generating a Song typeface basic stroke segment data set; S3: stroke shape combination: first, obtaining the strokes constituting the desired character shape according to the desired character shape, and then obtaining the skeleton of the desired strokes and their skeleton anchor points in the stroke skeleton data set; obtaining the stroke segments required to constitute the desired strokes in the Song typeface basic stroke segment data set, and obtaining the origin of the stroke segments; secondly, combining the stroke segments Place it at the corresponding skeleton anchor point of the skeleton so that the skeleton anchor point coincides with the corresponding stroke origin, and finally combine the stroke segment and the skeleton and render to generate the required strokes; S4: Font generation: obtain the several strokes generated according to the required font in step S3, and combine the generated strokes one by one according to the stroke order of the font to generate the corresponding font, and unify the grayscale of the font; S5: Font parameter adjustment: adjust the parameters of the generated font, and then obtain the Song font of the required font; wherein the parameters include the font width, font height, center of gravity and center palace, up and down tilt, left and right tilt, bold and font size

[0007] Preferably, step S1 constructs a data set of the pen-shaped skeleton by editing the Bezier curve for rendering, specifically:

[0008] Given anchor points (a, b) and (c, d), the formula for constructing a first-order Bezier curve is:

[0009] B1(t)=(1-t)(a,b)+t(c,d), t∈[0,1], t represents the parameterized variable;

[0010] Introducing control points (x1, y1) and (x2, y2), the formula for constructing a third-order Bezier curve is:

[0011] B3(t)=(1-t)3(a,b)+3t(1-t) 2 (x1, y1)+3t 2 (1-t)(x2,y2)+t 3 (c, d);

[0012] In the stroke skeleton data set, each stroke skeleton is formed by connecting at least one of the above two types of curves; by obtaining the stroke skeletons composed of Bezier curves, a stroke skeleton data set is constructed.

[0013] Preferably, in step S2, the Song typeface basic stroke segment data set includes: a horizontal left segment, a horizontal right segment, a vertical upper segment, a vertical lower segment, a folded corner, a vertical hook lower segment, a vertical curved hook right segment, a right dot, a pick dot, a right stroke upper segment and a right stroke lower segment; wherein, the basic stroke segment data set acquisition step is specifically as follows: S21: acquiring strokes of Song typeface of the same font size, including “horizontal”, “vertical”, “vertical hook”, “vertical curved hook”, “horizontal fold”, “left stroke”, “lift”, “right stroke”, and “pick dot”; S22: cutting the strokes “horizontal”, “vertical”, “vertical hook”, “vertical curved hook”, and “horizontal fold” into a starting stroke segment, a middle stroke segment, and a finishing stroke segment in turn, and acquiring the starting stroke segment and the finishing stroke segment of “horizontal”, That is, "horizontal left segment" and "horizontal right segment"; obtain the starting segment and ending segment of "vertical", that is, "vertical upper segment" and "vertical lower segment"; obtain the middle segment of "horizontal fold", that is, "corner"; obtain the ending segments of "vertical hook" and "vertical curved hook", that is, "vertical hook lower segment" and "vertical curved hook right segment"; cut "na" into starting segment and ending segment, and obtain them as "na upper segment" and "na lower segment"; S23: store the obtained segments "horizontal left segment", "horizontal right segment", "vertical upper segment", "vertical lower segment", "corner", "vertical hook lower segment", "vertical curved hook right segment", "right dot", "pick point", "na upper segment" and "na lower segment" to generate the Song font basic segment data set.

[0014] Preferably, in step S2, the section anchor points of the pen segments "horizontal left section", "horizontal right section", "vertical upper section", "vertical lower section", "angle", "vertical hook lower section", "vertical curved hook right section", "right stroke upper section" and "right stroke lower section" are symmetrical along the central axis of their sections, and the sections of the pen segments "horizontal right section" and "horizontal left section" are consistent with the width of the left side section of the pen segment "angle", which are all 2L1; the sections of the pen segments "vertical upper section", "vertical lower section", "vertical hook lower section" and "vertical curved hook right section" are consistent with the width of the bottom side section of the pen segment "angle", which are all 2L2; the section width of the pen segment "right stroke upper section" is consistent with the section width of the pen segment "right stroke lower section", which are all 2L3.

[0015] Preferably, in step S3, the steps for obtaining the origin of each stroke segment are as follows: S301: extracting a number of contour anchor points in the outer contour of each stroke segment, and obtaining the associated control points of each contour anchor point; wherein, the contour anchor points include but are not limited to the section anchor points of each stroke segment, and the associated control points of the section anchor points are consistent with the horizontal coordinates or vertical coordinates of the corresponding section anchor points; S302: respectively obtaining the central axis of the "horizontal left segment", "horizontal right segment", "vertical upper segment", "vertical lower segment", "vertical hook lower segment", "vertical hook right segment", "right stroke upper segment" sections and a contour anchor point of each stroke segment that is farthest from its section, and at the same time obtaining the contour anchor point where the contour anchor point is located A straight line is perpendicular to the corresponding central axis, and the intersection of the central axis and the straight line is the origin of the corresponding segment; S303: obtain the intersection of the horizontal extension lines of any pair of adjacent contour anchor points on any contour on the left side of the segment "right point" or on the left side of the segment "right point", as the origin of the segment "right point"; obtain any contour anchor point of the bottom contour of the segment "picking point" as the origin of the segment "picking point"; obtain the intersection of the central axes of the two sections of the segment "folded corner", as the origin of the segment "folded corner"; obtain the central axis point of the section of the segment "downward stroke" as the origin of the segment "downward stroke".

[0016] Preferably, in the step S3, the pen segments are placed at the corresponding skeleton anchor points of the skeleton, so that the skeleton anchor points coincide with the corresponding pen segment origin points. Finally, the specific steps of combining and rendering the pen segments and the skeleton to generate the required strokes are as follows: S31. Skeleton processing: The skeleton segments between adjacent skeleton anchor points in the skeleton obtained from the stroke skeleton dataset are segmented, and encoded as 0 and 1 according to the processing steps; where 0 means no processing; 1 means converting the segment of the skeleton segment into a vertical line segment of the same length as it; S32. Placing pen segments: On the skeleton anchor points of the skeleton after being segmented in step S31, the pen segment placement processing is performed on each skeleton anchor point one by one, and the placed pen segments are encoded as A, B, C, D, E, F, G, H, I, J, K, and O; where A means placing a "left horizontal segment" at this skeleton anchor point; B means placing a "right horizontal segment" at this skeleton anchor point; C means placing an "upper vertical segment" at this skeleton anchor point; D means placing a "lower vertical segment" at this skeleton anchor point; E means placing a "corner" at this skeleton anchor point; F means placing a "lower vertical hook segment" at this skeleton anchor point; G means placing a "right vertical hook segment" at this skeleton anchor point; H means placing a "right dot" at this skeleton anchor point; I means placing a "lifting dot" at this skeleton anchor point; J means placing an "upper stroke of a right-falling stroke" at this skeleton anchor point; K means placing a "lower stroke of a right-falling stroke" at this skeleton anchor point; O means not placing a pen segment at this skeleton anchor point; the skeleton anchor point coincides with the origin point of the corresponding placed pen segment, and the shape of the pen segment remains unchanged with the orientation of the pen segment section; S33. Changing pen segments: The pen segment shapes are adjusted in sequence according to the placement order of the pen segments in step S32, and encoded as a, b, c, d, e, f, g, h, i, j, and k according to the way of adjusting each pen segment; where a means not processing the pen segment; b means horizontally scaling the pen segment by -1; c means scaling the pen segment as a whole by -1; d means rotating the pen segment clockwise by 90°; e means rotating the pen segment clockwise by arctan[(x p -x p+1 ) / (y p -y p+1 )]; f means horizontally offsetting each contour anchor point of the pen segment by (y - y0)(x p -x p+1 ) / (y p -y p+1 ); g means horizontally offsetting each contour anchor point of the pen segment by (y - y0)(x p -x p-1 ) / (y p -y p-1 ); where (x p ,y p ), (x p-1 ,y p-1 ), (x p+1 ,y p+1) are the coordinates of the skeleton anchor point where the pen segment is located, the previous skeleton anchor point of the skeleton anchor point where the pen segment is located, and the next skeleton anchor point of the skeleton anchor point where the pen segment is located, y is the ordinate of the anchor point on each contour of the pen segment, and y0 is the origin coordinate of the pen segment; the codes h, i, j, k only represent the separate processing of the "right point", "flick point", "lower segment of vertical hook", and "lower segment of na stroke" of the pen segment respectively; h represents rotating the "right point" of the pen segment clockwise by arctan(L HW / L HH ). Where L HW and L HH are the width and height of the "right point" of the pen segment respectively; i means first scaling the "flick point" of the pen segment by β = L TDH / L IH times, points i 1-r and i 1-l are then horizontally scaled by β 0.2 times, points i2 and i3 are vertically offset by 0.5(β - 1)(y i2 - y i3 ), 0.5(1 - β)(y i2 - y i3 ), points i4 and i5 are each horizontally offset by x TD1 - 0.5(x` i4 - x` i5 ), and i 4-l is horizontally offset by 0.5(x` i4 - x` i5 ) - x TD1 . Among them, points i 1-r and i 1-l are the associated control points of point i1; the outer contour of the "flick point" of the pen segment includes the first curve, the second curve, the third curve, the fourth curve, and the fifth curve connected in sequence in the counterclockwise direction, and i1, i2, i3, i4, i5 are the connection points of each curve, that is, the contour anchor points of the "flick point" of the pen segment; and the contour anchor point i1 is the origin of the "flick point" of the pen segment; L TDH and L IH are the skeleton height corresponding to the "flick stroke" and the height of the "flick point" of the pen segment respectively; y i2 and y i3 are the ordinates of point i2 and point i3 before the overall scaling of the "flick point" of the pen segment respectively, and x TD1 is the abscissa of the starting skeleton anchor point of the skeleton corresponding to the "flick point" of the pen segment; x i `4 and x i `5 are the abscissas of point i4 and point i5 after the overall scaling respectively; j means obtaining the intersection point f6 of the horizontal line where point f5 of the "lower segment of vertical hook" of the pen segment is located and the vertical line where point f3 is located, and connecting f3, f4, f5, f6 in sequence to form a new pen segment, and then moving each point by (x f0 - x f5 , -0.5yf5 ), and then rotate counterclockwise by 90°, and finally connect points f3 and f6. Among them, f0 is the origin of the pen segment "lower part of the vertical hook", x f0 , x f5 , y f5 are the abscissa of f0, the abscissa of f5, and the ordinate of f5 respectively; f3, f4, and f5 are the contour anchor points of the pen segment "lower part of the vertical hook". The contour anchor point f3 is the endpoint on the outer contour of the pen segment "lower part of the vertical hook" that is farthest from its tangent plane; the contour anchor point f5 is the contour endpoint on the left side of the central axis of the tangent plane of the pen segment "lower part of the vertical hook" that is farthest from the central axis, and f4 is a contour endpoint between f3 and f5; the origin f0 of the pen segment "lower part of the vertical hook" is the intersection point of the horizontal line of point f3 and the central axis of the tangent plane; k means that when the pen segment set at the previous skeleton anchor point of the skeleton anchor point where the pen segment "lower part of the right-falling stroke" is located is the pen segment "upper part of the right-falling stroke", the tangent plane anchor points k1 and k2 of the pen segment "lower part of the right-falling stroke" are respectively offset to the tangent plane anchor points j1 and j2 of the pen segment "upper part of the right-falling stroke"; Step S34, supplement pen shape: generate pen shape supplements between two adjacent pen segments or between an adjacent pen segment and a skeleton anchor point without a set pen segment; the processing methods for generating pen shape supplements are encoded as 2, 3, 4, 5, 6, 7; 2 means not to perform pen shape supplement generation processing; 3 means connecting the tangent plane of the pen segment at this skeleton anchor point to the tangent plane of the pen segment at the next skeleton anchor point; 4 means extending the tangent plane of the pen segment at this skeleton anchor point to the previous skeleton anchor point; 5 means extending the tangent plane of the pen segment at this skeleton anchor point to the next skeleton anchor point; 6 means generating a rectangle with a height of 2L1 with this skeleton anchor point as the left center and the next skeleton anchor point as the right center; 7 means generating a rectangle with a width of 2L2 with this skeleton anchor point as the upper center and the next skeleton anchor point as the lower center. S35, change pen shape: perform segmented change processing on the pen shape according to the skeleton segmentation after step S31, and then generate the required strokes; according to the change processing method, it is encoded as 8, 9, X; 8 means that the pen shape of this segment of the skeleton does not change; 9 means performing thickness change processing on the pen shape of this segment of the skeleton; X means performing bending change on the pen shape of this segment of the skeleton.

[0017] Preferably, in step S35, the steps for performing thickness change processing on the pen shape of this segment of the skeleton are: S351: Resample the contour of the generated pen shape and obtain the coordinates (x, y) of each sampling point; S352: By adjusting the abscissa of each sampling point, perform thickness change on the pen shape according to the skeleton segmentation after step S31, and obtain the new abscissa x s = x·f[(y - y min ) / (y max - y min )], where y max , y min are the maximum value of the ordinate and the minimum value of the ordinate of each sampling point before change respectively, and f represents the mapping rule.

[0018] Preferably, in step S35, the steps of performing bending transformation on the pen shape of this section of the skeleton are as follows: S353: Using the coordinates (x, y) of each point on the pen shape contour obtained in step S351 respectively, sample the skeleton of this section before step S31, and obtain the normal N(α) and coordinates P(α) of the skeleton sampling points, where α = (y - y min ) / (y max - y min ), S354: After resampling the pen shape contour and the skeleton respectively, bend the pen shape along the skeleton of this section. The coordinates after the pen shape is bent are (x c , y c ) = xN(α) + P(α).

[0019] Preferably, in step S5, the centroid transformation function is y4 = (y3 + 0.5) 1-n - 0.5, the center transformation function is (x4, y4) = (0.5sign(x3)|2x3| 1-m , 0.5sign(y3)|2y3| 1-m ), where n is the centroid parameter and m is the center parameter; x4 and y4 are the new horizontal and vertical coordinates of the glyph skeleton anchor point, and x3 and y3 are the initial horizontal and vertical coordinates of the glyph skeleton anchor point; the skew transformation function is (x6, y6) = (py5 + x5, qx5 + y5), where p and q are the left - right skew and up - down skew coefficients respectively, x6 and y6 are the new horizontal and vertical coordinates of the glyph contour anchor point, and x5 and y5 are the initial horizontal and vertical coordinates of the glyph contour anchor point.

[0020] The present invention also provides a font generation system based on pen segments, including a font generation module, and the font generation module is used to execute a method for generating Song typeface characters based on pen segments as described in any one of the above.

[0021] The beneficial effects of the present invention are as follows: The present invention provides a Song typeface character generation system based on pen segments and its generation method. By constructing a dataset of basic pen segments and skeletons of Song typeface strokes, and generating new glyphs through the combined rendering of the skeleton and pen segments, and adjusting the glyph parameters to obtain the Song typeface glyphs of the required glyphs, it is possible to complete the glyph design of multiple characters with a small number of basic pen segments and corresponding skeletons, and adjust the glyph parameters of the characters to standard Song typeface characters, thereby greatly reducing the development speed during the development of new Song typeface glyphs, avoiding repetitive labor during the development of different glyphs, and greatly improving the glyph design efficiency. At the same time, when placing the pen segments, by making the origin of the pen segment coincide with the skeleton anchor point of the skeleton, the position positioning of the pen segment on the skeleton is realized, which is beneficial to solving the problem of glyph misalignment caused by the misplacement of the pen segment, and thus ensuring the visual unity of the generated Song typeface glyphs. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] Figure 1 Schematic flowchart of a method for generating Song typeface based on pen segments provided by the present invention;

[0023] Figure 2 Schematic diagram of the skeletons of each stroke, their skeleton anchor points, and the control points of the skeleton anchor points in the stroke skeleton dataset provided by the present invention;

[0024] Figure 3 Schematic diagram of the cutting of basic strokes of Song typeface provided by the present invention;

[0025] Figure 4 Schematic diagram of the shapes and coordinates of each pen segment in the basic pen segment dataset of Song typeface provided by the present invention;

[0026] Figure 5 Schematic diagram of the coordinates of the origin of each pen segment, the section anchor point, and the associated control points of the section anchor point provided by the present invention;

[0027] Figure 6 Schematic diagram of the encoding for generating glyphs by combining pen segments and skeletons through rendering provided by the present invention;

[0028] Figure 7 Schematic diagram of the adjustment process j of the "lower part of the vertical hook" pen segment provided by the present invention;

[0029] Figure 8 Schematic diagram of the process of generating glyphs by combining some pen segments and skeletons through rendering provided by the present invention. Detailed implementation mode

[0030] To further introduce the present invention in detail, the following will be described in conjunction with the accompanying drawings. It should be specifically pointed out that the embodiments described below are only a part of the embodiments of the present invention, rather than all of the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the scope of protection of the present invention.

[0031] Refer to Figure 1 As shown, a method for generating Song typeface based on pen segments includes the following steps:

[0032] Step S1: Skeleton extraction: Extract the skeletons of the strokes of the Song typeface, generate a stroke skeleton dataset, and obtain the skeleton anchor points corresponding to the skeletons. In this embodiment, the stroke skeleton dataset and the skeleton anchor points and skeleton control points corresponding to the skeletons can be referred to Figure 2 As shown.

[0033] Among them, step S1 constructs a dataset of pen shape skeletons by means of rendering through editing Bezier curves, and the shape of the skeleton can be adjusted by adjusting the parameters of the Bezier curve. Specifically:

[0034] Given anchor points (a, b) and (c, d), the formula for constructing a first-order Bézier curve is:

[0035] B1(t) = (1 - t)(a, b) + t(c, d), where t ∈ [0, 1] and t represents the parameterization variable;

[0036] By introducing control points (x1, y1) and (x2, y2), the formula for constructing a third-order Bézier curve is:

[0037] B3(t) = (1 - t)^3(a, b) + 3t(1 - t) 2 (x1, y1) + 3t 2 (1 - t)(x2, y2) + t 3 (c, d);

[0038] In the stroke skeleton dataset, each stroke skeleton is formed by connecting at least one of the above two types of curves; by obtaining the stroke skeletons composed of Bézier curves, a stroke skeleton dataset is constructed.

[0039] By obtaining the stroke skeletons composed of Bézier curves, a set of skeleton datasets for common Chinese characters' strokes is constructed. At this time, the anchor points (a, b) and (c, d) are the skeleton anchor points of the skeleton, and the control points (x1, y1) and (x2, y2) are the control points corresponding to the skeleton anchor points.

[0040] Step S2: Pen segment extraction: Extract the basic pen segments of each stroke in Song typeface characters to generate a basic pen segment dataset for Song typeface characters.

[0041] Reference Figure 3 and Figure 4 As shown, in step S2, the basic pen segment dataset for Song typeface characters includes: left horizontal segment, right horizontal segment, upper vertical segment, lower vertical segment, corner fold, lower vertical hook segment, right segment of vertical with a hooked end, right dot, upward dot, upper segment of the falling stroke, and lower segment of the falling stroke.

[0042] Among them, the specific steps for obtaining the basic pen segment dataset are as follows:

[0043] Step S21: Obtain the strokes of Song typeface characters of the same font size, including "horizontal", "vertical", "vertical hook", "vertical with a hooked end", "horizontal fold", "left-falling stroke", "rising stroke", "falling stroke", "right dot", and "upward dot". By obtaining the strokes of Song typeface characters of the same font size, it is beneficial to subsequent obtaining of the unified size and style of pen segments, facilitating the subsequent selection and splicing of pen segments.

[0044] Step S22: Cut the strokes of "horizontal", "vertical", "vertical hook", "vertical turning hook", and "horizontal fold" into a starting segment, a middle segment, and an ending segment in sequence. Obtain the starting segment and the ending segment of the "horizontal" stroke, which are the "left horizontal segment" and the "right horizontal segment"; obtain the starting segment and the ending segment of the "vertical" stroke, which are the "upper vertical segment" and the "lower vertical segment"; obtain the middle segment of the "horizontal fold", which is the "folding angle"; obtain the ending segments of the "vertical hook" and the "vertical turning hook", which are the "lower vertical hook segment" and the "right vertical turning hook segment"; cut the "oblique stroke" into a starting segment and an ending segment, and obtain the "upper oblique stroke segment" and the "lower oblique stroke segment".

[0045] Step S23: Store and generate the basic pen segment dataset of the Song typeface by storing the obtained pen segments of "left horizontal segment", "right horizontal segment", "upper vertical segment", "lower vertical segment", "folding angle", "lower vertical hook segment", "right vertical turning hook segment", "right dot", "rising dot", "upper oblique stroke segment", and "lower oblique stroke segment".

[0046] By extracting pen segments from the strokes of common Song typefaces of the same font size, obtain the key basic pen segments required to construct most of the strokes of the Song typeface, and provide a pen segment dataset as a basis for the composition of subsequent new glyphs.

[0047] Among them, in step S2, the section anchor points of the pen segments of "left horizontal segment", "right horizontal segment", "upper vertical segment", "lower vertical segment", "folding angle", "lower vertical hook segment", "right vertical turning hook segment", "upper oblique stroke segment", and "lower oblique stroke segment" are all symmetric along the central axis of their sections, that is, the connection line of the section anchor points of the above pen segments is perpendicular to the central axis of their sections. At this time, the sections of the pen segments are perpendicular or parallel to the horizontal plane. The widths of the sections of the pen segments of "right horizontal segment" and "left horizontal segment" are the same as the width of the left section of the pen segment of "folding angle", both being 2L1; the widths of the sections of the pen segments of "upper vertical segment", "lower vertical segment", "lower vertical hook segment", and "right vertical turning hook segment" are the same as the width of the bottom section of the pen segment of "folding angle", both being 2L2; the widths of the sections of the pen segments of "upper oblique stroke segment" and "lower oblique stroke segment" are the same, both being 2L3.

[0048] The relative consistency of the section widths is convenient for improving the efficiency of subsequent combination and splicing between pen segments, and is also conducive to improving the parameter adjustment efficiency of the generated glyphs and the rapid unification of font styles.

[0049] Step S3: Pen form combination: First, obtain the strokes that make up the glyph according to the required glyph, and then obtain the skeletons and their skeleton anchor points of the required strokes in the stroke skeleton dataset; and obtain the pen segments required to form the required strokes in the basic pen segment dataset of the Song typeface, and obtain the origin points of the pen segments; secondly, place the pen segments at the corresponding skeleton anchor points of the skeleton and make the skeleton anchor points coincide with the corresponding pen segment origin points, and finally combine and render the pen segments and the skeleton to generate the required strokes.

[0050] Specifically, in step S3, the steps for obtaining the origin points of each pen segment are as follows:

[0051] Step S301: extracting a number of contour anchor points from the outer contour of each stroke segment, and obtaining associated control points of each contour anchor point.

[0052] The contour anchor points include but are not limited to the section anchor points of each segment section, and the associated control points of the section anchor points are consistent with the horizontal coordinates or vertical coordinates of the corresponding section anchor points. By adjusting the contour anchor points and their associated control points, the shape of the segment contour can be adjusted.

[0053] The outer contour of the pen segment can be regarded as multiple first-order or third-order Bezier curves connected in sequence. The contour anchor point between the section curve of the pen segment and other curves has one associated control point, and the contour anchor point between other curves has two associated control points. By adjusting the associated control points, the shape of the curve can be controlled, and then the outer contour of the pen segment can be controlled.

[0054] Step S302: respectively obtain the central axis of the section of "horizontal left segment", "horizontal right segment", "vertical upper segment", "vertical lower segment", "vertical hook lower segment", "vertical hook right segment", "right stroke upper segment" and a contour anchor point of each stroke segment farthest from its section, and simultaneously obtain a straight line where the contour anchor point is located, and the straight line is perpendicular to the corresponding central axis, and the intersection of the central axis and the straight line is the origin of the corresponding stroke segment. Figure 4 As shown, in this embodiment, the origins of the "horizontal left section", "horizontal right section", "vertical upper section", "vertical lower section", "vertical hook lower section", "vertical hook right section", "right point", "pick point", "narrowing point upper section" and "narrowing point lower section" are respectively Figure 4 The corresponding characters are as shown in the figure: “a0, b0, c0, d0, f0, g0, j0”.

[0055] Step S303: Get the intersection of the horizontal extension lines of any pair of adjacent contour anchor points on any contour of the left side of the segment "right point" or on the left side of the segment "right point" as the origin of the segment "right point"; get any contour anchor point of the bottom contour of the segment "pick point" as the origin of the segment "pick point"; get the intersection of the central axis of the two sections of the segment "corner" as the origin of the segment "corner"; get the central axis point of the section of the segment "narrowing down" as the origin of the segment "narrowing down". Figure 4 As shown, in this embodiment, the origins of the "right point", "pick point", "corner" and "lower stroke" are respectively Figure 4 The corresponding characters are as shown in the figure: “h0, i0, e0, k0”.

[0056] By defining the origin of each segment, when the origin of each segment coincides with the skeleton anchor point, the segment as a whole is in a more suitable position for the skeleton anchor point, which is beneficial to improving the accuracy of placing the segment on the skeleton and improving the efficiency of subsequent glyph combination.

[0057] Reference Figure 4 As shown, in this embodiment, the section anchor points of the pen segments "horizontal left segment", "horizontal right segment", "vertical upper segment", "vertical lower segment", "corner", "vertical hook lower segment", "vertical hook right segment", "right dot", "pick dot", "upper stroke of the wave", and "lower stroke of the wave" are respectively "a1, a2, b1, b2, c1, c2, d1, d2, e1, e2, f1, f2, g1, g2, h1, h2, i1, i2, j1, j2, k1, k2", and the associated control points corresponding to these section anchor points are "a 1-l 、a 2-l 、b 1-l 、b 2-l 、c 1-l 、c 2-l 、d 1-l 、d 2-l 、e 1-l 、e 2-l 、f 1-l 、f 2-l 、g 1-l 、g 2-l 、h 1-l 、h 2-l 、i 1-l 、i 2-l 、j 1-l 、j 2-l 、k 1-l 、k 2-l ”, and for the specific section anchor points and the coordinates of the corresponding associated control points, please refer to Figure 5 as shown.

[0058] Reference Figure 8 As shown, in step S3, the specific steps of placing the pen segment at the corresponding skeleton anchor point of the skeleton so that the skeleton anchor point coincides with the origin of the corresponding pen segment, and finally combining and rendering the pen segment and the skeleton to generate the required stroke are as follows:

[0059] Step S31, skeleton processing: Segment the skeleton segments between adjacent skeleton anchor points in the skeleton obtained from the stroke skeleton dataset, and encode them as 0 and 1 according to the processing steps; where 0 means no processing; 1 means converting the segment of the skeleton segment into a vertical line segment of the same length as it.

[0060] Step S32, placing the pen segment: On the skeleton anchor points of the skeleton after the segmentation processing in step S31, perform the pen segment placement processing on each skeleton anchor point one by one, and encode the placed pen segments as A, B, C, D, E, F, G, H, I, J, K, and O.

[0061] Among them, A represents placing the "left horizontal segment" at this skeleton anchor point; B represents placing the "right horizontal segment" at this skeleton anchor point; C represents placing the "upper vertical segment" at this skeleton anchor point; D represents placing the "lower vertical segment" at this skeleton anchor point; E represents placing the "corner" at this skeleton anchor point; F represents placing the "lower vertical hook segment" at this skeleton anchor point; G represents placing the "right vertical hook segment" at this skeleton anchor point; H represents placing the "right dot" at this skeleton anchor point; I represents placing the "flick dot" at this skeleton anchor point; J represents placing the "upper stroke of the wave" at this skeleton anchor point; K represents placing the "lower stroke of the wave" at this skeleton anchor point; O represents not placing a pen segment at this skeleton anchor point; the origin of the skeleton anchor point coincides with the origin of the corresponding placed pen segment, and the shape of the pen segment remains unchanged with the orientation of the pen segment section.

[0062] Step S33, varying the pen segment: Adjust the shape of the pen segments in sequence according to the placement order in step S32, and encode them as a, b, c, d, e, f, g, h, i, j, and k according to the way of adjusting each pen segment.

[0063] Among them, a represents not processing the pen segment; b represents horizontally scaling the pen segment by -1, that is, multiplying the abscissa of the contour anchor point of the pen segment by -1 and keeping the ordinate unchanged to achieve horizontal mirror flipping; c represents scaling the pen segment as a whole by -1, that is, performing a central symmetry flip of the pen segment as a whole; d represents rotating the pen segment clockwise by 90°; e represents rotating the pen segment clockwise by arctan[(x p -x p+1 ) / (y p -y p+1 )], that is, calculating the slope through the coordinate difference of adjacent skeleton anchor points and then finding the arctangent to obtain the rotation angle to achieve adaptive rotation.

[0064] f represents horizontally offsetting each contour anchor point of the pen segment by (y - y0)(x p -x p+1 ) / (y p -y p+1 );g represents horizontally offsetting each contour anchor point of the pen segment by (y - y0)(x p -x p-1 ) / (y p -y p-1 );Among them, (x p ,y p ), (x p-1 ,y p-1 ), (x p+1 ,y p+1 ) are the coordinates of the skeleton anchor point where the pen segment is located, the previous skeleton anchor point of the skeleton anchor point where the pen segment is located, and the next skeleton anchor point of the skeleton anchor point where the pen segment is located respectively, y is the ordinate of each contour upper anchor point of the pen segment, and y0 is the origin coordinate of the pen segment.

[0065] Codes h, i, j, and k only represent the separate processing of the stroke segments "right dot", "pick-up dot", "vertical hook lower segment" and "horizontal stroke lower segment" respectively.

[0066] Specifically, h means rotating the right point of the segment clockwise by arctan(L HW / L HH ). Where L HW , L HH are the width and height of the “right point” of the segment respectively; i means first scaling the “pick point” of the segment by β = L TDH / L IH Times, click i 1-r 、i 1-l Then scale horizontally β 0.2 times, points i2 and i3 are longitudinally offset by 0.5(β-1)(y i2 -y i3 )、0.5(1-β)(y i2 -y i3 ), points i4 and i5 are laterally offset by x TD1 -0.5(x` i4 -x` i5 ),i 4-l Lateral offset

[0067] 0.5(x` i4 -x` i5 )-x TD1 .

[0068] Among them, point i 1-r 、i 1-l is the associated control point of point i1; the outer contour of the segment "pick point" includes the first curve, the second curve, the third curve, the fourth curve and the fifth curve connected in sequence in the counterclockwise direction, i1, i2, i3, i4, i5 are the connection points of each curve, that is, the contour anchor point of the segment "pick point"; and the contour anchor point i1 coincides with the origin of the segment "pick point", which is regarded as the origin of the segment "pick point"; L TDH , L IH The height of the skeleton corresponding to the stroke "pick-up point" and the height of the segment "pick-up point" are respectively; i2 ,y i3 They are the vertical coordinates of point i2 and point i3 before the overall scaling of the pen segment "pick point", x TD1 x is the horizontal coordinate of the starting skeleton anchor point of the skeleton corresponding to the pen segment "pick point"; i `4.x i `5 are the horizontal coordinates of points i4 and i5 after overall scaling.

[0069] Let j denote obtaining the intersection point f6 of the horizontal line where the point f5 of the "lower part of the vertical hook" pen segment is located and the vertical line where the point f3 is located, and then connecting f3, f4, f5, and f6 in sequence to form a new pen segment. Then, move each point by (x f0 -x f5 , -0.5y f5 ), and then rotate it counterclockwise by 90°. Finally, connect the points f3 and f6. The operation process is as shown in the reference Figure 7 as shown

[0070] Among them, f0 is the origin of the "lower part of the vertical hook" pen segment, x f0 , x f5 , y f5 are the abscissa of f0, the abscissa of f5, and the ordinate of f5 respectively; f3, f4, and f5 are the contour anchor points of the "lower part of the vertical hook" pen segment. The contour anchor points of the "lower part of the vertical hook" pen segment also include its section anchor points f1 and f2. The contour anchor point f3 is the endpoint on the outer contour of the "lower part of the vertical hook" pen segment that is farthest from its section; the contour anchor point f5 is the contour endpoint on the left side of the section axis of the "lower part of the vertical hook" pen segment that is farthest from the axis, and f4 is a contour endpoint of the "lower part of the vertical hook" pen segment between f3 and f5. The origin f0 of the "lower part of the vertical hook" pen segment is the intersection point of the horizontal line of point f3 and the section axis of the "lower part of the vertical hook" pen segment

[0071] Let k denote that when the pen segment set at the previous skeleton anchor point of the skeleton anchor point where the "lower part of the right-falling stroke" is located is the "upper part of the right-falling stroke", the section anchor points k1 and k2 of the "lower part of the right-falling stroke" are respectively offset to the section anchor points j1 and j2 of the "upper part of the right-falling stroke"

[0072] Step S34, supplement pen shapes: Generate pen shape supplements between two adjacent pen segments or between an adjacent pen segment and a skeleton anchor point without a set pen segment; the processing methods for generating pen shape supplements are encoded as 2, 3, 4, 5, 6, and 7

[0073] Specifically, 2 means not performing the processing of generating pen shape supplements; 3 means connecting the pen segment section at this skeleton anchor point to the pen segment section at the next skeleton anchor point; 4 means extending the pen segment section at this skeleton anchor point to the previous skeleton anchor point; 5 means extending the pen segment section at this skeleton anchor point to the next skeleton anchor point; 6 means generating a rectangle with a height of 2L1 with this skeleton anchor point as the left center and the next skeleton anchor point as the right center; 7 means generating a rectangle with a width of 2L2 with this skeleton anchor point as the upper center and the next skeleton anchor point as the lower center

[0074] S35, vary pen shapes: Perform segmented variation processing on the pen shapes according to the skeleton segmentation after step S31, and then generate the required strokes

[0075] Specifically, according to the variation processing method, the encodings are 8, 9, X; 8 indicates that the pen shape of this section of the skeleton remains unchanged; 9 indicates that the thickness of the pen shape of this section of the skeleton is changed; X indicates that the pen shape of this section of the skeleton is bent.

[0076] Among them, in step S35, the steps for changing the thickness of the pen shape of this section of the skeleton are as follows:

[0077] Step S351: Resample the contour of the generated pen shape and obtain the coordinates (x, y) of each sampling point.

[0078] Step S352: By adjusting the abscissa of each sampling point, the thickness of the pen shape is changed according to the skeleton segmentation after step S31, and a new abscissa x s = x·f[(y - y min ) / (y max - y min )], where y max , y min are respectively the maximum value and the minimum value of the ordinate of each sampling point before the change, and f represents the mapping rule.

[0079] In step S35, the steps for bending the pen shape of this section of the skeleton are as follows:

[0080] S353: Respectively use the coordinates (x, y) of each point of the pen shape contour obtained in step S351 to sample this section of the skeleton before step S31, and obtain the normal N(α) and coordinates P(α) of the skeleton sampling points, where α = (y - y min ) / (y max - y min ), y max , y min are respectively the maximum value and the minimum value of the ordinate after resampling the pen shape contour;

[0081] S354: After resampling the pen shape contour and the skeleton respectively, bend the pen shape along this section of the skeleton, and the coordinates after the pen shape is bent are (x c , y c ) = xN(α) + P(α).

[0082] For example, taking the process of changing the pen segment of the "vertical fold" stroke as an example, its encoding reference Figure 6 can be known as 0 - 0; C - E - B; e - (c - g) - a; 3 - 3 - 2; 8 - 8 respectively; then this encoding indicates that the process of generating the "vertical fold" stroke is as follows:

[0083] First, in the skeleton processing stage, the two skeleton segments corresponding to the "vertical fold" in the skeleton are not straightened. Second, in the pen segment placement stage, the "upper vertical segment", "corner", and "right horizontal segment" are respectively placed on the three skeleton anchor points corresponding to the "vertical fold" in the skeleton, so that the origin of each pen segment coincides with the corresponding skeleton anchor point. Then, in the pen segment transformation stage, the "upper vertical segment" is encoded with e, that is, the pen segment "upper vertical segment" is rotated clockwise by arctan[(x p -x p+1 ) / (y p -y p+1 )]. At this time, (x p ,y p ) and (x p+1 ,y p+1 ) are the coordinates of the skeleton anchor point where the pen segment "upper vertical segment" is located and the next skeleton anchor point of the skeleton anchor point where the pen segment "upper vertical segment" is located respectively, and y is the ordinate of the anchor points on each contour of the pen segment "upper vertical segment". Then, the "corner" is encoded with c and g successively. First, the whole pen segment "corner" is scaled by -1, that is, the whole pen segment "corner" is symmetrically flipped about the center. Then, the horizontal offset of each contour anchor point of the flipped pen segment "corner" is (y - y0)(x p -x p-1 ) / (y p -y p-1 ); At this time, (x p ,y p ) and (x p-1 ,y p-1 ) are the coordinates of the skeleton anchor point where the pen segment "corner" is located and the previous skeleton anchor point of the skeleton anchor point where the pen segment "corner" is located respectively, y is the ordinate of the anchor points on each contour of the pen segment "corner", and y0 is the origin coordinate of the pen segment "corner"; At this time, the two tangent planes of the "corner" respectively correspond to the pen segment "upper vertical segment" and the pen segment "right horizontal segment". Again, in the pen shape supplement stage, the "upper vertical segment" is encoded with 3, the "corner" is encoded with 3, and the "right horizontal segment" is encoded with 2; that is, the tangent plane of the "upper vertical segment" is connected to one tangent plane of the "corner", and the other tangent plane of the "corner" is connected to the tangent plane of the "right horizontal segment" to form the stroke "vertical fold". Finally, in the pen shape transformation stage, the encoding 8 is executed for both pen shapes formed between skeleton anchor points, and the pen shapes formed on the two skeletons are not transformed, completing the construction of the stroke "vertical fold".

[0084] S4: Glyph generation: Obtain several strokes generated according to the required glyph in step S3, and combine the generated strokes one by one in the stroke order of the glyph to generate the corresponding glyph, and unify the gray level of the glyph. Unifying the gray level can ensure that the glyph maintains a consistent appearance under different backgrounds and lighting conditions, thereby improving its readability and aesthetics.

[0085] S5: Glyph parameter adjustment: Adjust the parameters of the generated glyph to obtain the Song typeface glyph of the desired glyph. Among them, the parameters include the width, height, center of gravity, and middle palace of the glyph, up and down inclination, left and right inclination, bold type, and font size. Through glyph parameter adjustment, not only can the generated glyph be adjusted to the standard Song typeface form, but also the glyph can be adjusted according to other requirements or adjusted to other similar fonts.

[0086] Among them, in the step S5, the center of gravity transformation function is y4 = (y3 + 0.5) 1-n - 0.5, and the middle palace transformation function is (x4, y4) = (0.5sign(x3)|2x3| 1-m , 0.5sign(y3)|2y3| 1-m ), where n is the center of gravity parameter and m is the middle palace parameter; x4 and y4 are the new horizontal and vertical coordinates of the glyph skeleton anchor point, and x3 and y3 are the initial horizontal and vertical coordinates of the glyph skeleton anchor point; the inclination transformation function is (x6, y6) = (py5 + x5, qx5 + y5), where p and q are the left and right inclination coefficients and up and down inclination coefficients respectively, x6 and y6 are the new horizontal and vertical coordinates of the glyph contour anchor point, and x5 and y5 are the initial horizontal and vertical coordinates of the glyph contour anchor point.

[0087] A Song typeface method based on pen segments provided by the present invention effectively reduces the range of glyph adjustment through the pen segment reuse method, concentrates the key points of glyph changes, and at the same time maintains the consistency of design features in the entire font library; at the same time, the strokes are disassembled into two independent levels of skeleton and pen segments. The skeleton bears the overall trend, and the pen segments provide local features, realizing the decoupled design of the glyph structure and stroke elements, and can be easily adjusted independently and maintain relative stability between each other. The parametric adjustment further simplifies the unified adjustment of glyphs and is convenient for quickly previewing different design variants.

[0088] At the same time, by establishing a hierarchical control strategy of skeleton processing, pen segment placement, pen segment change, pen form supplement, and pen form change, and encoding the control process step by step, after quickly selecting the pen segments and skeletons according to the desired glyph, the corresponding glyph can be quickly generated by selecting the corresponding encoding combination, and the glyph is adjusted to the corresponding font, greatly improving the efficiency of font generation.

[0089] The present invention also provides a font generation system based on pen segments, including a font generation module, and the font generation module is used to execute a Song typeface generation method based on pen segments as described in any one of the above, and can quickly select the corresponding pen segment and skeleton combination according to the desired glyph to render and generate strokes, and after forming the glyph, generate a standard Song typeface or other similar fonts by adjusting parameters.

[0090] The preferred embodiments of the present invention disclosed above are only used to help illustrate the present invention and do not limit the invention to the specific embodiments described. Obviously, according to the content of this specification, other modifications and changes can be made. The embodiments selected and specifically described in this specification are for better explaining the principles and practical applications of the present invention, so that those skilled in the art can well understand and utilize the present invention. It is not a limitation of the present invention, and any simply deformed solution of the present invention belongs to the protection scope of the present invention.

Claims

1. A method for generating Song typeface characters based on pen segments, characterized in that, The following steps are involved: S1: Skeleton extraction: extract the skeleton of Songti strokes, generate a stroke skeleton dataset, and obtain the skeleton anchor points corresponding to the skeleton; S2: Segment extraction: extract the basic stroke segments of each stroke in Song typeface and generate a Song typeface basic stroke segment dataset; S3: Stroke combination: First, the strokes constituting the required glyph are obtained according to the required glyph, and then the skeleton of the required strokes and its skeleton anchor points are obtained from the stroke skeleton dataset; and the segments required to constitute the required strokes are obtained from the Songti basic stroke segment dataset, and the origin of the segments is obtained; secondly, the segments are placed at the corresponding skeleton anchor points of the skeleton, so that the skeleton anchor points coincide with the corresponding segment origins, and finally the segments and skeletons are combined and rendered to generate the required strokes; S4: Font generation: obtaining a number of strokes generated according to the required font in step S3, and combining the generated strokes one by one according to the stroke sequence constituting the font to generate a corresponding font, and unifying the grayscale of the font; S5: Font parameter adjustment: adjust the parameters of the generated font to obtain the Song font of the required font; wherein the parameters include the font width, height, center of gravity and center, up and down tilt, left and right tilt, bold and font size.

2. The method for generating Song typeface based on pen segments according to claim 1, wherein Step S1 constructs a data set of a pen-shaped skeleton by editing a Bezier curve for rendering, specifically: Given anchor points (a, b) and (c, d), the formula for constructing a first-order Bezier curve is: B1(t)=(1-t)(a,b)+t(c,d), t∈[0,1], t represents the parameterized variable; Introducing control points (x1, y1) and (x2, y2), the formula for constructing a third-order Bezier curve is: B3(t) = (1 - t)^3(a, b) + 3t(1 - t) 2 (x1, y1) + 3t 2 (1 - t)(x2, y2) + t 3 (c, d); In the stroke skeleton data set, each stroke skeleton is formed by connecting at least one of the above two types of curves; by obtaining the stroke skeletons composed of Bezier curves, a stroke skeleton data set is constructed.

3. A method for generating Song typeface based on pen segments according to claim 1, characterized in that, In step S2, the Song font basic stroke segment data set includes: a horizontal left segment, a horizontal right segment, a vertical upper segment, a vertical lower segment, a folded corner, a vertical hook lower segment, a vertical hook right segment, a right dot, a pick dot, a right stroke upper segment, and a right stroke lower segment; The steps for obtaining the basic stroke segment dataset are as follows: S21: obtaining the strokes of Song font of the same font size, including "horizontal", "vertical", "vertical hook", "vertical hook", "horizontal fold", "left stroke", "lift", "right stroke", and "tip dot"; S22, cutting the strokes "horizontal", "vertical", "vertical hook", "vertical hook", and "horizontal fold" into a starting segment, a middle segment, and an ending segment in sequence, obtaining the starting segment and the ending segment of the "horizontal", namely, the "horizontal left segment" and the "horizontal right segment"; obtaining the starting segment and the ending segment of the "vertical", namely, the "vertical upper segment" and the "vertical lower segment"; Get the middle section of the "horizontal fold", which is the "corner"; get the ending sections of the "vertical hook" and "vertical curved hook", which are the "vertical hook lower section" and "vertical curved hook right section"; cut the "na" into the starting section and the ending section, which are the "na upper section" and "na lower section"; S23: Store the obtained pen segments "horizontal left segment", "horizontal right segment", "vertical upper segment", "vertical lower segment", "corner", "vertical hook lower segment", "vertical hook right segment", "right dot", "lifting dot", "upper segment of the wave" and "lower segment of the wave" to generate the basic pen segment dataset of the Song typeface characters.

4. A method for generating Song typeface characters based on pen segments according to claim 3, characterized in that, In step S2, the section anchor points of the pen segments "horizontal left segment", "horizontal right segment", "vertical upper segment", "vertical lower segment", "corner", "vertical hook lower segment", "vertical hook right segment", "upper segment of the wave" and "lower segment of the wave" are all symmetric along the central axis of their sections. The sections of the pen segments "horizontal right segment" and "horizontal left segment" are both of the same width as the left section of the pen segment "corner", which is 2L1. The sections of the pen segments "vertical upper segment", "vertical lower segment", "vertical hook lower segment" and "vertical hook right segment" are all of the same width as the bottom section of the pen segment "corner", which is 2L2. The section width of the pen segment "upper segment of the wave" is the same as the section width of the pen segment "lower segment of the wave", both of which are 2L3.

5. A method for generating Song typeface based on pen segments according to claim 4, characterized in that, In step S3, the steps for obtaining the origin of each pen segment are as follows: S301: Extract a number of contour anchor points from the outer contour of each pen segment, and obtain the associated control points of each contour anchor point. Among them, the contour anchor points include but are not limited to the section anchor points of each pen segment, and the associated control points of the section anchor points have the same abscissa or ordinate as the corresponding section anchor points. S302: Respectively obtain the central axis of the sections of the pen segments "horizontal left segment", "horizontal right segment", "vertical upper segment", "vertical lower segment", "vertical hook lower segment", "vertical hook right segment" and "upper segment of the wave" and the contour anchor point that is the farthest from its section among each pen segment. At the same time, obtain a straight line on which the contour anchor point is located, and this straight line is perpendicular to the corresponding central axis. The intersection point of the central axis and this straight line is the origin of the corresponding pen segment. S303: Obtain the intersection point of any contour on the left contour of the pen segment "right dot" or the horizontal extension line of any pair of adjacent contour anchor points located on the left contour of the pen segment "right dot" as the origin of the pen segment "right dot". Obtain any contour anchor point on the bottom contour of the pen segment "lifting dot" as the origin of the pen segment "lifting dot". Obtain the intersection point of the central axes of the two sections of the pen segment "corner" as the origin of the pen segment "corner". Obtain the central axis point of the section of the pen segment "lower segment of the wave" as the origin of the pen segment "lower segment of the wave".

6. A method for generating Song typeface characters based on pen segments according to claim 4, characterized in that In step S3, the specific steps for placing the pen segment at the corresponding skeleton anchor point of the skeleton so that the skeleton anchor point coincides with the corresponding origin of the pen segment, and finally combining and rendering the pen segment and the skeleton to generate the required stroke are as follows: S31. Skeleton processing: Segment the skeleton segments between adjacent skeleton anchor points in the skeleton obtained from the stroke skeleton dataset, and encode them as 0 and 1 according to the processing steps. Among them, 0 means no processing; 1 means converting the segment of the skeleton segment into a vertical line segment of the same length as it. S32. Placing pen segments: On the skeleton anchor points of the skeleton after the segmentation process in step S31, perform pen segment placement processing on each skeleton anchor point one by one, and encode the placed pen segments as A, B, C, D, E, F, G, H, I, J, K, and O; where A represents placing a "horizontal left segment" at this skeleton anchor point; B represents placing a "horizontal right segment" at this skeleton anchor point; C represents placing a "vertical upper segment" at this skeleton anchor point; D represents placing a "vertical lower segment" at this skeleton anchor point; E represents placing a "corner" at this skeleton anchor point; F represents placing a "lower part of a vertical hook" at this skeleton anchor point; G represents placing a "right segment of a vertical hook with a bend" at this skeleton anchor point; H represents placing a "right dot" at this skeleton anchor point; I represents placing a "lifting dot" at this skeleton anchor point; J represents placing an "upper part of a stroke with a downward curve" at this skeleton anchor point; K represents placing a "lower part of a stroke with a downward curve" at this skeleton anchor point; O represents not placing a pen segment at this skeleton anchor point; the origin of the skeleton anchor point coincides with the origin of the corresponding placed pen segment, and the shape of the pen segment remains unchanged with the orientation of the pen segment section. S33. Changing pen segments: Adjust the shapes of the pen segments in step S32 in sequence according to the placement order, and encode the ways of adjusting each pen segment as a, b, c, d, e, f, g, h, i, j, and k. Among them, a means not processing the pen segment; b means horizontally scaling the pen segment by -1; c means scaling the whole pen segment by -1; d means rotating the pen segment clockwise by 90°; e means rotating the pen segment clockwise by arctan[(x p -x p+1 ) / (y p -y p+1 )]; f means horizontally offsetting each contour anchor point of the pen segment by (y - y0)(x p -x p+1 ) / (y p -y p+1 )]; g means horizontally offsetting each contour anchor point of the pen segment by (y - y0)(x p -x p-1 ) / (y p -y p-1 ); among them, (x p , y p ), (x p-1 , y p-1 ), (x p+1 , y p+1 ) are the coordinates of the skeleton anchor point where the pen segment is located, the previous skeleton anchor point of the skeleton anchor point where the pen segment is located, and the next skeleton anchor point of the skeleton anchor point where the pen segment is located respectively, y is the ordinate of the anchor point on each contour of the pen segment, and y0 is the origin coordinate of the pen segment; The encodings h, i, j, and k only represent the individual processing of the pen segments "right dot", "lifting dot", "lower part of a vertical hook", and "lower part of a stroke with a downward curve" respectively. h represents rotating the pen segment "right dot" clockwise by arctan(L HW / L HH ), where L HW and L HH are the width and height of the pen segment "right dot" respectively; Let i denote that the pen segment "dot picking" is first scaled by β = L TDH / L IH times, and point i 1-r 、i 1-l is then horizontally scaled by β 0.2 times. Points i2 and i3 are vertically offset by 0.5(β - 1)(y i2 -y i3 ), 0.5(1 - β)(y i2 -y i3 ), respectively. Points i4 and i5 are each horizontally offset by x TD1 -0.5(x` i4 -x` i5 ), and i 4-l is horizontally offset by 0.5(x` i4 -x` i5 ) - x TD1 ; Among them, point i 1-r and i 1-l are the associated control points of point i1; the outer contour of the pen segment "picking point" includes a first curve, a second curve, a third curve, a fourth curve, and a fifth curve connected in sequence in the counterclockwise direction. i1, i2, i3, i4, and i5 are the connection points of each curve, that is, the contour anchor points of the pen segment "picking point"; and the contour anchor point i1 is the origin of the pen segment "picking point"; L TDH and L IH are the skeleton height corresponding to the stroke "picking point" and the height of the pen segment "picking point" respectively; y i2 and y i3 are the ordinates of point i2 and point i3 before the overall scaling of the pen segment "picking point" respectively, and x TD1 is the abscissa of the starting skeleton anchor point of the skeleton corresponding to the pen segment "picking point"; x` i4 and x` i5 are the abscissas of point i4 and i5 after the overall scaling respectively. Let j represent obtaining the intersection point f6 of the horizontal line where the point f5 of the "lower part of the vertical hook" of the pen segment is located and the vertical line where the point f3 is located, and sequentially connecting f3, f4, f5, and f6 as a new pen segment. Then move each point by (x f0 -x f5 , -0.5y f5 ), then rotate it counterclockwise by 90°, and finally connect the points f3 and f6; Among them, f0 is the origin of the pen segment "lower part of the vertical hook", x f0 , x f5 , y f5 are the abscissa of f0, the abscissa of f5, and the ordinate of f5 respectively; f3, f4, and f5 are the contour anchor points of the pen segment "lower part of the vertical hook". The contour anchor point f3 is the end point on the outer contour of the pen segment "lower part of the vertical hook" that is farthest from its tangent plane; the contour anchor point f5 is the contour end point on the left side of the central axis of the tangent plane of the pen segment "lower part of the vertical hook" that is farthest from the central axis, and f4 is a contour end point on the outer contour of the pen segment "lower part of the vertical hook" located between f3 and f5; the origin f0 of the pen segment "lower part of the vertical hook" is the intersection point of the horizontal line of point f3 and the central axis of the tangent plane; k represents that when the pen segment set at the previous skeleton anchor point of the skeleton anchor point where the "lower part of a stroke with a downward curve" is located is the "upper part of a stroke with a downward curve", the section anchor points k1 and k2 of the pen segment "lower part of a stroke with a downward curve" are respectively offset to the section anchor points j1 and j2 of the pen segment "upper part of a stroke with a downward curve". Step S34. Supplementing pen shapes: Generate pen shape supplements between two adjacent pen segments or between an adjacent pen segment and a skeleton anchor point without a set pen segment; the processing methods for generating pen shape supplements are encoded as 2, 3, 4, 5, 6, 7. 2 represents not performing pen shape supplement generation processing; 3 represents connecting the pen segment section at this skeleton anchor point to the pen segment section at the next skeleton anchor point; 4 represents extending the pen segment section at this skeleton anchor point to the previous skeleton anchor point; 5 represents extending the pen segment section at this skeleton anchor point to the next skeleton anchor point; 6 represents generating a rectangle with a height of 2L1 with this skeleton anchor point as the left center and the next skeleton anchor point as the right center; 7 represents generating a rectangle with a width of 2L2 with this skeleton anchor point as the upper center and the next skeleton anchor point as the lower center. S35. Changing pen shapes: Perform segmented change processing on the pen shapes according to the skeleton segmentation after step S31 to generate the required strokes; according to the change processing methods, encode as 8, 9, X; 8 represents that the pen shape of this section of the skeleton does not undergo change processing; 9 represents performing thickness change processing on the pen shape of this section of the skeleton; X represents performing bending change on the pen shape of this section of the skeleton.

7. A method for generating Song typeface characters based on pen segments according to claim 6, characterized in that, In step S35, the steps for performing thickness change processing on the pen shape of this section of the skeleton are as follows: S351: Resample the contour of the pen shape generated in step S34 and obtain the coordinates (x, y) of each sampling point. S352: By adjusting the abscissas of each sampling point, vary the thickness of the pen shape for the skeleton segments after step S31 to obtain the new abscissa x s = x · f[(y - y min ) / (y max - y min )], where y max , y min are respectively the maximum value of the ordinate and the minimum value of the ordinate of each sampling point before the change, and f represents the mapping rule.

8. A method for generating Song typeface characters based on pen segments according to claim 7, characterized in that In step S35, the steps for performing bending change processing on the pen shape of this section of the skeleton are as follows: S353: Respectively, using the coordinates (x, y) of each point on the pen-shaped contour obtained in step S351, sample the section of the skeleton before step S31, and obtain the normal N(α) and coordinates P(α) of the skeleton sampling points, where α = (y - y min ) / (y max - y min ); S354: After resampling the pen shape contour and the skeleton respectively, bend the pen shape along this section of the skeleton. After bending, the coordinates of the pen shape are (x c , y c ) = xN(α) + P(α).

9. A method for generating Song typeface characters based on pen segments according to claim 1, characterized in that, In the step S5, the barycenter transformation function is y4 = (y3 + 0.5) 1-n - 0.5, and the center transformation function is (x4, y4) = (0.5sign(x3)|2x3| 1-m , 0.5sign(y3)|2y3| 1-m ), where n is the barycenter parameter and m is the center parameter; x4 and y4 are the new horizontal and vertical coordinates of the glyph skeleton anchor point, and x3 and y3 are the initial horizontal and vertical coordinates of the glyph skeleton anchor point; the skew transformation function is (x6, y6) = (py5 + x5, qx5 + y5), where p and q are the left - right skew and up - down skew coefficients respectively, and x6 and y6 are the new horizontal and vertical coordinates of the glyph outline anchor point, and x5 and y5 are the initial horizontal and vertical coordinates of the glyph outline anchor point.

10. A Song typeface generation system based on pen segments, characterized in that, It includes a font generation module, and the font generation module is used to execute a stroke-based Song typeface generation method as described in any one of claims 1-9.

Citation Information

Patent Citations

  • Beautifying method used for handwritten Chinese character

    CN101639942A

  • Stroke segmentation modeling-based handwritten Chinese character Lishu beautifying method

    CN101697234A

  • Intelligent Chinese font design method for taking strokes as basic components and system thereof

    CN102662922A

  • Soft pen handwriting drawing method

    CN115826823A