Summary of the invention
For addressing the above problem, embodiments of the invention provide a kind of disposal route and device of character font data, are used for solving the too much character font data of prior art and cause the size of electronic document very big, the too much problem of IO operation when resolving electronic document.
For this reason, the present invention provides a kind of disposal route of character font data, wherein, comprising:
Obtain the character font data of character set;
Judge in the character font data of said character set and whether have identical font descriptor;
Font descriptor identical in the character font data with said character set merges;
The character map that merges said character set according to the character font data after the said character set merging.
Wherein, also comprise before at the said character font data that obtains character set:
The coded message of obtaining said character set is to obtain said character set.
Wherein, the said character font data that obtains character set also comprises:
Obtain the character map of said character set, said character map comprises character code and character font data index.
Wherein, said character font data after merging according to said character set comprises after merging the character map of said character set:
Character font data after said character set merged and character map updated stored are in the electronic document of said character set.
Wherein, comprise that also the character font data after said character set merged is stored in the character font data file.
The present invention also provides a kind of treating apparatus of character font data, wherein, comprising:
Acquiring unit is used to obtain the character font data of character set;
Judging unit is used for judging whether the font descriptor of said each character of character set is identical;
Merge cells is used for the font descriptor that the character font data of said character set is identical and merges, and merges the character map of said character set according to the character font data after the said character set merging.
Wherein, the said acquiring unit coded message that also is used to obtain said character set is to obtain said character set.
Wherein, said acquiring unit also is used to obtain the character map of the character font data of said character set, and said character map comprises character code and character font data index.
Wherein, also comprise: updating block;
Character font data after said updating block is used for said character set merged and character map updated stored are to the electronic document of said character set.
Wherein, said merge cells also is used for the character font data after the said character set merging is stored in a character font data file.
The present invention has following beneficial effect:
The disposal route of character font data provided by the invention; In the present embodiment, through the same font descriptor of character set is merged, reduced the kind and the quantity of font descriptor and font name in the electronic document; Corresponding quantity and the complexity that has reduced character map; Reduce the size of electronic document simultaneously, thereby reduced the IO number of operations that takes place when resolving electronic document, improved the resolution speed of electronic document.
The treating apparatus of character font data provided by the invention; Obtain the character font data of character set in the electronic document through acquiring unit; Merge into one through font descriptor identical in the character font data of merge cells with character set again, thereby reduced the kind and the quantity of font descriptor in the electronic document and font name, and the character font data after merging according to character set merges the character map of character set; Reduced the quantity of character map; Reduce the size of electronic document, and reduced the IO number of operations that takes place when resolving electronic document, improved the resolution speed of electronic document.
Embodiment
For making those skilled in the art understand technical scheme of the present invention better, be described in detail below in conjunction with the disposal route and the device of accompanying drawing to character font data provided by the invention.
Fig. 1 is the process flow diagram of disposal route first embodiment of character font data provided by the invention.As shown in Figure 1, the idiographic flow of the disposal route of present embodiment character font data comprises the steps:
Step 101, obtain the character font data of character set.
When intelligent terminals such as utilizing terminal is opened a electronic document; At first obtain the coded message of character set on character font data on the terminal, this electronic document and the character font data of describing this character set; The character font data of describing this character set comprises the font descriptor of describing each character in the electronic document character set etc.; Character font data comprises the information such as font size, font and color of character; For example little four or No. 13 of font sizes etc., font are regular script (Type2), lishu (TrueType) and row pattern (OpenType) etc. for example, wherein; Type2, TrueType and OpenType are the font format standard; The character font data of describing this character set is stored in the different character font data files according to certain standard usually, in the present embodiment, can will be stored in the same character font data file with a kind of character font data of font format standard according to the standard of font format standard; After obtaining the character font data of character set, get into step 102.
Step 102, judge in the character font data of character set whether have identical font descriptor.
Character font data comprises the font descriptor of each character; Judge in the character font data of character set and whether have identical font descriptor; In the present embodiment; Character font data can comprise respectively the font descriptor about font size, font, color etc.; For example for character " in " and " state ", if judge " in " with the font size of " state " all be No. 12 then explain about " in " identical with the font descriptor of the font size of " state ", if judge " in " and the color of the font size of " state " all be blue; Then explain about " in " identical with the font descriptor of the color of " state "; If character " in " the font descriptor in font be that font in the font descriptor of regular script (Type2), character " state " is regular script (TrueType) because character " in " with " state " must font title all be regular script, equally also show about " in " be identical with the font descriptor of " state ".Exist after the identical font descriptor in the character font data of judgement character set, get into step 103.
Step 103, the identical font descriptor of character set is merged.
In the present embodiment; Can with character " in " the font descriptor of regular script (TrueType) of font descriptor and " state " of regular script (Type2) merge into a font descriptor, " in " with font after " state " merging be regular script, simultaneously; Will " in " and the font descriptor about font size of " state " merge into one; Font size after the merging is No. 12, will " in " with the font descriptor about color of " state " merge into one, the font size after the merging be the blueness.Obtain describing after the font descriptor after the merging of this electronic document character set, get into step 104.
Step 104, the character font data after merging according to character set merge the character map of character set.
After the font descriptor that each item is identical merges; Obtain describing the character font data after this electronic document character set merges, preferably, the character font data after merging is stored in the character font data file; Then according to the character map of the character font data file modify character set after merging; Character map is used for representing the positional information of the corresponding font descriptor of each character at the character font data file, and after character font data merged, the value volume and range of product of the font descriptor of character set obviously reduced; The quantity of character set corresponding characters mapping table is obviously reduced, and structure is also more simple and clear.
In the present embodiment; Same font descriptor through with character set merges; Reduced the kind and the quantity of font descriptor and font name in the electronic document, corresponding quantity and the complexity that has reduced character map reduced the size of electronic document simultaneously; Thereby reduced the IO number of operations that takes place when resolving electronic document, improved the resolution speed of electronic document.
Fig. 2 is the process flow diagram of disposal route second embodiment of character font data provided by the invention.As shown in Figure 2, the idiographic flow of the disposal route of present embodiment character font data comprises the steps:
Step 201, read character set coded message to obtain character set.
When needs are consulted the character set of storing on the electronic document; At first to obtain coded message about all characters of this electronic document; Wherein, The coded system of character is Unicode, GBK etc. for example, unified binary coding that Unicode or GBK etc. has been encoded to each character setting in every kind of language, and intelligent terminal is to obtain character set through codings such as Unicode that reads character set in the electronic document or GBK.Obtain after the character set in the electronic document, get into step 202.
Step 202, obtain the character font data of character set.
The font descriptor that comprises all characters in this electronic document in the character font data of character set.Present embodiment is that example is introduced technical scheme when being converted into the CEBX document with the PDF document, and Fig. 3 is an electronic document character set among disposal route second embodiment of character font data provided by the invention, and Fig. 4 is the character font data of electronic document character set among Fig. 3.The character font data that obtains the character set in the PDF document shown in Figure 3 comprises 6 kinds of font descriptors shown in Figure 4; 6 kinds of font descriptors of character set comprise mathematical formulae character set and alphabetic character collection; Wherein, The both font types of mathematical formulae character set is respectively Cambria Math and Calibri; Four kinds of fonts of alphabetic character collection are respectively regular script (Type2), regular script (TrueType), Microsoft refined black (Type2) and Microsoft refined black (TrueType), and in the present embodiment, the corresponding character font data of Microsoft refined black (Type2) is stored in the first character font data file; The corresponding character font data of Microsoft refined black (TrueType) is stored in the second character font data file, and the character font data file embeds and is stored in the electronic document.
Step 203, obtain the character map of each character in the character set.
With " Pythagorean theorem " shown in Figure 3 is example; Wherein, " collude " and the font of " thigh " is refined black (Type2) font of Microsoft, its character font data is stored in the first character font data file, and the character map that concerns between character code and the character font data index is as shown in table 1; Wherein, 0001 and 0002 be used for representing the position of the corresponding font descriptor of character in the character font data index at the first character font data file.
The coded message of character (sexadecimal) |
The character font data index |
52FE |
0001 |
80A1 |
0002 |
Table 1
" decide " and the font of " reason " is refined black (TrueType) font of Microsoft; Its character font data is stored in the second character font data file; Its character map is as shown in table 2; Wherein, 0001 and 0002 be used for representing the position of the corresponding font descriptor of character in the character font data index at the second character font data file.
The coded message of character (sexadecimal) |
The character font data index |
5B9A |
0001 |
7406 |
0002 |
Table 2
After the character font data file and character map of the various character font datas in obtaining character set, get into step 204.
Step 204, judge in the character font data of character set whether have identical font descriptor.
According to the font descriptor of each character in the character set, judge whether each font descriptor of describing the character font size is identical, judge whether the font descriptor of describing character color is identical.Be to convert the PDF document into the CEBX document in the present embodiment; In the CEBX document; The font Cambria Math and the Calibri of mathematical formulae character set has identical font descriptor; Regular script (Type2) has identical font descriptor with regular script (TrueType), and Microsoft refined black (Type2) has identical font descriptor with Microsoft refined black (TrueType).When in the character font data of character set, having identical font descriptor, get into step 205.
Step 205, the same font descriptor of character set is merged, to obtain the character font data after character set merges.
According to TrueType and this both font types format specification of Type2, with the same font descriptor merging of Fig. 3 character set, the font before and after merging is as shown in table 3.
Table 3
Step 206, the character font data after merging according to character set merge the character map of character set.
In the present embodiment; The character map of " colluding " and " thigh " was as shown in table 1 before character font data merged; The character map of " deciding " and " reason " was as shown in table 2 before character font data merged, and can be known by step 204, and refined black (Type2) font of Microsoft is identical with the font descriptor of refined black (TrueType) font of Microsoft; Can merge into a font descriptor; Thereby the character font data after obtaining merging, preferably, the character font data after the merging is stored in the character font data file; According to the character map that concerns between character font data modify charset after merging and the character code, thereby the character map of the character font data after obtaining merging is as shown in table 3.
Character code (sexadecimal) |
The character font data index |
52FE |
0001 |
80A1 |
0002 |
5B9A |
0003 |
7406 |
0004 |
Table 3
In the electronic document that step 207, the character font data after character set merged and character map update stored in character set.
Character font data after merging and character map be embedded in this electronic document preserve; Character font data file and the character map thereof that just will store the character font data after merging are embedded in this electronic document to be preserved; Because total size of the character font data of character set is dwindled; And the quantity of character map obtains reducing, thereby has dwindled the character font data that stores after the merging and the size of character map, has further reduced the size of electronic document; And when opening electronic document once more, the IO number of operations that corresponding minimizing takes place when resolving electronic document.
In the embodiment of the invention; Through the same font descriptor of character is merged, reduced the kind and the quantity of font descriptor and font name in the electronic document, the size of having dwindled the character font data of character set; And simplified character map; Reduce the size of electronic document, thereby reduced the IO number of operations that takes place when resolving electronic document, improved the resolution speed of electronic document.
Fig. 5 is the structural representation of treating apparatus first embodiment of character font data provided by the invention.As shown in Figure 5; The treating apparatus of the character font data that present embodiment provides comprises: acquiring unit 501, judging unit 502 and merge cells 503; Wherein, Acquiring unit 501 is used for obtaining the character font data of all character set of electronic document, and judging unit 502 is used for judging whether the font descriptor of each character of character set is identical, if judge that the font descriptor of each character is identical; Merge cells 503 is merged into a font descriptor with same font descriptor in the character font data of character set; Reducing the quantity of font descriptor, and the character font data after merging according to character set merges the character map of character set, and this device can be applied on the display device of electronic documents such as computing machine, printer.
In the present embodiment; Obtain the character font data of character set in the electronic document through acquiring unit; Merge into one through font descriptor identical in the character font data of merge cells with character set again, thereby reduced the kind and the quantity of font descriptor in the electronic document and font name, and the character font data after merging according to character set merges the character map of character set; Reduced the quantity of character map; Reduce the size of electronic document, and reduced the IO number of operations that takes place when resolving electronic document, improved the resolution speed of electronic document.
Further, the coded message that acquiring unit 501 can also be used to obtain character set is obtaining character set, and the character map that can also obtain character set, and character map comprises character code and character font data index.
Fig. 6 is the structural representation of treating apparatus the 3rd embodiment of character font data provided by the invention.As shown in Figure 6; The treating apparatus of the character font data that present embodiment provides also comprises updating block 504; Character font data after updating block 504 merges character set and character map updated stored are in the electronic document of character set, and character font data file and the character map thereof that just will store the character font data after the merging are embedded in this electronic document to be preserved, and total size of the character font data of character set is dwindled; And the corresponding minimizing of the quantity that makes character map; Thereby dwindle the size of electronic document, and when opening electronic document once more, the IO number of operations that corresponding minimizing takes place when resolving electronic document.
Further, the character font data after merge cells 503 also is used for character set merged is stored in a character font data file, updating block 504 with this character font data file updated stored in the electronic document of character set.
In the present embodiment, obtain the character font data of all character set in the electronic document through acquiring unit, whether identical through the font descriptor of each character of judgment unit judges; Merge cells merges identical font descriptor; Reduce the kind and the quantity of font descriptor in the electronic document and font name, thereby reduced total size of character font data, the character map of the character font data merging character set after merge cells also will merge according to character set; Make the also corresponding minimizing of quantity of character map; Thereby reduce the size of electronic document, and reduce the IO number of operations that takes place when resolving electronic document, improved the resolution speed of electronic document.
It is understandable that above embodiment only is the illustrative embodiments that adopts for principle of the present invention is described, yet the present invention is not limited thereto.For the one of ordinary skilled in the art, under the situation that does not break away from spirit of the present invention and essence, can make various modification and improvement, these modification also are regarded as protection scope of the present invention with improving.