A method and system for quantitative analysis and visual interactive correction of Chinese character fonts

By employing morphological closing operations, connected component analysis, and flood filling algorithms, combined with image moment algorithms and font metric parameters, the problem of refined extraction of internal negative space in the quantitative analysis of Chinese fonts was solved. This achieved unified quantization and visual balance optimization across fonts, enhancing the scientific rigor and aesthetics of font design.

CN122113840BActive Publication Date: 2026-07-17HUNAN NORMAL UNIVERSITY

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
HUNAN NORMAL UNIVERSITY
Filing Date
2026-04-28
Publication Date
2026-07-17

AI Technical Summary

Technical Problem

Existing technologies lack sophisticated methods for extracting internal negative space in the quantitative analysis of Chinese character fonts, making it difficult to quantify visual balance and aesthetics. Furthermore, the lack of unified analysis standards between different fonts makes it difficult to achieve efficient and objective cross-font comparisons.

Method used

By employing morphological closing operations, connected component analysis, and flood filling algorithms, combined with image moment algorithms and font metric parameters, we extract character valley and character cavity regions, and fine-tune the visual center through a visual interactive interface to achieve unified quantization and visual balance optimization across fonts.

Benefits of technology

It achieves precise quantification and stable extraction of the negative space inside Chinese characters, provides a unified analysis standard across fonts, improves the scientificity and aesthetics of font design, and supports large-scale quantitative comparison and optimization of multiple fonts.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122113840B_ABST
    Figure CN122113840B_ABST
Patent Text Reader

Abstract

This invention discloses a method and system for quantitative analysis and visual interactive correction of Chinese character fonts, belonging to the technical field of Chinese character font quantitative analysis and processing. The method includes: firstly, acquiring the font file and parsing the measurement parameters; calculating the physical centroid using an image moment algorithm; and performing coordinate normalization mapping by combining the number of font units and baseline sinking, establishing a unified and comparable quantitative benchmark across fonts. Then, extracting completely closed character valley regions through morphological closing operations and connected component analysis, and constructing a convex hull mask combined with a flood filling algorithm to identify semi-open and concave character cavity regions. Furthermore, generating an initial visual center based on the font style and providing a visual interactive correction interface, recording the correction offset. This invention effectively solves the problem of unstable internal space determination caused by stroke gaps and structural complexity, achieving an organic combination of objective quantitative data and subjective visual perception, and meeting the needs for efficient, objective, and traceable quantitative comparison of large-scale multi-font fonts.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of quantitative analysis and processing technology of Chinese character fonts, and in particular to a method and system for quantitative analysis and visual interactive correction of Chinese character fonts. Background Technology

[0002] In the research and application of modern Chinese character processing, font design, analysis, and optimization are important directions. With the development of information technology, especially the rapid progress in big data, artificial intelligence, and computer vision, how to accurately analyze, quantify, and effectively correct Chinese fonts has become an important issue for improving font design quality, user experience, and cross-platform consistency.

[0003] Existing quantitative analysis and interactive visualization correction technologies for Chinese character fonts mainly consist of three steps: data preparation, quantitative analysis, and interactive visualization correction. First, in the data preparation stage, a font library to be analyzed is collected, and the glyphs are standardized to ensure data consistency and comparability. Next, in the quantitative analysis stage, vector graphics processing and image analysis techniques are used to quantitatively analyze the font's stroke thickness, shape, symmetry, structural proportions, and other characteristics, obtaining a series of quantifiable indicators. These quantitative indicators provide a scientific basis for subsequent design optimization. In the interactive visualization correction stage, the quantitative analysis results are displayed through a graphical interface, allowing for intuitive viewing of font features and fine-tuning of the glyphs using interactive tools, with real-time feedback on the correction effect. Finally, the corrected font can be exported as a standard font file to meet the needs of different platforms and devices.

[0004] For example, Chinese invention patent CN113515919B discloses a method and system for generating Chinese TrueType fonts, including: reading any Chinese character from a standard Chinese font library to obtain the outline data of the standard Chinese font; processing the outline data of the standard Chinese font based on a trigonometric function height calculation method to obtain the outline data of a new font; writing the outline data of the new Chinese font back to the GlyphTable of the standard Chinese font library; processing the outline data of all standard Chinese fonts in the standard Chinese font library into the outline data of the new font, forming a new GlyphTable based on the outline data of all new fonts, and synchronizing the new GlyphTable to the Chinese font file table; adding a signature file to the Chinese font file table to generate a Chinese TrueType font file.

[0005] However, in the process of implementing the inventive technical solution in the embodiments of this application, it was found that the above-mentioned technology has at least the following technical problems:

[0006] The visual beauty and transparency of Chinese characters depend not only on the physical strokes but also, to a large extent, on the "negative space" within the character's form. Due to the high complexity of Chinese character structure, its interior contains both completely enclosed areas surrounded by strokes and semi-open concave areas with significantly different geometric shapes. These two types of spaces have drastically different effects on the black-and-white visual balance of the font. However, existing font analysis tools mainly focus on analyzing the outer contour paths of the character, lacking automated and refined methods for extracting the internal negative space. On the one hand, the objectively existing tiny gaps between Chinese character strokes, as well as the drastic changes in stroke thickness and complex interweaving structures under different character weights, make the judgment of the closure of the internal space extremely unstable. Conventional simple threshold segmentation or basic connected component analysis methods are prone to breakage or misjudgment in spatial connectivity determination. On the other hand, existing technologies often can only handle simple closed areas, making it difficult to accurately distinguish and stably quantify complex semi-open concave structures. These technological bottlenecks have resulted in a long-standing lack of objective, stable, and reproducible quantitative measurement methods for the proportion and quantity of internal spatial structures in Chinese characters, making it difficult to meet the needs of large-scale, multi-font, efficient, objective, and traceable quantitative comparisons. Summary of the Invention

[0007] To address the technical problems in existing technologies for quantitative analysis of Chinese character fonts, such as the lack of unified comparability of cross-font structural indicators and the difficulty in accurately quantifying and distinguishing complex internal negative spaces, which leads to analysis results that are difficult to adapt to the needs of visual perception correction, this invention provides a method and system for quantitative analysis and interactive visualization correction of Chinese character fonts. The technical solution is as follows:

[0008] On the one hand, a method for quantitative analysis and visual interactive correction of Chinese character fonts is provided. This method includes: acquiring the font file and character set to be analyzed; parsing the font file to extract font metric parameters, obtaining glyph data corresponding to each character in the character set and constructing a glyph bounding box, and performing pixel-based rendering on an off-screen canvas to obtain pixel data. The font metric parameters include at least the number of font units and baseline sinking. Based on the pixel data, the physical centroid coordinates of the glyphs are calculated using an image moment algorithm, and the physical centroid coordinates are mapped to a preset standard coordinate system using the number of font units and baseline sinking to obtain normalized centroid coordinates. Morphological closing operations and connected component analysis are performed on the pixel data to extract glyph bounding box boundaries that are not touched. The completely enclosed internal space is designated as the valley region; a convex hull mask of the character's outer contour is constructed, and a flood filling algorithm is used to distinguish the external background from the internal blank space. Within the convex hull mask, pixels marked as external background and not belonging to the valley region are identified as the cavity region; based on the font style recognition result, a preset offset is applied to the normalized centroid coordinates to obtain the initial visual center, and in response to the user's interactive correction operation triggered on the visualization interface, the initial visual center is fine-tuned to obtain the corrected visual center; the quantitative analysis results, including the normalized centroid coordinates, the corrected visual center, the valley region, and the cavity region, are output and displayed on the visualization interface, and the correction offset generated by the fine-tuning is recorded in the cache.

[0009] On the other hand, a system for quantitative analysis and visual interactive correction of Chinese character fonts is provided, including: a font file acquisition module, a font file parsing module, a centroid coordinate calculation module, a character valley region extraction module, a character cavity region recognition module, a visual center correction module, and a quantitative result output module; the font file acquisition module is used to acquire the font file to be analyzed and the character set; the font file parsing module is used to parse the font file to extract font measurement parameters, obtain the glyph data corresponding to each character in the character set and construct the glyph bounding box, and perform pixel rendering on an off-screen canvas to obtain pixel data, the font measurement parameters at least include the number of font units and the baseline sinking amount; the centroid coordinate calculation module is used to calculate the physical centroid coordinates of the glyph based on the pixel data using the image moment algorithm, and map the physical centroid coordinates to a preset standard coordinate system using the number of font units and the baseline sinking amount to obtain normalized centroid coordinates; the character valley region extraction module... The system comprises four modules: a block module for performing morphological closing operations and connected component analysis on pixel data to extract completely enclosed internal spaces that do not touch the bounding box of the character as the valley region; a cavity region recognition module for constructing a convex hull mask of the outer contour of the character, using a flood filling algorithm to distinguish between the external background and the internal blank space, and identifying pixels marked as external background and not belonging to the valley region as cavity regions within the convex hull mask; a visual center correction module for applying a preset offset to the normalized centroid coordinates based on the font style recognition results to obtain the initial visual center, and fine-tuning the initial visual center in response to user-triggered interactive correction operations on the visualization interface to obtain the corrected visual center; and a quantization result output module for outputting and displaying the quantization analysis results, including the normalized centroid coordinates, the corrected visual center, the valley region, and the cavity region, in the visualization interface, and recording the correction offset generated by the fine-tuning in the cache.

[0010] The beneficial effects of the technical solutions provided in the embodiments of the present invention include at least the following:

[0011] Compared to existing technologies, this invention achieves significant improvements in the analysis and visual optimization of complex character structures. Existing technologies primarily focus on the analysis of the outer contours of characters, lacking effective modeling methods for internal negative spaces. They typically rely on simple threshold segmentation or basic connected component analysis, leading to issues such as misjudgment of spatial connectivity or unstable segmentation when stroke gaps are subtle, character weight variations are significant, or structural interweaving is complex. This invention, by introducing a collaborative processing mechanism combining morphological closing operations, connected component analysis, and flood filling, can stably identify closed and semi-open concave regions within characters, achieving precise differentiation between different types of negative spaces such as "character valleys" and "character cavities," thereby significantly improving the accuracy and robustness of internal space extraction.

[0012] Furthermore, this invention calculates the physical centroid of the glyphs and maps it to a unified standard coordinate system using font measurement parameters to obtain normalized centroid coordinates, thus providing a unified measurement benchmark for the structural features of different fonts and glyphs. Compared to existing technologies that lack a unified reference system and struggle with cross-font comparisons, this invention effectively improves the standardization and comparability of the analysis results, enabling objective quantitative analysis across large-scale fonts.

[0013] Furthermore, in the process of determining the visual center, this invention introduces an offset model based on font style to generate an initial visual center, and combines this with a visual interactive interface to achieve manual fine-tuning and correction. Unlike existing technologies that rely on static algorithms or human experience, this invention achieves a combination of "automatic calculation + interactive correction," ensuring that the determination of the visual center is both algorithmically consistent and takes into account the differences in human visual perception, thereby significantly improving the visual balance and aesthetics of the font.

[0014] Meanwhile, this invention can uniformly quantify and output multi-dimensional structural features such as character valley regions, character cavity regions, and visual centers, and record offset data generated by user interaction corrections, achieving traceability and reusability of analysis results. Compared with the problems of scattered analysis processes and difficult-to-reproduce results in existing technologies, this invention significantly improves processing efficiency and data consistency while ensuring analysis accuracy, and is suitable for batch processing of multiple fonts and subsequent optimization applications.

[0015] In summary, this invention effectively overcomes the limitations of existing technologies through its innovative negative space analysis technology, cross-font unified quantification standards, dynamic visual correction, and interactive functions. It provides a more accurate, flexible, and efficient tool for the analysis, optimization, and design of Chinese fonts, making this invention significantly technologically advanced and valuable in the field of font design. Attached Figure Description

[0016] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0017] Figure 1 A flowchart illustrating a method for quantitative analysis and visual interactive correction of Chinese character fonts provided in this application embodiment;

[0018] Figure 2 This application provides an overall architecture diagram of a method for quantitative analysis and visual interactive correction of Chinese character fonts.

[0019] Figure 3This is a schematic diagram of the structure of a Chinese character font quantitative analysis and visualization interactive correction system provided in an embodiment of this application. Detailed Implementation

[0020] Embodiments of the present disclosure will now be described in more detail with reference to the accompanying drawings. While some embodiments of the present disclosure are shown in the drawings, it should be understood that embodiments of the present disclosure may be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of the present disclosure.

[0021] It should be understood that the accompanying drawings and embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure. In the description of the embodiments of this disclosure, the term "comprising" and similar terms should be understood as open-ended inclusion, i.e., "including but not limited to". The term "based on" should be understood as "at least partially based on". The term "one embodiment" or "this embodiment" should be understood as "at least one embodiment". The terms "first", "second", etc., may refer to different or the same objects.

[0022] To make the technical problems, technical solutions and advantages of the present invention clearer, a detailed description will be given below in conjunction with the accompanying drawings and specific embodiments.

[0023] In the field of Chinese character font design and layout, the visual aesthetics and transparency of a font depend not only on the shape and direction of the strokes, but also, to a large extent, on the "negative space" created by the white space within the character. The balanced distribution of this black and white space is one of the core elements determining the quality of a font. However, due to the high complexity of Chinese character structures, their internal spatial forms vary greatly. They include both completely enclosed areas (i.e., "character valleys") and semi-open, concave areas with significantly different geometric shapes (i.e., "character cavities"). These two types of spaces have drastically different effects on the black and white visual balance and the stability of the font's center of gravity, and must be treated differently.

[0024] Current font analysis techniques primarily focus on the analysis of the outer contours of glyphs, lacking effective means for extracting and quantifying the internal negative space. Traditional methods, such as simple threshold segmentation or basic connected component analysis, are prone to problems such as connectivity breaks, unstable spatial recognition, or misjudgments when dealing with minute gaps, complex interweaving, or semi-open concave regions. Furthermore, existing technologies lack unified analytical standards, making it difficult to directly compare structural indicators between different fonts or glyphs, thus failing to meet the needs of large-scale, multi-font, and cross-font quantitative analysis. In addition, the determination of the visual center usually relies on human experience or static algorithms, making it difficult to account for the visual perception differences between different fonts, resulting in low design optimization efficiency and unreproducible results.

[0025] Therefore, there is an urgent need for a technical method that can accurately and stably quantify the negative space structure inside Chinese characters, achieve a unified analysis standard across fonts, and support visual interactive correction of the visual center, in order to solve the core problems existing in the quantitative analysis of Chinese fonts. This is not only of great significance for improving the scientific and aesthetic aspects of font design, but also provides reliable technical support for digital typesetting, font optimization, and batch font processing.

[0026] Firstly, such as Figure 1 The diagram shown is a flowchart of a Chinese character font quantification analysis and visualization interactive correction method provided in an embodiment of this application. (Refer to...) Figure 1 The first step of this method, which is a quantitative analysis and visual interactive correction method for Chinese character fonts, is to obtain the font file and character set to be analyzed. This step ensures the integrity and accuracy of the font data, lays the foundation for subsequent analysis, and provides the character set and related font parameters required for the analysis.

[0027] It should be noted that, in this embodiment, obtaining the font file to be analyzed specifically refers to loading the binary data file of the target font through a file system interface or a network interface. The font file format includes, but is not limited to, standard font formats such as OpenTypeFont (.otf). The character set refers to the range of Chinese characters to be analyzed, which can be obtained in the following ways: a predefined set: calling the system's built-in character encoding standard set (such as GB2312, GBK, or commonly used 3500 characters); a custom set: receiving a specific character list specified by the user through an input interface (such as a text box or configuration file); or dynamically generated: automatically generating a test character sequence based on analysis requirements. The system parses the loaded font file into a font object in memory and iterates through each character encoding (Unicode code point) in the character set, preparing for subsequent processing.

[0028] The second step of this method for quantitative analysis and visual interactive correction of Chinese character fonts specifically involves: parsing the font file to extract font metric parameters, obtaining the glyph data corresponding to each character in the character set and constructing the glyph bounding box, and then performing pixel-based rendering on an off-screen canvas to obtain pixel data. The font metric parameters include at least the number of font units and the baseline drop. Through precise pixel-based rendering, the details of the glyphs can be accurately captured, avoiding the coarse estimations found in traditional methods. This step provides high-precision data support for subsequent physical center of gravity calculations and spatial analysis.

[0029] It is worth noting that, firstly, during the parsing phase, a font parsing engine (such as an open-source font parsing library based on JavaScript) is used to read the header information table of the font file. Specifically, this includes: (1) Extracting the number of font units: Reading the global metric information of the font file to obtain the unitsPerEm value, which is the number of grid units in the font design space. This parameter is the bridge connecting physical pixels and the font design coordinate system, and is used to normalize the pixel coordinates to the font design coordinate system later. (2) Extracting the baseline sinking amount: Reading the horizontal layout table of the font to obtain the Descender value, which is the vertical distance from the baseline to the bottom of the font design framework. This parameter is used to determine the positioning reference of the glyph in the vertical direction.

[0030] Secondly, the character data is acquired and the bounding box is constructed. For each character in the character set, the character index in the font file is looked up through the character encoding to obtain the corresponding vector contour data. The vector contour data is usually composed of a series of contour lines and Bézier curve control points. Based on the acquired vector data, the minimum bounding rectangle of the character, i.e., the character bounding box, is calculated. The bounding box parameters include the minimum x-coordinate, minimum y-coordinate, maximum x-coordinate, and maximum y-coordinate, reflecting the physical extent of the character in two-dimensional space.

[0031] Next, off-screen canvas rendering and pixel data acquisition are performed. To convert vector outlines into a computable discrete pixel matrix, this embodiment employs off-screen rendering technology. Specifically: an invisible canvas object is created in memory. To ensure rendering accuracy, the canvas size is dynamically set based on the size of the character bounding box, and a certain edge buffer area is reserved to prevent stroke edges from being clipped. The characters are rendered onto the off-screen canvas. During rendering, a specific font size is set to ensure sufficient resolution; the larger the font size, the smaller the jagged edges after pixelation, and the higher the calculation accuracy. The rendering mode is set to single-channel grayscale mode or binary mode, where the character entity pixels (foreground) and non-character pixels (background) have significant differences in grayscale values. The canvas interface is called to extract the pixel data matrix. Each pixel in this matrix contains its position coordinates and color / grayscale value. In this embodiment, it is preferable to binarize the grayscale values, mark pixels with grayscale values ​​greater than a preset threshold (such as 128) as glyph entities (value 1), and mark the rest as background (value 0), thereby obtaining a binarized pixel data matrix for subsequent image moment algorithms and morphological operations.

[0032] By accurately extracting font metric parameters and generating pixel data, consistent processing can be ensured across different fonts and glyphs, while providing high-quality, standardized input data for subsequent analysis.

[0033] The third step of this method for quantitative analysis and visual interactive correction of Chinese character fonts is as follows: Based on pixel data, the physical centroid coordinates of the character shape are calculated using the image moment algorithm. The physical centroid coordinates are then mapped to a preset standard coordinate system using the number of font units and the baseline sinking amount to obtain normalized centroid coordinates. Standardizing the physical centroid of the character shape eliminates the differences between different fonts and different character shapes, providing a unified reference standard for subsequent character shape comparison, analysis and correction, and providing a stable basis for quantitative analysis of multiple fonts and cross-character shapes.

[0034] Building upon the above, it should be noted that this step aims to eliminate the impact of rendering resolution differences and obtain barycenter coordinates with a unified metric benchmark. The specific implementation process is as follows:

[0035] The binarized pixel data matrix obtained above is considered as a two-dimensional image function. In this matrix, the coordinates Indicates the position of a pixel on the off-screen canvas; pixel value This indicates the attribute of the location. In this embodiment, the pixel value of the binarized glyph entity is set to 1, and the background pixel value is set to 0.

[0036] Calculate the physical coordinates of the centroid of the character using the image moment algorithm. The specific calculation formula is as follows:

[0037] First, calculate the zeroth moment of the image. Its physical meaning is the sum of all pixels of the character (i.e., the area of ​​the character): Subsequently, the first moment of the image in the horizontal direction was calculated. and the first moment in the vertical direction : ; .

[0038] Finally, the physical centroid coordinates are calculated based on the above moment values: ; The result This refers to the physical centroid coordinates of the character in the pixel coordinate system.

[0039] Since the physical centroid coordinates of different font files or rendered font sizes are all in pixels, they lack comparability. Therefore, they need to be mapped to a standard coordinate system. This mapping process specifically includes the following sub-steps:

[0040] Sub-step S31: Based on the preset standard coordinate system span and the number of font units (in a preferred embodiment, the preset standard coordinate system span is set to 1000), determine the coordinate scaling ratio. Obtain the number of font units parsed in step two. (i.e., unitsPerEm), this value represents the grid height in the font design space. It retrieves the font pixel height during off-screen canvas rendering. (i.e., pixelSize). Define the coordinate scaling ratio. The ratio of font unit count to pixel height: This ratio represents the unit length of each pixel in the standard coordinate system.

[0041] Sub-step S32: Scale the horizontal coordinates of the physical centroid coordinates based on the coordinate scaling ratio to obtain standard horizontal coordinates. This can be achieved by directly using the coordinate scaling ratio. For the horizontal coordinate of the physical center of gravity Scaling is performed to obtain standard horizontal coordinates. : This step converts pixel distance to font design unit distance.

[0042] Sub-step S33: Compensate for the baseline origin shift of the vertical coordinates of the physical centroid using the baseline sinking amount, and perform a scale transformation mapping on the compensated vertical coordinates based on the coordinate scaling ratio to obtain the standard vertical coordinates. Since the screen coordinate system typically uses the top-left corner as the origin and the Y-axis is positive downwards, while the font standard coordinate system uses the baseline as the origin and the Y-axis is positive upwards, the vertical mapping needs to include both translation compensation and scale transformation.

[0043] Obtain the baseline subsidence extracted in step two. (Descender, usually a negative value, represents the distance from the baseline to the bottom of the font). In pixel coordinates, let the vertical coordinate of the bottom of the glyph bounding box be... The offset of the physical center of gravity relative to the bottom of the bounding box is... .

[0044] First, the baseline origin is translated and compensated using the baseline drop. This is because the baseline is located above the bottom of the font. At this point, calculate the compensated vertical height. (That is, the distance from the center of gravity to the baseline, with the direction being positive upwards relative to the baseline): ;

[0045] Subsequently, based on the coordinate scaling ratio The compensated vertical values ​​are scaled and mapped to obtain standard vertical coordinates. : In this calculation process, all data has been de-normalized. Furthermore, this calculation ensures that when the center of gravity is located at the baseline, The value is 0; it is positive when the center of gravity is above the baseline and negative when it is below the baseline.

[0046] Sub-step S34: The standard horizontal and standard vertical coordinates constitute the normalized barycentric coordinates. Combining the above calculation results, the final normalized barycentric coordinates are obtained. This coordinate system uses font design units as the metric and the baseline as the vertical origin, eliminating the influence of font size and rendering resolution, and achieving unified standardization of cross-font analysis data.

[0047] By standardizing the mapping of physical centroid coordinates, it provides powerful support for cross-font consistency, precise vertical coordinate adjustment, and visualization optimization, providing an efficient and stable foundation for subsequent font quantitative analysis and correction.

[0048] The fourth step of this method for quantitative analysis and visual interactive correction of Chinese character fonts is as follows: performing morphological closing operations and connected component analysis on pixel data to extract the completely closed internal space that does not touch the boundary of the character's bounding box as the character valley region; through morphological operations and connected component analysis, the negative space region inside the character (such as the character valley region) can be accurately identified, effectively solving the technical problem that traditional methods cannot accurately distinguish complex negative spaces and improving the accuracy of the analysis.

[0049] In the fourth step, it should be noted that this step aims to address the problem of unstable determination of internal enclosed spaces caused by tiny gaps between strokes in Chinese characters. It uses mathematical morphology operations to repair structural defects, thereby accurately extracting the valley areas of the characters. The specific implementation methods are as follows:

[0050] 1. Debinarize the pixel data to generate a binary stroke image. First, obtain the pixel data obtained from off-screen rendering in step two. Typically, in the rendering result, the pixels of the character entities have high grayscale values ​​(such as black, with an RGB value of 0 or a low grayscale value), while the background pixels have low grayscale values ​​(such as white or transparent). To facilitate subsequent image processing operations, debinarize them.

[0051] Next, a grayscale threshold is set (e.g., 128). All pixels are iterated through, and pixels with grayscale values ​​greater than the threshold are classified as background and assigned a value of 0. Pixels with grayscale values ​​less than or equal to the threshold are classified as character entities (i.e., strokes) and assigned a value of 1 (or represented as a white foreground of 255 in the image matrix). This generates a binary image of the strokes. In this image, stroke regions are extracted as foreground pixels, and background regions are extracted as background pixels, making the strokes the direct target of image processing operators.

[0052] Second, a pre-dilation followed by erosion morphological closing operation is performed on the binary image of the strokes using a rectangle of a preset size to fill the tiny gaps between strokes and enhance the closed structure. For minor gaps that may exist at the intersections of Chinese characters (especially serif fonts such as Song and Fangsong) or for connectivity breaks caused by rendering, morphological closing operations are used for preprocessing.

[0053] First, a rectangular core is preset as the structural element. The size of this rectangular core (e.g., 3) 3 pixels or 5 (5 pixels) can be dynamically adjusted based on the current rendering resolution or the average stroke width of the font to ensure that its size is slightly larger than the tiny gap to be repaired.

[0054] Secondly, a rectangular kernel is used to perform a dilation operation on the binary graph of the strokes. This operation expands the stroke edges outward, causing the endpoints or edges of strokes that are close to each other to overlap after dilation, thereby connecting the breaks and filling the tiny gaps between strokes.

[0055] Subsequently, an erosion operation is performed on the dilated image. This operation shrinks the edges of the expanded strokes inward, restoring the original thickness characteristics of the strokes.

[0056] By performing a closed operation that first expands and then erodes, the tiny gaps between strokes are filled, turning areas that were originally connected to the outside due to gaps into closed areas, while preserving the original geometric outline of the character to the greatest extent.

[0057] 3. Perform connected component analysis on the morphologically closed binary stroke image to extract the connected regions of background pixels that do not touch the bounding box of the character as the valley regions. Perform connected component analysis algorithms (such as the Two-Pass algorithm or the Seed Filling algorithm) on the morphologically processed binary stroke image.

[0058] First, iterate through the background pixels (with a value of 0) in the image, mark the sets of interconnected background pixels as independent connected regions, and assign a unique label to each region.

[0059] Next, obtain the boundary coordinates of the glyph bounding box constructed in step two. Traverse all marked background connected regions and check if any pixel in the pixel set of that region lies on the boundary of the glyph bounding box.

[0060] Then, the results are filtered based on the detection. If a background connected region touches the bounding box boundary, it means that the region is connected to the external space of the character and belongs to the external background, so it is removed. If a background connected region does not touch the bounding box boundary, it means that the region is completely surrounded by stroke pixels and is determined to be a character valley region. The system records the label, area, position coordinates and related pixel data of the region to complete the extraction of the character valley region.

[0061] By precisely extracting the negative space (valley area) within the glyphs, errors caused by stroke gaps or boundary interference are eliminated, effectively improving the accuracy of glyph structure analysis and providing a more reliable foundation for subsequent font optimization and design. This innovation makes the font quantitative analysis process more refined and stable, bringing significant technological breakthroughs to the fields of font design and typography.

[0062] The fifth step of this method for quantitative analysis and visual interactive correction of Chinese character fonts is as follows: Construct a convex hull mask of the outer contour of the character shape, use the flood filling algorithm to distinguish between the external background and the internal blank, and identify the pixels marked as the external background and not belonging to the valley region as the cavity region inside the convex hull mask. This step can accurately distinguish between the external background of the character shape and the cavity region inside the character shape, ensuring that every part of the character shape structure (such as the cavity region) can be effectively extracted, providing more accurate data support for further analysis.

[0063] It should be added that this step aims to address the difficulty in defining and extracting semi-open concave structures (i.e., character cavities). This is achieved by constructing a geometric convex hull to simulate the visual shell of the character shape, combined with a region labeling algorithm to achieve accurate identification of the character cavity region. The specific implementation methods are as follows:

[0064] 1. Extract the pixel coordinate point set of the outer contour of the character and calculate the minimum convex polygon region of the pixel coordinate point set to generate a convex hull mask.

[0065] Iterate through the pixel data obtained in step two, extract the coordinate positions of all character entity pixels (foreground pixels), and construct a discrete two-dimensional coordinate point set. .

[0066] Computational geometry algorithms (such as Graham scan, Jarvis stepwise method, or QuickHull algorithm) are used to process the point set. The process involves calculating the smallest convex polygon that contains all points within the set. This convex polygon simulates the "visual boundary" of the character's outer contour and can enclose the semi-open areas formed by the concavity of the strokes.

[0067] Create a blank matrix (convex hull mask) with the same size as the pixel data. Use a polygon filling algorithm to fill the interior regions of the convex polygon with a specific identifier value (such as 1), while leaving the exterior regions as 0. This yields the convex hull mask image, which is used to subsequently limit the search range for character cavities.

[0068] 2. Perform a flood fill operation on the background pixels from the edge of the glyph bounding box inwards, and mark the area connected to the boundary of the glyph bounding box as the outer background.

[0069] Select any point on the boundary of the bounding box of the character (usually one of the four vertices of the bounding box or the midpoint of the edge) as the starting seed point, and ensure that the point belongs to the background pixel.

[0070] Starting from the initial point, the flood-fill algorithm spreads outwards. The algorithm determines whether adjacent pixels are background pixels (i.e., non-character entity pixels). If so, it marks them as "outer background" and continues to spread outwards; if it encounters a character entity pixel, it stops spreading in that direction.

[0071] After the filling is complete, all background areas connected to the bounding box boundary are marked as "outer background". Conversely, in the pixel data, areas that are not marked as "outer background" and are not glyph entities are "inner blanks" that are physically isolated by the strokes.

[0072] Third, within the range corresponding to the convex hull mask, extract the set of pixels marked as external background that do not belong to the character valley region, and identify them as the character cavity region.

[0073] The character cavity is defined as a recessed space located inside the visual outline (convex hull) of the character shape, but physically connected to the outside world. Therefore, the following logical judgments are required: check whether the pixel is located inside the generated convex hull mask; check whether the pixel is marked as "external background"; check whether the pixel belongs to the already identified "character valley region".

[0074] The pixel matrix is ​​traversed to extract the set of pixels that simultaneously meet the conditions of being "within the convex hull", "marked as the outer background", and "not a character valley pixel". This set constitutes the character cavity region.

[0075] This step accurately distinguishes the internal blank space and external background of the glyphs using convex hull masking and flood fill algorithms, and identifies the cavity regions, achieving a categorized analysis of the negative space within the font. This method not only improves the recognition capability of complex glyph structures but also provides a reliable foundation for font visualization, quantitative analysis, and visual optimization, significantly enhancing the scientific rigor and accuracy of font analysis and design.

[0076] The sixth step of this method for quantitative analysis and interactive visualization correction of Chinese character fonts is as follows: Based on the font style recognition results, a preset offset is applied to the normalized centroid coordinates to obtain the initial visual center. In response to the interactive correction operation triggered by the user on the visualization interface, the initial visual center is fine-tuned to obtain the corrected visual center. This step combines automatic algorithms with user interaction to achieve flexible adjustment of the font's visual center. It not only ensures the initial effect generated by the algorithm but also allows for fine-tuning according to the user's personalized needs, thereby improving the font's aesthetics and visual balance.

[0077] The sixth step aims to address the discrepancy between the physical geometric center of gravity and the human visual perception center of gravity. By combining rule-based mapping with manual correction, it ensures that the final output visual center conforms to the artistic aesthetic standards of the font. Specific implementation methods are as follows:

[0078] First, an initial visual center is obtained by applying a preset offset to the normalized centroid coordinates based on the font style recognition results. Specifically, based on the parsed font name information, style keywords in the font name are identified to determine the font style category. In practice, the system reads the font metadata parsed in step two and extracts the full font name and family name string. The string is scanned using preset keyword matching rules. Style keywords include, but are not limited to, "bold," "light," "sans-serif," and "SimSun." For example, if the font name contains "Bold" or "sans-serif," the font style category is determined to be "bold sans-serif"; if it contains "Light" or "light," it is determined to be "light line." If a specific keyword cannot be matched, it is classified as "standard" by default.

[0079] Next, the system looks up the corresponding vertical correction ratio in a pre-defined correction ratio table based on the font style category. Specifically, the system has a pre-built "Font Style - Correction Ratio" mapping table. This table, based on the principles of font design psychology and extensive sample statistics, stores the vertical correction coefficients corresponding to different style categories. For example, for "bold" fonts, because the strokes are thick and the visual center of gravity tends to drop, the correction ratio can be set to a positive value (such as +0.02) to indicate a slight upward adjustment; for "thin" fonts, the correction ratio can be set to close to zero or a slightly negative value; for fonts like "Song" with distinct horizontal and vertical stroke thickness, a specific correction ratio needs to be set according to the position of the horizontal strokes. Based on the font style category determined in the previous step, the system retrieves the corresponding vertical correction ratio from the mapping table. .

[0080] Furthermore, the vertical coordinate values ​​of the normalized barycentric coordinates are offset and adjusted using a vertical correction ratio, and the adjusted coordinate point is set as the initial visual center. Specifically, the normalized barycentric coordinates are obtained. Keeping the horizontal coordinates unchanged, the vertical coordinates are offset. The specific calculation formula is as follows: ;in, The vertical coordinates of the initial visual center. The height reference value for the font design space (usually taken as the number of font units or the height of the character bounding box, preferably the number of font units). This is the correction ratio obtained from a table lookup. The final initial visual center coordinates are: .

[0081] As a further solution, in response to user-triggered interactive corrections on the visual interface, the initial visual center is fine-tuned. A rendered image of the character and the initial visual center marker are overlaid on the visual interface. The system launches the graphical user interface and loads a high-resolution rendered image of the character in the main display area. Simultaneously, a visual marker (such as a crosshair, dot, or "+") is overlaid on top of the image. The center point of this marker is precisely aligned to the calculated initial visual center coordinates, allowing the user to visually examine whether the algorithm's calculation results deviate from subjective visual perception.

[0082] Next, the system receives position correction commands generated by the user through mouse drag-and-drop or coordinate input. The system activates event listening mode to capture user interaction input. Mouse drag-and-drop mode: When the user moves the mouse cursor over a marker and presses the left mouse button to drag, the system updates the marker's position in real time and dynamically displays the current coordinate value next to the interface. Numerical input mode: The interface provides coordinate input boxes where users can directly enter precise horizontal and vertical offsets or absolute coordinate values, based on which the system generates position correction commands.

[0083] Then, the coordinates of the initial visual center are updated according to the position correction command to obtain the corrected visual center, and the correction offset is recorded simultaneously. The coordinates of the initial visual center before correction are retained as a basis for data traceability. When the user releases the mouse or confirms the input, the system determines the coordinates of the final position of the marker symbol as the corrected visual center. .

[0084] At the same time, the system calculates the offset before and after the correction. , The corrected visual center coordinates are used as the final analysis result, and the corrected offset is also included. The original initial visual center coordinates are packaged and stored in a database or log file. This mechanism ensures the traceability of the analysis process, reflecting both the final intention of human correction and preserving the algorithm's baseline data, providing data support for subsequent optimization and correction of the scaling table.

[0085] By combining automatic font style adjustments with user interaction fine-tuning, a more refined and flexible visual center optimization solution is provided for font design. Whether in the initial automatic adjustment stage or in the subsequent interactive correction process, font style and design requirements are fully considered, ensuring high precision and efficiency in font design, and enhancing the operability and traceability of the design process.

[0086] The seventh step in this method of quantitative analysis and visual interactive correction of Chinese character fonts specifically involves outputting and displaying the quantitative analysis results, including normalized centroid coordinates, corrected visual center, and related indicators of the character valley and character cavity regions, in a visualization interface. The correction offsets generated by fine-tuning are also recorded in a cache. This step enables real-time data display and recording, facilitating design decisions and tracking historical correction results. The recorded correction offsets can be used for subsequent optimization and improvement, making the design process more systematic, precise, and traceable.

[0087] As a further solution, the seventh step not only provides an intuitive display of the analysis results and data persistence, but also expands the dimensions of the quantitative indicators and provides comparative analysis capabilities in multi-font scenarios. The specific implementation methods are as follows:

[0088] Because the structural features of fonts (such as normalized centroid coordinates, visual center, character valley region, character cavity region, and indicators such as character surface ratio and blackness) are often complex and difficult to perceive directly, they need to be transformed into easily understandable data through unified quantitative analysis and visualization. Therefore, before outputting the quantitative analysis results, the system further calculates multi-dimensional indicators characterizing the physical properties of the font based on pixel data and geometric parameters, specifically including:

[0089] Obtain the bounding box of the glyphs constructed in step two and calculate its area. The "font body frame" is defined as the rendering area corresponding to a square with a side length of font units (unitsPerEm), and its area is denoted as... Literal rate The calculation formula is: This indicator reflects the proportion of space occupied by the glyph in the font design.

[0090] Within the rendering area corresponding to the text frame, iterate through all pixels and count the number of pixels whose grayscale value meets the preset blackness threshold (e.g., grayscale value less than 128). This number is recorded as the first black pixel count. Darkness The calculation formula is: This indicator reflects the overall blackness weight of the font and is often used as a reference for typesetting and color matching.

[0091] Within the rendering area corresponding to the glyph bounding box, the number of black pixels that meet the preset threshold is recounted and recorded as the second black pixel count. Grayscale The calculation formula is: This indicator reflects the density of strokes in the character entity.

[0092] Within the rendering area corresponding to the glyph bounding box, count the number of white pixels whose grayscale values ​​do not meet the preset threshold (i.e., background pixels). White space ratio The calculation formula is: This indicator reflects the proportion of white space within the font's bounding box.

[0093] The system combines the literal ratio, blackness, grayness, and whiteness ratio obtained from the above calculations, along with the centroid coordinates, character cavity area, and other indicators obtained in the previous steps, to generate a structured quantitative analysis result data package.

[0094] Furthermore, since the font design process typically involves multiple adjustments and iterations, parameters such as offset corrections, initial visual centers, and quantitative analysis results need to be systematically recorded and stored for subsequent review, analysis, and sharing. Therefore, after outputting the quantitative analysis results, the following is also included:

[0095] The system uses a graphics rendering engine to draw pixel images of the characters in a visual interface. Different colored semi-transparent layers are used to overlay and display the identified character valley and character cavity areas, with normalized centroid coordinates and corrected visual center point markers drawn at corresponding locations. The sidebar displays quantitative indicators such as character saturation and blackness in the form of charts or numerical lists.

[0096] When a user-triggered data export command is received, the system retrieves the corrected offset and the initial visual center coordinates before correction from the memory cache. The system then encapsulates this corrected data along with the final quantitative analysis results, converting it into a preset standard format file (such as JSON, CSV, or XML). This file is persistently stored as traceability data on the local disk or in a cloud database for subsequent review of the font design iteration process.

[0097] Furthermore, when there are multiple font files to be analyzed, the system performs a unified cross-font comparison and analysis process:

[0098] For each font file, its OpenType feature table is parsed to extract the set of available features supported by the font (such as ligatures, kerning, etc.). The intersection of the available feature sets of all font files is calculated to generate a common feature set. The system forcibly restricts the rendering engine to only use font features belonging to this intersection range for pixel-based rendering, thereby eliminating pixel structure deviations caused by differences in font feature support and ensuring consistency of cross-font analysis conditions.

[0099] Iterate through the quantitative analysis results of all fonts and group them according to character index (Unicode code point). Construct a mapping structure (e.g., Map) with character index as the primary key and font identifier as the subkey. <CharacterID,Map<FontID,Metrics> >), which aggregates the index data of the same character under different fonts.

[0100] Based on the aggregated data, the statistical characteristics of various indicators (such as normalized centroid coordinates, character valley area, and character cavity area) of the same character under different fonts are calculated. Specifically, the range and standard deviation of each indicator are calculated. These deviation data are then used to generate comparative charts (such as radar charts or bar charts) and displayed in a visualization interface to help users quickly identify the differences in the structural design of the same character in different fonts.

[0101] It is also necessary to understand that, such as Figure 2 The diagram shown is an overall architecture diagram of a Chinese character font quantitative analysis and visual interactive correction method provided in an embodiment of this application. (Refer to...) Figure 2 This invention constructs a complete technical closed loop from bottom-level data analysis to top-level interactive applications through close collaboration of each step, establishes a unified measurement benchmark for cross-font analysis, and solves the problem of lack of comparability of existing technical indicators. At the same time, the steps not only effectively reconcile the differences between geometric model calculation results and human visual perception, but also realize the continuous evolution of the analysis model by caching and correcting data, which significantly improves the accuracy, practicality and intelligence level of font quantitative analysis.

[0102] Secondly, such as Figure 3 The diagram shown is a structural schematic of a Chinese character font quantification analysis and visualization interactive correction system provided in an embodiment of this application. (Refer to...) Figure 3 The system includes: a font file acquisition module, a font file parsing module, a centroid coordinate calculation module, a character valley region extraction module, a character cavity region recognition module, a visual center correction module, and a quantization result output module.

[0103] Specifically, the font file acquisition module is used to acquire the font file and character set to be analyzed.

[0104] The font file parsing module is used to parse font files, extract font metric parameters, obtain glyph data corresponding to each character in the character set, construct glyph bounding boxes, and perform pixel rendering on an off-screen canvas to obtain pixel data. The font metric parameters include at least the number of font units and the baseline drop.

[0105] The centroid coordinate calculation module is used to calculate the physical centroid coordinates of the character based on pixel data using an image moment algorithm. It maps the physical centroid coordinates to a preset standard coordinate system using the number of font units and the baseline sinking amount to obtain normalized centroid coordinates.

[0106] The character valley region extraction module is used to perform morphological closing operations and connected component analysis on pixel data to extract the completely closed internal space that does not touch the boundary of the character's bounding box as the character valley region.

[0107] The character cavity region recognition module is used to construct a convex hull mask of the outer contour of the character shape, use the flood filling algorithm to distinguish the external background from the internal blank, and identify pixels marked as external background and not belonging to the character valley region as character cavity regions inside the convex hull mask.

[0108] The visual center correction module is used to apply a preset offset to the normalized centroid coordinates based on the font style recognition results to obtain the initial visual center, and to fine-tune the initial visual center in response to the user's interactive correction operation triggered on the visualization interface to obtain the corrected visual center.

[0109] The quantitative results output module is used to output and display the quantitative analysis results, including the normalized centroid coordinates, the corrected visual center, the word valley area and the word cavity area, in the visualization interface, and record the correction offset generated by the fine adjustment to the cache.

[0110] Overall, this invention addresses key issues in existing technologies, such as the difficulty in accurately distinguishing complex negative spaces within Chinese characters, the lack of unified benchmarks for cross-font analysis indicators, and the difficulty in adapting quantification results to visual perception. It constructs a complete technical solution from bottom-level pixel analysis to top-level interactive applications. By introducing font metric parameters to normalize the centroid coordinates, an objective scale for cross-font analysis is established. Morphological closing operations are used to repair stroke gaps, and combined with convex hull masking and flood filling algorithms, innovatively achieving refined stripping and quantification of two types of heterogeneous negative spaces: character valleys and character cavities. Simultaneously, a visual interactive correction mechanism effectively reconciles the discrepancies between mathematical model calculations and human subjective visual aesthetics, and continuous optimization of the analysis model is achieved through caching correction data. This invention not only breaks through the limitations of traditional technologies that can only handle simple outlines or closed regions, significantly improving the accuracy, stability, and reproducibility of Chinese character font structure analysis, but also provides an efficient, objective, and intelligently evolving quantitative tool for font design quality assessment, font product standardization testing, and font style evolution research, possessing significant technological innovation and practical application value.

[0111] Through the above description of the implementation methods, those skilled in the art can clearly understand that, for the sake of convenience and brevity, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the above functions can be divided into different functional modules to complete all or part of the functions described above.

[0112] In the embodiments provided in this application, it should be understood that the disclosed systems and methods can be implemented in other ways. For example, the embodiments described above are merely illustrative; for instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another device, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces, or indirect coupling or communication connection between devices or units, and may be electrical, mechanical, or other forms.

[0113] The units described as separate components may or may not be physically separate. A component shown as a unit can be one or more physical units, located in one place or distributed in multiple different locations. Some or all of the units can be selected to achieve the purpose of this embodiment, depending on actual needs.

[0114] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0115] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solutions of the embodiments of this application, or the parts that contribute to the solution, or all or part of the technical solution, can be embodied in the form of a software product. This software product is stored in a storage medium and includes several instructions to cause a device (which may be a microcontroller, chip, etc.) or processor to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0116] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A method for quantitative analysis and visual interactive correction of Chinese character fonts, characterized in that, Includes the following steps: Obtain the font file and character set to be analyzed; The font file is parsed to extract font measurement parameters, the glyph data corresponding to each character in the character set is obtained and the glyph bounding box is constructed, and pixel data is obtained by pixel rendering in an off-screen canvas. The font measurement parameters include at least the number of font units and the baseline drop. The physical centroid coordinates of the character are calculated using the image moment algorithm based on pixel data. The physical centroid coordinates are then mapped to a preset standard coordinate system using the number of font units and the baseline drop, resulting in normalized centroid coordinates. Morphological closing operations and connected component analysis are performed on pixel data to extract the completely closed internal space that does not touch the boundary of the glyph bounding box as the glyph valley region; Construct a convex hull mask for the outer contour of the character, use the flood fill algorithm to distinguish the external background from the internal blank, and identify pixels marked as external background and not belonging to the valley region as the cavity region inside the convex hull mask; Based on the font style recognition results, a preset offset is applied to the normalized centroid coordinates to obtain the initial visual center. In response to the user's interactive correction operation triggered on the visualization interface, the initial visual center is finely adjusted to obtain the corrected visual center. Output and display the quantitative analysis results, including normalized centroid coordinates, corrected visual center, and related indicators of the character valley and character cavity regions, in the visualization interface, and record the correction offset generated by fine-tuning into the cache.

2. The method for quantitative analysis and visual interactive correction of Chinese character fonts as described in claim 1, characterized in that, The process of mapping the physical centroid coordinates to a preset standard coordinate system using the number of font units and the baseline sinking amount to obtain normalized centroid coordinates specifically includes: Determine the coordinate scaling ratio based on the preset standard coordinate system span and the number of font units; Based on the coordinate scaling ratio, the horizontal coordinate values ​​of the physical centroid coordinates are scaled and mapped to obtain the standard horizontal coordinates. The baseline origin is translated to compensate for the vertical coordinate values ​​of the physical centroid coordinates by using the baseline subsidence, and the compensated vertical coordinate values ​​are scaled and mapped based on the coordinate scaling ratio to obtain the standard vertical coordinates. The standard horizontal coordinates and standard vertical coordinates constitute the normalized centroid coordinates.

3. The method for quantitative analysis and visual interactive correction of Chinese character fonts as described in claim 1, characterized in that, The morphological closing operation and connected component analysis performed on the pixel data specifically include: The pixel data is debinarized to generate a stroke binary image. The stroke region in the stroke binary image is extracted as the foreground pixel, and the background region is extracted as the background pixel. A morphological closing operation of first dilation and then erosion is performed on the binary image of the stroke using a rectangular kernel of a preset size to fill the tiny gaps between strokes and enhance the closed structure. Perform connected component analysis on the binary graph of strokes after morphological closing operation, and extract the connected regions of background pixels that do not touch the bounding box of the character as the valley region.

4. The method for quantitative analysis and visual interactive correction of Chinese character fonts as described in claim 1, characterized in that, The construction of the convex hull mask for the outer contour of the character shape, using a flood fill algorithm to distinguish the external background from the internal blank space, specifically includes: Extract the pixel coordinate point set of the outer contour of the character, and calculate the minimum convex polygon region of the pixel coordinate point set to generate a convex hull mask; Perform a flood fill operation on the background pixels from the edge of the glyph bounding box inwards, and mark the area connected to the edge of the glyph bounding box as the outer background; Within the range corresponding to the convex hull mask, extract the set of pixels marked as external background that do not belong to the character valley region, and identify them as the character cavity region.

5. The method for quantitative analysis and visual interactive correction of Chinese character fonts as described in claim 1, characterized in that, The step of applying a preset offset to the normalized centroid coordinates based on the font style recognition result to obtain the initial visual center specifically includes: Based on the parsed font name information, style keywords in the font name are identified to determine the font style category; Find the preset correction ratio table based on the font style category and obtain the corresponding vertical correction ratio; The vertical coordinate values ​​of the normalized centroid coordinates are offset and adjusted using a vertical correction ratio, and the adjusted coordinate point is set as the initial visual center.

6. The method for quantitative analysis and visual interactive correction of Chinese character fonts as described in claim 1, characterized in that, The fine-tuning of the initial visual center in response to user-triggered interactive correction operations on the visual interface specifically includes: Overlay the rendered image of the glyph and the initial visual center mark in the visualization interface; Receive position correction commands generated by users through mouse drag-and-drop operations or coordinate value input operations; The coordinates of the initial visual center are updated according to the position correction command to obtain the corrected visual center, and the correction offset is recorded synchronously. At the same time, the coordinates of the initial visual center before correction are retained as the basis for data traceability.

7. The method for quantitative analysis and visual interactive correction of Chinese character fonts as described in claim 1, characterized in that, The output, displayed in a visualization interface, includes quantitative analysis results containing normalized centroid coordinates, corrected visual center, and related indicators of the character valley and character cavity regions. Previously, it also included: The character surface rate is calculated based on the ratio of the area of ​​the character bounding box to the area of ​​the character body frame, wherein the character body frame is a square rendering area with the number of character units as the side length; Within the rendering area corresponding to the character frame, count the number of first black pixels that meet the preset threshold, and calculate the blackness based on the ratio of the number of first black pixels to the total number of pixels in the rendering area corresponding to the character frame. Within the rendering area corresponding to the glyph bounding box, the number of second black pixels that meet the preset threshold is recounted, and the grayscale is calculated based on the ratio of the number of second black pixels to the total number of pixels in the rendering area corresponding to the glyph bounding box. Within the rendering area corresponding to the character bounding box, count the number of white pixels that do not meet the preset threshold, and calculate the character white ratio based on the ratio of the number of white pixels to the total number of pixels in the rendering area corresponding to the character bounding box. The literal value, blackness, grayness, and whiteness ratio are combined into the quantitative analysis results.

8. The method for quantitative analysis and visual interactive correction of Chinese character fonts as described in claim 1, characterized in that, The output, displayed in a visualization interface, includes quantitative analysis results containing normalized centroid coordinates, corrected visual center, and related indicators of the character valley and character cavity regions. This is followed by: Receive data export instructions based on quantitative analysis results, and extract the corrected offset and the initial visual center coordinates before correction recorded in the cache; The corrected offset, initial visual center coordinates, and quantitative analysis results are converted into a data file in a preset format and persistently exported to generate traceability data for reviewing font design iterations.

9. The method for quantitative analysis and visual interactive correction of Chinese character fonts as described in claim 1, characterized in that, The process involves obtaining the font file and character set to be analyzed, and also includes multi-font comparative analysis, specifically including: Extract the set of available features for each font file, calculate the intersection of all available feature sets, and restrict pixel rendering to only font features that fall within the intersection range, so as to unify the analysis conditions across fonts; The quantitative analysis results of multiple fonts are grouped and aggregated according to the character index to construct a character index mapping structure with the font identifier as the key; Based on the character index mapping structure, the range and standard deviation of the normalized centroid coordinates, valley region and cavity region of the same character under different fonts are calculated to generate multi-font comparison data for display in the visualization interface.

10. A system for quantitative analysis and interactive visualization correction of Chinese character fonts, employing the method for quantitative analysis and interactive visualization correction of Chinese character fonts as described in any one of claims 1-9, characterized in that, include: The system includes a font file acquisition module, a font file parsing module, a centroid coordinate calculation module, a character valley region extraction module, a character cavity region recognition module, a visual center correction module, and a quantization result output module. The font file acquisition module is used to acquire the font file and character set to be analyzed; The font file parsing module is used to parse the font file to extract font measurement parameters, obtain glyph data corresponding to each character in the character set and construct glyph bounding boxes, and perform pixel rendering in the off-screen canvas to obtain pixel data. The font measurement parameters include at least the number of font units and the baseline drop. The centroid coordinate calculation module is used to calculate the physical centroid coordinates of the character based on pixel data using an image moment algorithm, and to map the physical centroid coordinates to a preset standard coordinate system using the number of font units and the baseline sinking amount to obtain normalized centroid coordinates. The character valley region extraction module is used to perform morphological closing operations and connected component analysis on pixel data to extract the completely closed internal space that does not touch the boundary of the character bounding box as the character valley region. The character cavity region recognition module is used to construct a convex hull mask of the outer contour of the character shape, use the flood filling algorithm to distinguish the external background from the internal blank, and identify the pixels marked as external background and not belonging to the character valley region as character cavity regions inside the convex hull mask. The visual center correction module is used to apply a preset offset to the normalized centroid coordinates based on the font style recognition result to obtain the initial visual center, and to fine-tune the initial visual center in response to the interactive correction operation triggered by the user on the visualization interface to obtain the corrected visual center. The quantitative result output module is used to output and display the quantitative analysis results, including the normalized centroid coordinates, the corrected visual center, the word valley region and the word cavity region, in the visualization interface, and record the correction offset generated by the fine adjustment in the cache.