CN114707465A - Font file generation method and device, computer equipment and storage medium - Google Patents

Font file generation method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN114707465A
CN114707465A CN202210372726.2A CN202210372726A CN114707465A CN 114707465 A CN114707465 A CN 114707465A CN 202210372726 A CN202210372726 A CN 202210372726A CN 114707465 A CN114707465 A CN 114707465A
Authority
CN
China
Prior art keywords
font
characters
preset
group
file
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210372726.2A
Other languages
Chinese (zh)
Inventor
徐星宇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing ByteDance Network Technology Co Ltd
Original Assignee
Beijing ByteDance Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing ByteDance Network Technology Co Ltd filed Critical Beijing ByteDance Network Technology Co Ltd
Priority to CN202210372726.2A priority Critical patent/CN114707465A/en
Publication of CN114707465A publication Critical patent/CN114707465A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/103Formatting, i.e. changing of presentation of documents
    • G06F40/109Font handling; Temporal or kinetic typography
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Human Computer Interaction (AREA)
  • Document Processing Apparatus (AREA)

Abstract

The present disclosure provides a font file generation method, apparatus, computer device and storage medium, wherein the method comprises: acquiring a font file to be segmented, wherein the font file to be segmented comprises font files of all characters under all preset fonts; all characters in the font file to be segmented are segmented to obtain a plurality of groups of characters; determining at least one preset font corresponding to each group of characters, and determining font subfiles corresponding to the group of characters based on the at least one preset font corresponding to the group of characters; a target font file is determined based on the font subfile.

Description

Font file generation method and device, computer equipment and storage medium
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a font file generation method and apparatus, a computer device, and a storage medium.
Background
Currently, when a user displays a font file stored in a server in a page, the font file generally needs to be completely loaded to display a rendering effect of a font corresponding to the font file. However, the characters displayed in the page are usually common characters, and a complete font file needs to be loaded in order to display the common characters. Under the condition that the font file is large, the loading efficiency of the font file is easily influenced, and more loading time is wasted.
Disclosure of Invention
The embodiment of the disclosure at least provides a font file generation method, a font file generation device, computer equipment and a storage medium.
In a first aspect, an embodiment of the present disclosure provides a font file generating method, where the method includes: acquiring a font file to be segmented, wherein the font file to be segmented comprises font files of all characters under all preset font types; all characters in the font file to be segmented are segmented to obtain a plurality of groups of characters; determining at least one preset font corresponding to each group of characters, and determining font subfiles corresponding to the group of characters based on the at least one preset font corresponding to the group of characters; a target font file is determined based on the font subfile.
In an optional implementation manner, the segmenting all the characters in the font file to be segmented to obtain multiple groups of characters includes: acquiring a preset character type to be segmented; all characters in the font file to be segmented are segmented according to the preset character types to obtain at least one first target character group, wherein each first target character group corresponds to one preset character type; determining the plurality of groups of characters based on the at least one first target group of characters.
In an optional embodiment, the method further comprises: under the condition that all the characters contain other characters except the at least one first target character group, grouping the other characters according to the preset character number to obtain at least one second target character group; said determining the plurality of groups of characters based on the at least one first target group of characters comprises: determining the plurality of groups of characters based on the at least one first target group of characters and the at least one second target group of characters.
In an optional embodiment, the method further comprises: and acquiring a preset character coding range, and determining the number of the preset characters based on the preset character coding range.
In an optional implementation manner, the determining at least one preset font corresponding to each group of the characters and determining a font subfile corresponding to the group of the characters based on the at least one preset font corresponding to the group of the characters includes: acquiring a font mapping file, wherein the font mapping file comprises a mapping relation between each group of characters and a preset font; determining the at least one preset font corresponding to each group of characters based on the font mapping file; and extracting a font file matched with the corresponding at least one preset font from the font files contained in the font file to be divided, and determining the font file as a font subfile of the group of characters.
In an optional embodiment, the determining a target font file based on the font subfile includes: generating a storage address of the font subfile in a preset storage space; and generating a cascading style CSS table by using the storage address and the font sub-file, and determining the cascading style CSS table as the target font file.
In an optional embodiment, the method further comprises: after determining the font subfile corresponding to the group of characters based on at least one preset font corresponding to the group of characters, storing the font subfile into the preset storage space.
In a second aspect, an embodiment of the present disclosure further provides a font file generating apparatus, including: the device comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for acquiring a font file to be segmented, and the font file to be segmented comprises font files of all characters under all preset fonts; the segmentation unit is used for segmenting all characters in the font file to be segmented to obtain a plurality of groups of characters; the first determining unit is used for determining at least one preset font corresponding to each group of characters and determining font subfiles corresponding to the group of characters based on the at least one preset font corresponding to the group of characters; a second determining unit configured to determine a target font file based on the font subfile.
In a third aspect, an embodiment of the present disclosure further provides a computer device, including: a processor, a memory and a bus, the memory storing machine-readable instructions executable by the processor, the processor and the memory communicating via the bus when the computer device is running, the machine-readable instructions when executed by the processor performing the steps of the first aspect described above, or any possible implementation of the first aspect.
In a fourth aspect, this disclosed embodiment also provides a computer-readable storage medium, on which a computer program is stored, where the computer program is executed by a processor to perform the steps in the first aspect or any one of the possible implementation manners of the first aspect.
As can be seen from the above description, after the font file to be segmented is obtained, all the characters in the font file to be segmented may be segmented to obtain a plurality of groups of characters. After determining at least one preset font corresponding to each group of characters, a font subfile corresponding to the group of characters may be determined based on the at least one preset font corresponding to the group of characters, and a target font file may be determined based on the font subfile. Therefore, the font file to be segmented with larger file size can be segmented into a plurality of target font files, the loading efficiency of the font files in the webpage can be improved, and the time and the flow for loading the font files are saved.
In order to make the aforementioned objects, features and advantages of the present disclosure more comprehensible, preferred embodiments accompanied with figures are described in detail below.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the drawings required for use in the embodiments will be briefly described below, and the drawings herein incorporated in and forming a part of the specification illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the technical solutions of the present disclosure. It is appreciated that the following drawings depict only certain embodiments of the disclosure and are therefore not to be considered limiting of its scope, for those skilled in the art will be able to derive additional related drawings therefrom without the benefit of the inventive faculty.
FIG. 1 is a flow chart illustrating a font file generation method provided by an embodiment of the present disclosure;
FIG. 2 is a flowchart illustrating a method for segmenting all characters in a font file to be segmented to obtain a plurality of groups of characters according to an embodiment of the present disclosure;
FIG. 3 is a flowchart illustrating another method for segmenting all characters in a font file to be segmented to obtain a plurality of groups of characters according to an embodiment of the present disclosure;
FIG. 4 illustrates a flow chart of a method for determining a target font file based on a font subfile provided by an embodiment of the present disclosure;
FIG. 5 is a schematic diagram illustrating a method for using a target font file according to an embodiment of the present disclosure;
FIG. 6 illustrates a flow diagram of one embodiment of a font file generation method provided by embodiments of the present disclosure;
FIG. 7 is a schematic diagram of a font file generating apparatus provided by an embodiment of the present disclosure;
fig. 8 shows a schematic diagram of a computer device provided by an embodiment of the present disclosure.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present disclosure more clear, the technical solutions of the embodiments of the present disclosure will be described clearly and completely with reference to the drawings in the embodiments of the present disclosure, and it is obvious that the described embodiments are only a part of the embodiments of the present disclosure, not all of the embodiments. The components of the embodiments of the present disclosure, generally described and illustrated in the figures herein, can be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present disclosure, presented in the figures, is not intended to limit the scope of the claimed disclosure, but is merely representative of selected embodiments of the disclosure. All other embodiments, which can be derived by a person skilled in the art from the embodiments of the disclosure without making any creative effort, shall fall within the protection scope of the disclosure.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures.
The term "and/or" herein merely describes an associative relationship, meaning that three relationships may exist, e.g., a and/or B, may mean: a exists alone, A and B exist simultaneously, and B exists alone. In addition, the term "at least one" herein means any one of a plurality or any combination of at least two of a plurality, for example, including at least one of A, B, C, and may mean including any one or more elements selected from the group consisting of A, B and C.
Research shows that the file size of non-english fonts is generally large, for example, the file size of general chinese fonts is larger than 10 megabytes, and even the file size of some chinese fonts can reach 30 megabytes. When a user displays a font file stored in a server in a page, the font file generally needs to be completely loaded to display a rendering effect of a font corresponding to the font file. However, the characters displayed in the page are usually common characters, and a complete font file needs to be loaded in order to display the common characters. Under the condition that the font file is large, the loading efficiency of the font file is easily influenced, and more loading time is wasted.
Based on the above research, the present disclosure provides a font file generation method, apparatus, computer device, and storage medium. As can be seen from the above description, after the font file to be segmented is obtained, all the characters in the font file to be segmented may be segmented to obtain a plurality of groups of characters. After determining at least one preset font corresponding to each group of characters, a font subfile corresponding to the group of characters may be determined based on the at least one preset font corresponding to the group of characters, and a target font file may be determined based on the font subfile. Therefore, the font file to be segmented with larger file size can be segmented into a plurality of target font files, the loading efficiency of the font files in the webpage can be improved, and the time and the flow for loading the font files are saved.
To facilitate understanding of the present embodiment, a detailed description is first given of a font file generation method disclosed in the embodiments of the present disclosure, and an execution subject of the font file generation method provided in the embodiments of the present disclosure is generally a computer device with certain computing power.
Referring to fig. 1, a flowchart of a font file generation method provided in an embodiment of the present disclosure is shown, where the method includes steps S101 to S107, where:
s101: and acquiring a font file to be segmented, wherein the font file to be segmented comprises font files of all characters under all preset fonts.
Here, the font file to be divided may include characters and glyphs therein. The characters can be understood as characters to be displayed, for example, the characters can be chinese characters, english characters, symbols, and the like. The font can be understood as the display form of the character, for example, the font can be sons body, and also can be Times New Roman and the like.
The preset font can be understood as a preset font, for example, the preset font can be a song style, a regular style, a Times New Roman, or the like. The present disclosure does not specifically limit the type of the predetermined glyph.
In the embodiment of the present disclosure, the number of the preset fonts may be N, where N is a natural number, and the number of the preset fonts is not specifically limited in the present disclosure, so as to be implemented.
In the embodiment of the present disclosure, the font file to be divided may be: a font file containing all characters corresponding to the preset font song, or: and the font file comprises all characters corresponding to the preset font Times New Roman.
S103: and all the characters in the font file to be segmented are segmented to obtain a plurality of groups of characters.
In the embodiment of the present disclosure, all characters in the font file to be segmented may be segmented to obtain a plurality of groups of characters.
In specific implementation, all characters in the font file to be divided can be divided according to a preset dividing method. For example, the preset segmentation method may be a preset method of segmenting according to the character types of all characters in the font file to be segmented to obtain a plurality of groups of characters. Or, the preset segmentation method may also be a method of obtaining a plurality of groups of characters by performing preset segmentation according to the number of characters included in the font file to be segmented.
The preset segmentation method is not particularly limited in the present disclosure, and may be implemented.
S105: and determining at least one preset font corresponding to each group of characters, and determining font subfiles corresponding to the group of characters based on the at least one preset font corresponding to the group of characters.
In the embodiment of the present disclosure, after all characters in a font file to be segmented are segmented to obtain a plurality of groups of characters, at least one preset font corresponding to each group of characters may be determined, for example, the obtained plurality of groups of characters are 3 groups, which are respectively a character group 1, a character group 2, and a character group 3. It is assumed that, for the character group 1, it can be determined that at least one preset glyph corresponding to the character group 1 is: sons and Times New Roman.
Then, a font subfile corresponding to each group of characters can be determined based on at least one preset font corresponding to each group of characters.
For example, for the character group 1 and at least one preset font corresponding to the character group 1: the font subfiles corresponding to the character group 1 can be determined as follows: font subfile 1 and character subfile 2. The font subfile 1 comprises a character group 1 and a preset font sons body, and the font subfile 2 comprises the character group 1 and a preset font Times New Roman.
S107: a target font file is determined based on the font subfile.
In the embodiment of the present disclosure, after the font subfile corresponding to each group of characters is determined, the target font file may be determined based on the font subfile.
As can be seen from the above description, after the font file to be segmented is obtained, all the characters in the font file to be segmented may be segmented to obtain a plurality of groups of characters. After determining at least one preset font corresponding to each group of characters, a font subfile corresponding to the group of characters may be determined based on the at least one preset font corresponding to the group of characters, and a target font file may be determined based on the font subfile. Therefore, the font file to be segmented with larger file size can be segmented into a plurality of target font files, the loading efficiency of the font files in the webpage can be improved, and the time and the flow for loading the font files are saved.
In an alternative embodiment, as shown in fig. 2, for S103: all characters in the font file to be segmented are segmented to obtain a plurality of groups of characters, and the method specifically comprises the following steps:
step S21: acquiring a preset character type to be segmented;
step S22: all characters in the font file to be segmented are segmented according to the preset character types to obtain at least one first target character group, wherein each first target character group corresponds to one preset character type;
step S23: determining the plurality of groups of characters based on the at least one first target group of characters.
As can be seen from the above description, in the embodiment of the present disclosure, the characters may be segmented according to the character types of all the characters in the font file to be segmented, so as to obtain multiple groups of characters. The character type is a preset character type, and the content and the number of the preset character type are not particularly limited in the present disclosure. For example, the preset character type may be a song style, a Times New Roman, or a regular style. In addition, the number of the preset character types may be one or more, and the content and the number of the preset character types are not specifically limited in the present disclosure to meet the actual needs.
In specific implementation, a preset character type to be segmented may be obtained first, and then, the character types of all characters in the font file to be segmented may be segmented according to the preset character type to obtain at least one first target character group.
For example, when the preset character types to be segmented include 3 character types (e.g., english characters, chinese characters, punctuations), the character types of all the characters in the font file to be segmented may be segmented according to the 3 preset character types to obtain 3 first target character groups.
Thereafter, a plurality of sets of characters may be determined based on the determined at least one first target set of characters. For example, in the case where the first target character group is the above-mentioned 3 first target character groups, then each first target character group may be determined as a group of characters. At this time, 3 sets of characters can be determined.
In the above embodiment, the preset character type to be segmented may be obtained first, and then all characters in the font file to be segmented are segmented according to the preset character type, so as to obtain at least one first target character group. And then, based on the mode of determining the multiple groups of characters by the at least one first target character group, the flexible segmentation of all characters in the font file to be segmented can be realized by presetting the character types, and further more diversified multiple groups of characters can be obtained. Meanwhile, multiple groups of characters obtained by segmentation can better meet the actual requirements.
In an optional embodiment, as shown in fig. 3, for the steps S21 to S23, the method of the present disclosure further includes the following steps:
step S31: under the condition that all the characters contain other characters except the at least one first target character group, grouping the other characters according to the preset character number to obtain at least one second target character group;
step S32: said determining the plurality of groups of characters based on the at least one first target group of characters comprises: determining the plurality of groups of characters based on the at least one first target group of characters and the at least one second target group of characters.
In the embodiment of the present disclosure, when all the characters of the font file to be divided include other characters except for the at least one target character set determined in the above steps S21 to S23, the other characters may be grouped according to the preset number of characters to obtain at least one second target character set.
Then, all the characters in the font file to be segmented may be segmented based on the obtained at least one first target character group and at least one second target character group, so as to obtain a plurality of groups of characters.
For example, in the case that all characters in the font file to be divided include other characters (e.g., korean characters) in addition to the 3 preset character types as described above, the other characters (e.g., korean characters) may be grouped by a preset number of characters to obtain at least one second target character group.
In an alternative embodiment, the predetermined number of characters may be determined by the following process:
and acquiring a preset character coding range, and determining the number of the preset characters based on the preset character coding range.
The preset character encoding range may be understood as an encoding range obtained after a certain number of characters are encoded, for example, for a character: the corresponding character coding range (U + 3100-U +312F) can be obtained by the Pinyin alphabet, and at this time, the character coding range (U + 3100-U +312F) can be determined as the preset character coding range.
In the embodiment of the present disclosure, in the case that the preset number of characters is determined based on the preset character encoding range, the number of characters corresponding to the preset character encoding range may be determined as the preset number of characters. For example, in the case where the character encoding range is preset to be (U + 3100-U +312F), the number of characters corresponding to the character encoding range (U + 3100-U +312F) may be determined to be 46, and then the preset number of characters may be determined to be 46.
It should be noted that, the present disclosure does not specifically limit the encoding range of the preset characters, so as to be implemented.
In the foregoing embodiment, when all the characters of the font file to be divided include other characters except for the at least one target character group, the preset character encoding range may be obtained, and the number of the preset characters may be determined based on the preset character encoding range. Then, other characters can be grouped according to the preset character number to obtain at least one second target character group, and multiple groups of characters are determined based on the at least one first target group and the at least one second target character group. Therefore, all characters in the font file to be segmented can be ensured to be segmented, the obtained multiple groups of characters are more accurate, the loading time and the flow of the font file can be further saved, and the loading efficiency of the font file is improved.
In an alternative embodiment, for S105: determining at least one preset font corresponding to each group of characters, and determining font subfiles corresponding to the group of characters based on the at least one preset font corresponding to the group of characters, specifically comprising the following steps:
step S41: acquiring a font mapping file, wherein the font mapping file comprises a mapping relation between each group of characters and a preset font;
step S42: determining the at least one preset font corresponding to each group of the characters based on the font mapping file;
step S43: and extracting a font file matched with the corresponding at least one preset font from the font files contained in the font file to be divided, and determining the font file as a font subfile of the group of characters.
In the embodiment of the present disclosure, the font mapping file includes a mapping relationship between each group of characters and at least one preset font corresponding to the group of characters, and in specific implementation, the font mapping file may be determined by determining a mapping relationship between a character code of each group of characters and each preset font.
Then, at least one preset font corresponding to each group of characters can be determined based on the font mapping file, and a font file matched with the at least one preset font corresponding to each group of characters is extracted from font files contained in the font file to be divided. At this point, the matching font file may be determined as a font subfile for the set of characters.
For example, after the font mapping file is obtained, under the condition that it is determined that a group of characters exists as the character group 1 based on the font mapping file and that a preset font corresponding to the character group 1 is determined as the song body, a font file matched with the preset font song body may be extracted from font files included in the font files to be divided, and the matched font file is determined as a font subfile of the character group 1.
In the foregoing embodiment, the font mapping file may be obtained first, and then at least one preset font corresponding to each group of characters may be determined based on the font mapping file. And then, extracting a font file matched with the at least one corresponding preset font from font files contained in the font file to be divided, and determining the font file as a font subfile of the group of characters. Therefore, the font file to be segmented can be segmented, and font subfiles corresponding to a plurality of groups of characters are obtained. Meanwhile, the accuracy of the obtained font subfiles can be improved.
In an alternative embodiment, as shown in fig. 4, for S107: determining a target font file based on the font subfile, specifically comprising the following steps:
step S51: generating a storage address of the font subfile in a preset storage space;
step S52: and generating a cascading style CSS table by using the storage address and the font sub-file, and determining the cascading style CSS table as the target font file.
In an optional embodiment, after determining the font subfile corresponding to the group of characters based on at least one preset font corresponding to the group of characters, the font subfile is stored in the preset storage space. Then, the storage address of the font subfile in the preset storage space may be recorded. The preset storage space may be a static random access memory register, or the preset storage space may also be any other memory.
In the embodiment of the present disclosure, when the target font file is determined based on the font subfile, a storage address of the font subfile in a preset storage space may be generated first, and then the cascading style CSS table may be generated by using the storage address and the font subfile corresponding to the storage address. The cascading style CSS table can be used for indicating the style of each element in the webpage.
In this embodiment of the present disclosure, the cascading style CSS table may be used to display characters included in the font subfile and a preset font corresponding to the characters.
In the embodiment of the present disclosure, after the cascading style CSS table is generated, the cascading style CSS table may be determined as a target font file corresponding to the group of characters.
In the embodiment of the present disclosure, after the target font file is determined, the target font file may be loaded in the web page using the font-face rule of the cascading style CSS table, and then the characters in the target font file and the fonts corresponding to the characters may be displayed in the web page.
The implementation process of loading the target font file in the web page using the font-face rule of the cascading style CSS table may be the process shown in fig. 5. As shown in fig. 5, in the process of loading the font-face rule using the cascading style CSS table, the display form of the set of characters in the web page may be determined by determining the preset font (i.e., "the name of the font" as shown in fig. 5), the storage address of the font subfile (i.e., "the address of the font storage" as shown in fig. 5), the display form of the set of characters (i.e., "font-style", "font-display", "font-weight" as shown in fig. 5), the preset character encoding range (i.e., "unicode-range" as shown in fig. 5), and other information.
In the foregoing embodiment, after obtaining the font subfile corresponding to each group of characters, a storage location of the font subfile in a preset storage space may be generated, and a cascading style CSS table may be generated by using the storage location and the font subfile. The cascading style CSS table may then be determined as the target font file for the set of characters. Therefore, the cascading style CSS table corresponding to each group of characters can be generated by using the font subfile corresponding to each group of characters and the storage address of the font subfile, and each group of characters obtained by segmentation can be practically applied to a webpage.
The font file generation method provided by the embodiment of the present disclosure can also be described in detail in combination with the flowchart.
For example, as shown in fig. 6, after the font file to be divided is obtained, all the characters in the font file to be divided may be grouped. In specific implementation, as shown in fig. 6, all characters in the font file to be divided may be grouped according to preset character types to be divided (for example, types of english characters, punctuations, and the like), and then, according to the preset number of characters, other characters, except for the character corresponding to the preset character type, in all characters included in the font file to be divided may be grouped to obtain a plurality of groups of characters.
Then, a font subfile corresponding to each group of characters can be determined, and the font subfile is stored in a preset storage space. And simultaneously, recording the storage address of the font subfile. Finally, a cascading style CSS table may be generated based on the storage address of the font subfile and the font subfile, where the cascading style CSS table is the target font file in the embodiment of the present disclosure.
It will be understood by those skilled in the art that in the method of the present invention, the order of writing the steps does not imply a strict order of execution and any limitations on the implementation, and the specific order of execution of the steps should be determined by their function and possible inherent logic.
Based on the same inventive concept, the embodiment of the present disclosure further provides a font file generating apparatus corresponding to the font file generating method, and because the principle of the apparatus in the embodiment of the present disclosure for solving the problem is similar to the font file generating method in the embodiment of the present disclosure, the implementation of the apparatus may refer to the implementation of the method, and repeated details are not described again.
Referring to fig. 7, a schematic diagram of a font file generating apparatus provided in an embodiment of the present disclosure is shown, where the apparatus includes: an acquisition unit 71, a segmentation unit 72, a first determination unit 73, a second determination unit 74; wherein the content of the first and second substances,
the acquiring unit 71 is configured to acquire a font file to be divided, where the font file to be divided includes font files of all characters under preset fonts;
the segmentation unit 72 is configured to segment all characters in the font file to be segmented to obtain a plurality of groups of characters;
a first determining unit 73, configured to determine at least one preset font corresponding to each group of characters, and determine a font subfile corresponding to the group of characters based on the at least one preset font corresponding to the group of characters;
a second determining unit 74 for determining a target font file based on the font subfile.
As can be seen from the above description, after the font file to be segmented is obtained, all the characters in the font file to be segmented may be segmented to obtain a plurality of groups of characters. After determining at least one preset font corresponding to each group of characters, a font subfile corresponding to the group of characters may be determined based on the at least one preset font corresponding to the group of characters, and a target font file may be determined based on the font subfile. Therefore, the font file to be segmented with larger file size can be segmented into a plurality of target font files, the loading efficiency of the font files in the webpage can be improved, and the time and the flow for loading the font files are saved.
In a possible implementation, the segmentation unit is further configured to: acquiring a preset character type to be segmented; all characters in the font file to be segmented are segmented according to the preset character types to obtain at least one first target character group, wherein each first target character group corresponds to one preset character type; determining the plurality of groups of characters based on the at least one first target group of characters.
In a possible implementation, the segmentation unit is further configured to: under the condition that all the characters contain other characters except the at least one first target character group, grouping the other characters according to the preset character number to obtain at least one second target character group; said determining the plurality of groups of characters based on the at least one first target group of characters comprises: determining the plurality of groups of characters based on the at least one first target group of characters and the at least one second target group of characters.
In a possible implementation, the segmentation unit is further configured to: and acquiring a preset character coding range, and determining the number of the preset characters based on the preset character coding range.
In a possible implementation, the first determining unit is further configured to: acquiring a font mapping file, wherein the font mapping file comprises a mapping relation between each group of characters and a preset font; determining the at least one preset font corresponding to each group of the characters based on the font mapping file; and extracting a font file matched with the corresponding at least one preset font from the font files contained in the font file to be divided, and determining the font file as a font subfile of the group of characters.
In a possible implementation, the second determining unit is further configured to: generating a storage address of the font subfile in a preset storage space; and generating a cascading style CSS table by using the storage address and the font sub-file, and determining the cascading style CSS table as the target font file.
In a possible implementation, the second determining unit is further configured to: after determining the font subfile corresponding to the group of characters based on at least one preset font corresponding to the group of characters, storing the font subfile into the preset storage space.
The description of the processing flow of each module in the device and the interaction flow between the modules may refer to the related description in the above method embodiments, and will not be described in detail here.
Corresponding to the font file generating method in fig. 1, an embodiment of the present disclosure further provides a computer device 800, and as shown in fig. 8, a schematic structural diagram of the computer device 800 provided in the embodiment of the present disclosure includes:
a processor 81, a memory 82, and a bus 83; the memory 82 is used for storing execution instructions and includes a memory 821 and an external memory 822; the memory 821 herein is also referred to as an internal memory, and is configured to temporarily store operation data in the processor 81 and data exchanged with the external memory 822 such as a hard disk, the processor 81 exchanges data with the external memory 822 through the memory 821, and when the computer apparatus 800 operates, the processor 81 communicates with the memory 82 through the bus 83, so that the processor 81 executes the following instructions:
acquiring a font file to be segmented, wherein the font file to be segmented comprises font files of all characters under all preset fonts;
all characters in the font file to be segmented are segmented to obtain a plurality of groups of characters;
determining at least one preset font corresponding to each group of characters, and determining font subfiles corresponding to the group of characters based on the at least one preset font corresponding to the group of characters;
a target font file is determined based on the font subfile.
The embodiments of the present disclosure also provide a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the computer program performs the steps of the font file generation method in the foregoing method embodiments. The storage medium may be a volatile or non-volatile computer-readable storage medium.
The embodiments of the present disclosure also provide a computer program product, where the computer program product carries a program code, and instructions included in the program code may be used to execute the steps of the font file generating method in the foregoing method embodiments, which may be referred to specifically in the foregoing method embodiments, and are not described herein again.
The computer program product may be implemented by hardware, software or a combination thereof. In an alternative embodiment, the computer program product is embodied in a computer storage medium, and in another alternative embodiment, the computer program product is embodied in a Software product, such as a Software Development Kit (SDK), or the like.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the system and the apparatus described above may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again. In the several embodiments provided in the present disclosure, it should be understood that the disclosed system, apparatus, and method may be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one logical division, and there may be other divisions when actually implemented, and for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection of devices or units through some communication interfaces, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present disclosure may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a non-volatile computer-readable storage medium executable by a processor. Based on such understanding, the technical solution of the present disclosure may be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present disclosure. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
Finally, it should be noted that: the above-mentioned embodiments are merely specific embodiments of the present disclosure, which are used to illustrate the technical solutions of the present disclosure, but not to limit the technical solutions, and the scope of the present disclosure is not limited thereto, and although the present disclosure is described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: any person skilled in the art can modify or easily conceive of the technical solutions described in the foregoing embodiments or equivalent technical features thereof within the technical scope of the present disclosure; such modifications, changes or substitutions do not depart from the spirit and scope of the embodiments of the present disclosure, and should be construed as being included therein. Therefore, the protection scope of the present disclosure shall be subject to the protection scope of the claims.

Claims (10)

1. A font file generating method, comprising:
acquiring a font file to be segmented, wherein the font file to be segmented comprises font files of all characters under all preset font types;
all characters in the font file to be segmented are segmented to obtain a plurality of groups of characters;
determining at least one preset font corresponding to each group of characters, and determining font subfiles corresponding to the group of characters based on the at least one preset font corresponding to the group of characters;
a target font file is determined based on the font subfile.
2. The method according to claim 1, wherein the segmenting all the characters in the font file to be segmented to obtain a plurality of groups of characters comprises:
acquiring a preset character type to be segmented;
all characters in the font file to be segmented are segmented according to the preset character types to obtain at least one first target character group, wherein each first target character group corresponds to one preset character type;
determining the plurality of groups of characters based on the at least one first target group of characters.
3. The method of claim 2, further comprising:
under the condition that all the characters contain other characters except the at least one first target character group, grouping the other characters according to the preset character number to obtain at least one second target character group;
said determining the plurality of groups of characters based on the at least one first target group of characters comprises: determining the plurality of groups of characters based on the at least one first target group of characters and the at least one second target group of characters.
4. The method of claim 3, further comprising:
and acquiring a preset character coding range, and determining the number of the preset characters based on the preset character coding range.
5. The method of claim 1, wherein the determining at least one preset glyph that each group of the characters corresponds to and determining font subfiles that the group of characters corresponds to based on the at least one preset glyph that the group of characters corresponds to comprises:
acquiring a font mapping file, wherein the font mapping file comprises a mapping relation between each group of characters and a preset font;
determining the at least one preset font corresponding to each group of the characters based on the font mapping file;
and extracting a font file matched with the corresponding at least one preset font from the font files contained in the font file to be divided, and determining the font file as a font subfile of the group of characters.
6. The method of claim 1, wherein determining a target font file based on the font subfile comprises:
generating a storage address of the font subfile in a preset storage space;
and generating a cascading style CSS table by using the storage address and the font sub-file, and determining the cascading style CSS table as the target font file.
7. The method of claim 6, further comprising:
after determining the font subfile corresponding to the group of characters based on at least one preset font corresponding to the group of characters, storing the font subfile into the preset storage space.
8. A font file generating apparatus, comprising:
the device comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for acquiring a font file to be segmented, and the font file to be segmented comprises font files of all characters under all preset fonts;
the segmentation unit is used for segmenting all characters in the font file to be segmented to obtain a plurality of groups of characters;
a first determining unit, configured to determine at least one preset font corresponding to each group of characters, and determine a font subfile corresponding to the group of characters based on the at least one preset font corresponding to the group of characters;
a second determining unit configured to determine a target font file based on the font subfile.
9. A computer device, comprising: a processor, a memory and a bus, the memory storing machine-readable instructions executable by the processor, the processor and the memory communicating over the bus when a computer device is running, the machine-readable instructions when executed by the processor performing the steps of the font file generation method according to any of claims 1 to 7.
10. A computer-readable storage medium, characterized in that the computer-readable storage medium has stored thereon a computer program which, when being executed by a processor, carries out the steps of the font file generating method according to any one of claims 1 to 7.
CN202210372726.2A 2022-04-11 2022-04-11 Font file generation method and device, computer equipment and storage medium Pending CN114707465A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210372726.2A CN114707465A (en) 2022-04-11 2022-04-11 Font file generation method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210372726.2A CN114707465A (en) 2022-04-11 2022-04-11 Font file generation method and device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114707465A true CN114707465A (en) 2022-07-05

Family

ID=82172093

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210372726.2A Pending CN114707465A (en) 2022-04-11 2022-04-11 Font file generation method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114707465A (en)

Similar Documents

Publication Publication Date Title
US7982737B2 (en) System and method for independent font substitution of string characters
CN102939581A (en) Concurrent utilization of document by multiple threads
WO2020005605A1 (en) Table detection in spreadsheet
CN113449187A (en) Product recommendation method, device and equipment based on double portraits and storage medium
CN110956678B (en) Font processing method and device
CN110489424A (en) A kind of method, apparatus, storage medium and the electronic equipment of tabular information extraction
CN109086256B (en) Method for generating and using variable-length word stock dot matrix
US10366142B2 (en) Identifier based glyph search
KR102287149B1 (en) Electronic device that displays a separation line of a paragraph based on text line information in a pdf document and operating method thereof
CN114707465A (en) Font file generation method and device, computer equipment and storage medium
WO2006090406A1 (en) System, method, and apparatus for automatic segmentation and analysis of ink stream
CN109614494B (en) Text classification method and related device
JP2018067264A (en) Data search program, data search device, and data search method
CN110674286A (en) Text abstract extraction method and device and storage equipment
CN110321125B (en) Data configuration method and device for cells and readable storage medium
CN102723067B (en) A kind of character display method and device
CN114548040A (en) Note processing method, electronic device and storage medium
CN115203364A (en) Software fault feedback processing method, device, equipment and readable storage medium
CN113408536A (en) Bill amount identification method and device, computer equipment and storage medium
JP2015052873A (en) Method of automatically generating test data comprising character string, method of identifying signature embedded in test data comprising character string, and computer and computer program of these method
CN114169306A (en) Method, device and equipment for generating electronic receipt and readable storage medium
CN108763871B (en) Hole filling method and device based on third-generation sequencing sequence
CN112765506A (en) Page text content display method, device, equipment and storage medium
CN107301184A (en) It is a kind of to recognize the method and device that word or file generates catalogue
US20180293213A1 (en) Reduced Memory Footprint Font Sample Strings

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information

Address after: 100041 B-0035, 2 floor, 3 building, 30 Shixing street, Shijingshan District, Beijing.

Applicant after: Douyin Vision Co.,Ltd.

Address before: 100041 B-0035, 2 floor, 3 building, 30 Shixing street, Shijingshan District, Beijing.

Applicant before: Tiktok vision (Beijing) Co.,Ltd.

Address after: 100041 B-0035, 2 floor, 3 building, 30 Shixing street, Shijingshan District, Beijing.

Applicant after: Tiktok vision (Beijing) Co.,Ltd.

Address before: 100041 B-0035, 2 floor, 3 building, 30 Shixing street, Shijingshan District, Beijing.

Applicant before: BEIJING BYTEDANCE NETWORK TECHNOLOGY Co.,Ltd.

CB02 Change of applicant information