Method, system and equipment for supporting normal display of rarely-used characters by OFD (Open Forwarding Detection) file
By searching and associating font subset information in OFD files, the problem of cross-platform display of rare characters in OFD files is solved, and the normal display and complete display of attributes of rare characters are realized.
Patent Information
- Application Number
- CN202410504081.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-25
- Publication Date
- 2024-09-06
AI Technical Summary
Rare characters in OFD files may be displayed as garbled characters on different platforms, resulting in failure to display normally. Existing technology cannot effectively solve the problem of cross-platform display.
By reading the Chinese characters in the OFD initial file, find the corresponding font file in the preset font library, extract the font subset information and text information, add it to the resource file directory of the OFD file, and combine the text object node with the font Subset information association ensures cross-platform display of rare words.
It realizes that rare characters in OFD files can be displayed normally on any platform, avoiding the problem of garbled characters and ensuring the complete attribute display of the text.
Smart Images

Figure CN118607472A
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of document processing, and in particular to a method, system and device for supporting normal display of uncommon characters in an OFD file. Background Art
[0002] For OFD (Open Fixed-layout Document) files, functions such as generating new OFD files, synthesizing text field data, adding text information, adding text watermarks, generating electronic receipts and electronic statements, etc. all require support for rare characters. However, the GB / T 33190-2016 "Electronic File Storage and Exchange Format Layout Document" standard only defines the basic elements of domestic layout files, and does not specify how font data is stored. Different manufacturers have different implementation methods; as a result, rare characters in the same OFD file may be displayed as garbled characters such as question marks or boxes on different manufacturers' platforms.
[0003] Therefore, how to ensure that rare characters in OFD files can be displayed on different platforms is an important issue that needs to be urgently solved in the industry. Summary of the invention
[0004] The present invention provides a method, system and device for supporting normal display of uncommon characters in OFD files, so as to solve the defect in the prior art that uncommon characters in OFD files cannot be displayed in different platforms, and realize cross-platform display of uncommon characters in OFD files.
[0005] The present invention provides a method for supporting normal display of uncommon characters in an OFD file, comprising:
[0006] Read Chinese characters in the OFD initial file;
[0007] For each of the Chinese characters, a corresponding font file is searched in a preset font library; the preset font library caches regular character font files and rare character font files, and the rare character font files include all rare characters defined in the information technology Chinese coded character set;
[0008] Extracting font subset information and text information from the font file; the font subset information at least includes Chinese characters and character attributes corresponding to the Chinese characters; the text information is Chinese characters;
[0009] Add the font subset information to the resource file directory of the OFD initial file;
[0010] Storing the text information in the text object node of the OFD initial file;
[0011] The text node is associated with the font subset information to obtain an OFD file that supports the display of rare characters.
[0012] According to a method provided by the present invention for supporting normal display of uncommon characters in an OFD file, the reading of Chinese characters in an OFD initial file comprises:
[0013] Divide the text content in the OFD initial file into multiple text blocks;
[0014] Splitting the character string in each of the text blocks;
[0015] Read the Kanji characters in the split characters.
[0016] According to a method for supporting normal display of uncommon characters in an OFD file provided by the present invention, the adding of the font subset information to the resource file directory of the OFD initial file comprises:
[0017] According to the number of font files found, create the same number of font resource files in the resource file directory of the OFD initial file and number them;
[0018] The font subset information in the found font file is stored in a font resource file, wherein one font resource file stores the font subset information of one font file.
[0019] According to a method for supporting normal display of uncommon characters in an OFD file provided by the present invention, storing the text information into a text object node of an OFD initial file comprises:
[0020] Create the same number of text object nodes as the number of font files found;
[0021] The text information in a font file is stored in each of the text object nodes.
[0022] According to a method for supporting normal display of uncommon characters in an OFD file provided by the present invention, associating the text node with the font subset information comprises:
[0023] The Font attribute of the text object node is used to associate the text object node with the font subset information containing the text information in the text object node.
[0024] According to a method provided by the present invention for supporting normal display of uncommon characters in an OFD file, the method further comprises:
[0025] An offset is set for each Chinese character in the text object node according to the position information of the Chinese character in the OFD initial file.
[0026] The present invention also provides a system for supporting normal display of uncommon characters in OFD files, comprising:
[0027] A reading unit, used for reading Chinese characters in the OFD initial file;
[0028] A search unit, for searching a corresponding font file in a preset font library for each of the Chinese characters; the preset font library caches regular character font files and rare character font files, and the rare character font files include all rare characters defined in the information technology Chinese coded character set;
[0029] An extraction unit, used to extract font subset information and text information from the font file; the font subset information at least includes Chinese characters and character attributes corresponding to the Chinese characters; the text information is Chinese characters;
[0030] An adding unit, used for adding the font subset information to the resource file directory of the OFD initial file;
[0031] A storage unit, used for adding the text information to the text object node of the OFD initial file;
[0032] The associating unit is used to associate the text node with the font subset information to obtain an OFD file that supports the display of rare characters.
[0033] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the method for supporting normal display of uncommon characters in an OFD file as described above is implemented.
[0034] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the method for supporting normal display of uncommon characters in an OFD file as described in any one of the above is implemented.
[0035] The present invention also provides a computer program product, including a computer program, which, when executed by a processor, implements any of the above-mentioned methods for supporting normal display of uncommon characters in an OFD file.
[0036] The present invention provides a method, system and device for supporting normal display of uncommon characters in an OFD file. The method of the present invention searches for a corresponding font file in a preset font library for each Chinese character; and adds the font subset information in the font file to the resource file directory of the OFD initial file, thereby providing data support for the cross-platform display of uncommon characters, and associating the text object node with the font subset information, so that when a reader of any platform reads the text object node of OFD, it can find the font subset information pointed to by the text object node, thereby completely displaying the font and other attributes of the uncommon characters, thereby realizing the cross-platform display of uncommon characters in the OFD file. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0038] Figure 1 This is one of the flow charts of the method for supporting normal display of uncommon characters in an OFD file provided by the present invention;
[0039] Figure 2 This is the second flow chart of the method for supporting normal display of uncommon characters in an OFD file provided by the present invention;
[0040] Figure 3 It is a structural schematic diagram of a system for supporting normal display of uncommon characters in an OFD file provided by the present invention;
[0041] Figure 4 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION
[0042] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0043] Combine the following Figure 1-Figure 2 The method for supporting the normal display of uncommon characters in an OFD file of the present invention is described, which specifically comprises the following steps:
[0044] Step S101: Read Chinese characters in the OFD initial file.
[0045] In this embodiment, Chinese characters in an OFD initial file can be read through an OFD editing tool, such as OFD-editor, etc. The OFD file is a national standard for layout documents formulated by the Layout Writing Group established by the Software Department of the Ministry of Industry and Information Technology and the China Electronics Standardization Institute. It is an independent format in China, aiming to break the non-uniformity of electronic document formats in government departments and agencies, so as to facilitate the storage, reading, and editing of electronic documents.
[0046] The OFD initial file refers to the original file that has not undergone any editing process. The OFD initial file includes at least one of regular characters and rare characters, or a combination of both.
[0047] Exemplarily, use the OFD-editor reading editor to open an OFD initial file to be processed. The OFD-editor reading editor can read the Chinese characters in the OFD initial file line by line, sentence by sentence, or paragraph by paragraph.
[0048] Step S102: Search for the corresponding font file in the preset font library for each of the Chinese characters.
[0049] Among them, the preset font library caches regular character font files and rare character font files. The rare character font files include all rare characters defined in the Information Technology Chinese Coding Character Set.
[0050] In the embodiment of the present invention, the font file can adopt a TrueType font file. TrueType is a new type of mathematical font description technology jointly proposed by Apple Inc. and Microsoft Corporation. It describes the outline of the font with mathematical functions and contains instructions such as glyph construction, color filling, digital description functions, process condition control, raster processing control, and additional hint control. The TrueType system contains a virtual machine that executes programs inside the font to process the "hints" of glyphs.
[0051] The Information Technology Chinese Coding Character Set can be, for example, GB18030-2022 "Information Technology Chinese Coding Character Set".
[0052] It should be noted that the number of regular character font files and rare character font files can be multiple. This is because the storage space of each font file is limited, so it is impossible to store a large number of Chinese characters in only one font file. Therefore, multiple font files are needed for storage.
[0053] Exemplarily, for the character "文", it is stored as [0x6587] in font file 1. We search in the preset font library according to this code [0x6587] and find that the font file where the character "文" is located is font file 1.
[0054] Step S103: extracting font subset information and text information from the font file.
[0055] In this embodiment, the font subset information includes at least Chinese characters and character attributes corresponding to the Chinese characters; the text information is pure text, including only Chinese characters.
[0056] In an example, the character attributes may include multiple attributes such as font, coordinates, font size, color, and outline.
[0057] For example, if the text content of a text block is [uncommon characters 】, such as "uncommon characters" in the font 1.ttf file, In the font2.ttf file, extract the font attribute data containing "uncommon characters" in the font1.ttf file to obtain the font subset information of "uncommon characters"; extract the font attribute data containing "uncommon characters" in the font2.ttf file The font attribute data is obtained Font subset information.
[0058] Step S104: adding the font subset information to the resource file directory of the OFD initial file.
[0059] Multiple resource files can be created in the resource file directory, and each resource file can store the font subset information of a font file.
[0060] For example, for an OFD initial file, two font files are found after searching, namely font file 1 and font file 2. Font subset information 1 is extracted from font file 1, and font subset information 2 is extracted from font file 2. Correspondingly, two resource files are established in the resource file directory of the OFD initial file, one resource file stores font subset information 1, and the other resource file stores font subset information 2.
[0061] Step S105: storing the text information in the text object node of the OFD initial file.
[0062] Each physical page of each OFD file has a structure page associated with it to keep track of what we are currently using that page for, so the text object nodes are located in the structure page.
[0063] Exemplarily, multiple TextObject nodes may be copied in the structure page corresponding to each page of the OFD initial file, and the text information extracted from each font file may be stored as a group in one TextObject node.
[0064] Step S106: Associate the text object node with the font subset information to obtain an OFD file that supports the display of rare Chinese characters.
[0065] To display a certain text completely, not only its text part needs to be displayed, but also other attributes such as font type, coordinates, font size, color, and stroke need to be presented. Since only pure text information is stored in the text object node, by associating it with the corresponding font subset information, the complete text can be presented.
[0066] Among them, the text information in a text object node is only associated with the font subset information that contains its text information.
[0067] Exemplarily, the text information stored in text object node 1 is [one, two, three], font subset information 1 contains character data of [four, five, six], and font subset information 2 contains character data of [one, two, three]. Then text object node 1 is associated with font subset information 2.
[0068] Through the association relationship between the text object node and the font subset information, the pointed font resource file is found, and then rendered and displayed, so as to see the display of Chinese characters with complete attributes.
[0069] Through steps S105 and S106, the distinction between text content and font type display is realized. For example, the character "文" is stored as [0x6587] in the computer, which is the text content. When the OFD reader reads this character in the text object node, according to this encoding and through the Font attribute, the font type "文" in the pointed font resource file is found and rendered and displayed, so that we can see the font type and other attributes of the character "文".
[0070] In a specific embodiment, the text content in an initial OFD file is [Chi Mei Wang Liang / Four little devils.], and the Chinese character characters read by the OFD-editor reading editor are [Chi Mei Wang Liang Four little devils]. In the preset font library, according to the encoding of each Chinese character character, the font files of these seven Chinese character characters are searched one by one. The search result is that "Chi Mei Wang Liang" is in font file 2, and "Four little devils" is in font file 1. The font subset information and text information containing "Four little devils" are extracted from font file 1, and the font subset information and text information containing "Chi Mei Wang Liang" are extracted from font file 2. The font subset information is stored in the resource file directory of the initial OFD file. At the same time, a text object node is established in the structure page. The text information of "Chi Mei Wang Liang" and the text information of "Four little devils" are placed in the text object node, and the text object node is associated with the font subset information.
[0071] A new OFD file is generated through steps S101 to S106. The new OFD file can support cross-platform display of rare characters and can be displayed on different platforms instead of garbled characters.
[0072] Specifically, the reading process of step S101 includes steps S101a to S101c:
[0073] Step S101a: Divide the text content in the OFD initial file into multiple text blocks.
[0074] In this embodiment, each text block is composed of a sentence with complete semantics, such as "Where are you", "Life never stops, movement never stops", etc.
[0075] It should be noted that a text block with complete semantics can be a sentence ending with a period, a paragraph, or a piece of text separated by other symbols such as commas. As long as its semantics are complete, there is no limitation here.
[0076] In one example, each text block can be read by a computer in the form of a string. Since the string includes not only Chinese characters but also numbers, letters, etc., it is necessary to remove irrelevant characters such as numbers and letters. Therefore, the following steps are performed to achieve this.
[0077] Step S101b: split the character string in each of the text blocks.
[0078] Step S101c: Read Chinese characters from the split characters.
[0079] In a specific embodiment, the text content in the OFD initial file is [split the string in each of the text blocks, and read the Chinese characters in the split characters], which can be divided into two text blocks, namely [split the string in each of the text blocks] and [read the Chinese characters in the split characters]. For the text block [split the string in each of the text blocks], it is split and each character is read.
[0080] The present invention divides the OFD initial file into multiple text blocks, so that the OFD editing tool can quickly read the text content and improve the reading efficiency. By splitting the character string, it is convenient to quickly read Chinese characters in multiple characters, further improving the reading efficiency.
[0081] The specific process of adding the font subset information to the resource file directory of the OFD initial file includes the following steps S104a-S104b:
[0082] Step S104a: according to the number of font files found, create the same number of font resource files in the resource file directory of the OFD initial file and number them.
[0083] Step S104b: storing the font subset information in the found font file in a font resource file, wherein one font resource file stores the font subset information of one font file.
[0084] In a specific embodiment, for example, an OFD initial file is divided into five text blocks, the Chinese characters in the first four text blocks are all in the regular character font file, and correspond to two regular character font files, font1.ttf file and font3.ttf file. 】, such as "uncommon characters" in the font 1.ttf file, In the font2.ttf file, there are three font files in total. Correspondingly, three font resource files are created and encoded in the resource file directory of the OFD initial file, such as font resource file 1, font resource file 2, and font resource file 3. The font subset information of the Chinese characters of the first four text blocks and the "uncommon characters" characters are stored in font resource file 1 and font resource file 2 respectively. The font subset information is stored in the font resource file 3.
[0085] By extracting font subset information and adding it to the corresponding font resource file in the resource file directory of the OFD initial file, data support for rare characters is provided for the OFD file, thereby helping it to be displayed on different platforms, which can be different readers or different computer terminals.
[0086] Step S105 includes the following steps S105a-S105b:
[0087] Step S105a: Create the same number of text object nodes as the number of font files found.
[0088] A text object node includes one or more characters. The text object node in the OFD standard includes attributes such as font, coordinates, font size, color, and border, and also includes text content. In the embodiment of the present invention, the text object node only stores plain text content.
[0089] Step S105b: storing text information in a font file in each of the text object nodes.
[0090] In a specific embodiment, for example, still taking [Four Little Demons] as an example, corresponding to font file 1 and font file 2, then two text object nodes can be copied in the page structure, namely text object node 1 and text object node 2. The text information of [Four Little Demons] is stored in text object node 1, and the text information of [Four Little Demons] is stored in text object node 2.
[0091] In the embodiment of the present invention, by storing the text information and the font subset information of attributes such as font type separately, only the text information is stored in the text object node, saving the storage space of the text object node.
[0092] In a specific embodiment, associating the text object node with the font subset information can also use the Font attribute of the text object node to associate the text object node with the font subset information containing the text information in the text object node.
[0093] Through the Font attribute, it is convenient to point the text object node to the encoding of the font resource file, and then quickly find the corresponding font subset information.
[0094] Although the above embodiments achieve the cross-platform display of rare characters, there are still some problems. For example, there will be font overlapping. The reason for this phenomenon is that if there are three characters in a text block, the first character and the third character are in one font file, and the second character is in another font file. Then the text information of the first character and the third character will be stored in one text object node, and the text information of the second character will be stored in another text object node. Then when the text is finally displayed, the first character will overlap with the second character.
[0095] Therefore, in another embodiment of the present invention, as Figure 2 shown, it further includes step S107: setting an offset for each Chinese character in the text object node according to the position information of the Chinese characters in the OFD initial file.
[0096] Exemplarily, for example, the data filled in the text block is
[123] , where the font types of [1] and [3] are in font 1, and the font type of [2] is in font 2. It is necessary to extract font subsets 1 and 3 containing the font types of [1] and [3] from font 1, and extract font subset 2 containing the font type of [2] from font 2. Two text object nodes are copied, one stores the text
[13] and points to font subset 1, and the other stores the text [2] and points to font subset 2; if the offset is not set, the display effect is that 1 and 2 overlap, followed by 3. Only by setting an offset for each character of each text object node can the overlapping text block be normally displayed as
[123] .
[0097] In an embodiment of the present invention, the setting size of the offset is set specifically according to the position of each character. For example, in the above example, assuming that the offset of 1 is 0, then the offset of 2 is 1, that is, it is offset backward by the distance of 1 character, and the offset of 3 is 2, that is, it is offset backward by the distance of two characters.
[0098] Through the embodiments of the present invention, uncommon characters can be displayed more clearly and neatly in the OFD file.
[0099] The following is a description of a system for supporting the normal display of uncommon characters in an OFD file provided by the present invention. The system for supporting the normal display of uncommon characters in an OFD file described below and the method for supporting the normal display of uncommon characters in an OFD file described above can be referred to each other. Figure 3 As shown, including:
[0100] The reading unit 301 is used to read Chinese characters in the OFD initial file;
[0101] A search unit 302 is used to search for a corresponding font file in a preset font library for each of the Chinese characters; the preset font library caches regular character font files and rare character font files, and the rare character font files include all rare characters defined in the information technology Chinese coded character set;
[0102] The extraction unit 303 is used to extract the font subset information and text information in the font file; the font subset information at least includes Chinese characters and character attributes corresponding to the Chinese characters; the text information is Chinese characters;
[0103] An adding unit 304 is used to add the font subset information to the resource file directory of the OFD initial file;
[0104] A storage unit 305, used to add the text information to the text object node of the OFD initial file;
[0105] The associating unit 306 is used to associate the text object node with the font subset information to obtain an OFD file that supports the display of rare characters.
[0106] In a specific embodiment, the reading unit is further configured to:
[0107] Divide the text content in the OFD initial file into multiple text blocks;
[0108] Splitting the character string in each of the text blocks;
[0109] Read the Kanji characters in the split characters.
[0110] In a specific embodiment, the adding unit is further configured to:
[0111] According to the number of font files found, create the same number of font resource files in the resource file directory of the OFD initial file and number them;
[0112] The font subset information in the found font file is stored in a font resource file, wherein one font resource file stores the font subset information of one font file.
[0113] In a specific embodiment, the storage unit is further used for:
[0114] Create the same number of text object nodes as the number of font files found;
[0115] The text information in a font file is stored in each of the text object nodes.
[0116] In a specific embodiment, the associating unit is further used to utilize the Font attribute of the text object node to associate the text object node with the font subset information containing the text information in the text object node.
[0117] In another embodiment, the system for supporting normal display of uncommon characters in an OFD file further includes a setting unit for setting an offset for each Chinese character in the text object node according to position information of the Chinese characters in the OFD initial file.
[0118] Figure 4 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 4As shown, the electronic device may include: a processor (processor) 410, a communication interface (Communications Interface) 420, a memory (memory) 830 and a communication bus 440, wherein the processor 810, the communication interface 420, and the memory 430 communicate with each other through the communication bus 440. The processor 410 can call the logic instructions in the memory 430 to execute a method for supporting the normal display of uncommon characters in the OFD file, the method comprising: reading Chinese characters in the OFD initial file; searching for the corresponding font file in the preset font library for each of the Chinese characters; the preset font library caches regular character font files and uncommon character font files, and the uncommon character font files include all uncommon characters defined in GB18030-2022; extracting font subset information and text information in the font file; the font subset information at least includes Chinese characters and the font style, coordinates, font size, and color corresponding to the Chinese characters; the text information is Chinese characters; adding the font subset information to the resource file directory of the OFD initial file; storing the text information in the text object node of the OFD initial file; associating the text node with the font subset information to obtain an OFD file that supports the display of uncommon characters.
[0119] In addition, the logic instructions in the above-mentioned memory 430 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.
[0120] On the other hand, the present invention also provides a computer program product, which includes a computer program, which can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the method provided by the above methods for the OFD file to support the normal display of uncommon characters, the method including: reading Chinese characters in the OFD initial file; searching for the corresponding font file in a preset font library for each of the Chinese characters; the preset font library caches regular character font files and uncommon character font files, and the uncommon character font files include all uncommon characters defined in GB18030-2022; extracting font subset information and text information from the font file; the font subset information at least includes Chinese characters and the font type, coordinates, font size, and color corresponding to the Chinese characters; the text information is Chinese characters; adding the font subset information to the resource file directory of the OFD initial file; storing the text information in the text object node of the OFD initial file; associating the text node with the font subset information to obtain an OFD file that supports the display of uncommon characters.
[0121] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the method provided by the above-mentioned methods for supporting the normal display of uncommon characters in an OFD file, the method comprising: reading Chinese characters in an OFD initial file; searching for a corresponding font file in a preset font library for each of the Chinese characters; the preset font library caches regular character font files and uncommon character font files, and the uncommon character font files include all uncommon characters defined in GB18030-2022; extracting font subset information and text information from the font file; the font subset information at least includes Chinese characters and the font type, coordinates, font size, and color corresponding to the Chinese characters; the text information is Chinese characters; adding the font subset information to the resource file directory of the OFD initial file; storing the text information in a text object node of the OFD initial file; associating the text node with the font subset information to obtain an OFD file that supports the display of uncommon characters.
[0122] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0123] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0124] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for OFD files to support normal display of uncommon characters. It is characterized in that include: Read Chinese characters in the OFD initial file; Searching for a corresponding font file in a preset font library for each of the Chinese characters; The preset font library caches regular character font files and rare character font files, wherein the rare character font files include all rare characters defined in the information technology Chinese coded character set; Extracting font subset information and text information from the font file; the font subset information at least includes Chinese characters and character attributes corresponding to the Chinese characters; The text information is Chinese characters; Add the font subset information to the resource file directory of the OFD initial file; Storing the text information in the text object node of the OFD initial file; The text object node is associated with the font subset information to obtain an OFD file that supports the display of rare characters.
2. The method for supporting normal display of uncommon characters in OFD files according to claim 1, It is characterized in that The reading of Chinese characters in the OFD initial file includes: Divide the text content in the OFD initial file into multiple text blocks; Splitting the character string in each of the text blocks; Read the Kanji characters in the split characters.
3. The method for supporting normal display of uncommon characters in OFD files according to claim 1, It is characterized in that The adding the font subset information to the resource file directory of the OFD initial file comprises: According to the number of font files found, create the same number of font resource files in the resource file directory of the OFD initial file and number them; The font subset information in the found font file is stored in a font resource file, wherein one font resource file stores the font subset information of one font file.
4. The method for supporting normal display of uncommon characters in OFD files according to claim 1, It is characterized in that The storing of the text information into the text object node of the OFD initial file comprises: Create the same number of text object nodes as the number of font files found; The text information in a font file is stored in each of the text object nodes.
5. The method for supporting normal display of uncommon characters in OFD files according to claim 1, It is characterized in that The associating the text node with the font subset information comprises: The Font attribute of the text object node is used to associate the text object node with the font subset information containing the text information in the text object node.
6. The method for supporting normal display of uncommon characters in OFD files according to claim 1, It is characterized in that The method further comprises: An offset is set for each Chinese character in the text object node according to the position information of the Chinese character in the OFD initial file.
7. A system that supports the normal display of uncommon characters in OFD files. It is characterized in that The system comprises: A reading unit, used for reading Chinese characters in the OFD initial file; A search unit, for searching a corresponding font file in a preset font library for each of the Chinese characters; the preset font library caches regular character font files and rare character font files, and the rare character font files include all rare characters defined in the information technology Chinese coded character set; An extraction unit, used to extract font subset information and text information from the font file, wherein the font subset information at least includes Chinese characters and the fonts, coordinates, font sizes, and colors corresponding to the Chinese characters; and the text information is Chinese characters; An adding unit, used for adding the font subset information to the resource file directory of the OFD initial file; A storage unit, used for adding the text information to the text object node of the OFD initial file; The associating unit is used to associate the text node with the font subset information to obtain an OFD file that supports the display of rare characters.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, It is characterized in that When the processor executes the program, the method for supporting normal display of uncommon characters in an OFD file as claimed in any one of claims 1 to 6 is implemented.
9. A non-transitory computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the method for supporting normal display of uncommon characters in an OFD file as claimed in any one of claims 1 to 6 is implemented.
10. A computer program product comprising a computer program, It is characterized in that When the computer program is executed by a processor, the method for supporting normal display of uncommon characters in an OFD file as claimed in any one of claims 1 to 6 is implemented.
