# CCFont: Component-Based Chinese Font Generation Model Using Generative Adversarial Networks (GANs)
## 4 Training Methodology  
In the case of a Chinese character with a complex shape, it is difficult to convert the style by mapping the character itself; therefore, we used a method of decomposing the character into components, transforming the decomposed components into styles, and then recombining the transformed components to generate a new style of character. This is different from [13; 14; 15; 17; 18; 19], which separated character images into component images. These models cannot separate component images in the case of complex characters. Figure 8 shows the process of decomposing the characters into components and composing the characters from the decomposed components. For example, separating the character of \(\mathbb{H}\), \(\mathbb{H}^{\prime}\) gives compositions of ['\(\mathbb{H}\)', '\(\mathbb{H}\)'] (level 1), and by separating again '\(\mathbb{H}\)' and '\(\mathbb{H}\)' (level 2) until they can no longer be separated (level 4), \(\mathbb{H}\) is finally divided into five basic components of ['\(\cup\)', '\(\cup\)', '\(\cup\)', '\(\mathbb{H}\)'] (decomposition). When the new style of '\(\mathbb{H}\)' is generated, the newly styled basic components are composed in the opposite direction (composition). Figure 7: Examples of components from a character. The sample input image to the CCFont model is shown in Figure 9, where src represents the source image, tgt represents the target image, and all the basic components of the tgt image representing the target font style (tgt style-wised components) are demonstrated. The components were provided separately in Python as 'compositions' of the 'CIKradlib RadicalFinder' API ([[https://pypi.org/project/cjkradlib/](https://pypi.org/project/cjkradlib/)]([https://pypi.org/project/cjkradlib/](https://pypi.org/project/cjkradlib/)), (accessed on 1 June 2022)). We decomposed and composed Python programs using API. Most Chinese characters have fewer than 14 components (99.99%), but some have more than 14 components. In addition, SC character components had fewer than TC components. In the examples in Figure 10, the character (iron), which is the character with the greatest number of components among GB2312, is divided into 14 components, as shown in Figure 10a, and is reduced to four components, shown in Figure 10b, when divided into SC characters. SC radicals significantly reduced the number of components by converting traditional components into simple and non-separable components, i.e., \(\ddagger\) -> i, \(\ddagger\), \(\ddagger\) -> i, etc. Figure 10c shows the TC characteristics with 15, 16, and 17 components, which are the three characters with the highest number of components in GBK21003 (21,003 characters). Figure 8: An example of character decomposition and composition. Figure 9: An example of input images. Src and tgt represents source and target images, respectively. According to the Chinese character set, the number of characters, radicals, and components vary, as does the number of characters and radicals. Table 1 lists the number of unique radicals and components for each set of characters. It demonstrates the variation in character shape, number of characters based on the character set, number of radicals and components, and minimum number of characters necessary to obtain the component. As shown in Table 1, GB2312 contained 281 unique components, GBK21003 contained 347 unique components, and GBK26634 contained 346 unique components. In this study, 2000 commercial Chinese characters from standard Chinese GB2312 (up to 14 components) and three characters with 15, 16, and 17 components from GBK21003 were added. Therefore, the CCFont model was trained with 2003 TC characters, 603 unique radicals, and 249 basic components, covering up to 17 components (99.99% of common TC/SC). In other words, the model can regenerate all Chinese characters with 17 components or fewer. Therefore, the proposed model works for any character that can be separated into components (in less than 17s).