CN111626037A - Font typesetting method and device, electronic equipment and storage medium - Google Patents
Font typesetting method and device, electronic equipment and storage medium Download PDFInfo
- Publication number
- CN111626037A CN111626037A CN202010451111.XA CN202010451111A CN111626037A CN 111626037 A CN111626037 A CN 111626037A CN 202010451111 A CN202010451111 A CN 202010451111A CN 111626037 A CN111626037 A CN 111626037A
- Authority
- CN
- China
- Prior art keywords
- font
- independent
- fonts
- character
- typesetting
- 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
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/10—Text processing
- G06F40/191—Automatic line break hyphenation
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/10—Text processing
- G06F40/189—Automatic justification
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Health & Medical Sciences (AREA)
- Artificial Intelligence (AREA)
- Audiology, Speech & Language Pathology (AREA)
- Computational Linguistics (AREA)
- General Health & Medical Sciences (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Document Processing Apparatus (AREA)
Abstract
The disclosure relates to a font typesetting method, a font typesetting device, an electronic device and a storage medium, wherein the method comprises the following steps: acquiring a font set to be typeset, wherein the font set comprises a plurality of independent fonts to be typeset; if a predefined connection character is detected in the font set, splicing the independent fonts with preset association relation with the connection character into a combined font; and typesetting the independent fonts and the combined fonts which do not participate in splicing in the font set. According to the embodiment of the disclosure, the predefined connection characters are added in the font to be typeset, the size of the blank occupation area does not need to be calculated, or the font is combined into the picture and then the picture is inserted into the blank occupation area, so that the font processing logic is simplified, the code amount of the typesetting program is reduced, and the development efficiency of the typesetting program is improved to a certain extent.
Description
Technical Field
The present disclosure relates to the field of font typesetting, and in particular, to a font typesetting method and apparatus, an electronic device, and a storage medium.
Background
The fonts required to be displayed by the electronic device usually have a display area of a fixed size and may contain a plurality of independent fonts corresponding to key information such as hyphenated compound words in english, price labels consisting of numbers and units, and the like. In the typesetting process before display, if the independent fonts corresponding to the key information are directly typeset respectively, the independent fonts may be displayed in different rows respectively, so that the key information is cut off, and the display effect is inconvenient for the user to read or understand the information.
In order to solve the above problems, in the related art, a rectangular area of a font corresponding to the key information is calculated first, then a blank space occupying area with the same size as the rectangular area is reserved in the typesetting process, and finally a picture generated by the font corresponding to the key information is inserted into the reserved blank space occupying area to complete the typesetting, so that the finally displayed key information cannot be cut off. However, the method not only needs to calculate the parameters of width, height, etc. of the rectangular region of the font corresponding to the key information, but also needs to convert each font into a picture and then insert the picture into the blank space occupying region, and the processing process is complex, so the code amount of the typesetting program is large, and the development efficiency is low.
Disclosure of Invention
The present disclosure provides a font typesetting method, apparatus, electronic device, and storage medium to at least solve the technical problems in the related art. The technical scheme of the disclosure is as follows:
according to a first aspect of the embodiments of the present disclosure, a font typesetting method is provided, including:
acquiring a font set to be typeset, wherein the font set comprises a plurality of independent fonts to be typeset;
if a predefined connection character is detected in the font set, splicing the independent fonts with preset association relation with the connection character into a combined font;
and typesetting the independent fonts and the combined fonts which do not participate in splicing in the font set.
Optionally, the characters corresponding to the independent glyphs in the glyph set include a single character and/or a character string obtained through word segmentation processing.
Optionally, the independent font with a preset association relationship with the connection character includes: at least one adjacent isolated glyph that precedes the join character and/or at least one adjacent isolated glyph that follows the join character.
Optionally, the typesetting the independent glyphs and the merged glyphs in the glyph set that do not participate in splicing includes:
determining a target typesetting area;
and sequentially arranging the independent fonts and the combined fonts which do not participate in splicing in the target typesetting area in rows, and arranging the combined fonts to the next row when the width of the residual typesetting area after arranging the independent fonts in any row is smaller than that of the combined fonts.
Optionally, the method further includes:
and when the sum of the widths of all the independent fonts and the combined fonts to be arranged in any row is larger than the width of the target typesetting area, deleting at least one independent font so that the sum of the widths of the remaining independent fonts and the combined fonts is not larger than the width of the target typesetting area.
Optionally, the method further includes:
and adding a deletion prompt character in the target typesetting area, wherein the deletion prompt character is used for indicating that the deleted independent font exists in the target typesetting area.
Optionally, the character corresponding to the independent font belongs to a character defined by a Unicode encoding system, and the concatenated character is \ u 2060.
According to a second aspect of the embodiments of the present disclosure, a font typesetting apparatus is provided, including:
the system comprises a font set acquisition module, a font setting processing module and a font setting processing module, wherein the font set acquisition module is configured to acquire a font set to be typeset, and the font set comprises a plurality of independent fonts to be typeset;
the font splicing module is configured to splice the independent fonts with preset association relation with the connection characters into a combined font if the predefined connection characters are detected in the font set;
a glyph typesetting module configured to typeset the independent glyphs and the merged glyphs in the glyph set which do not participate in splicing.
Optionally, the characters corresponding to the independent glyphs in the glyph set include a single character and/or a character string obtained through word segmentation processing.
Optionally, the independent font with a preset association relationship with the connection character includes: at least one adjacent isolated glyph that precedes the join character and/or at least one adjacent isolated glyph that follows the join character.
Optionally, the glyph layout module is further configured to:
determining a target typesetting area;
and sequentially arranging the independent fonts and the combined fonts which do not participate in splicing in the target typesetting area in rows, and arranging the combined fonts to the next row when the width of the residual typesetting area after arranging the independent fonts in any row is smaller than that of the combined fonts.
Optionally, the apparatus further comprises:
and the independent font deleting module is configured to delete at least one independent font when the sum of the widths of all the independent fonts and the combined fonts to be arranged in any row is greater than the width of the target typesetting area, so that the sum of the widths of the rest independent fonts and the combined fonts is not greater than the width of the target typesetting area.
Optionally, the apparatus further comprises:
and the prompt character adding module is configured to add and delete prompt characters in the target typesetting area, wherein the deleted prompt characters are used for indicating that the deleted independent fonts exist in the target typesetting area.
Optionally, the character corresponding to the independent font belongs to a character defined by a Unicode encoding system, and the concatenated character is \ u 2060.
According to a third aspect of the embodiments of the present disclosure, an electronic device is provided, including:
a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement the glyph layout method according to any of the embodiments.
According to a fourth aspect of the embodiments of the present disclosure, a storage medium is provided, where instructions executed by a processor of an electronic device enable the electronic device to perform the font typesetting method according to any one of the embodiments.
According to a fifth aspect of the embodiments of the present disclosure, there is provided a computer program product configured to execute the glyph layout method according to any one of the embodiments.
The technical scheme provided by the embodiment of the disclosure at least brings the following beneficial effects:
according to the embodiment of the disclosure, the font corresponding to the key information is directly spliced into the merged font to participate in normal font typesetting by adding the predefined connection characters in the font to be typeset, so that the key information is ensured not to be cut off. And for the combined font after splicing, the size of a rectangular area or a blank space occupying area does not need to be calculated independently, and the font corresponding to the key information does not need to be converted into a picture and inserted into the blank space occupying area, so that the font processing logic in the typesetting process is simplified, the code amount of a typesetting program is reduced, and the development efficiency is improved to a certain extent.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the disclosure and are not to be construed as limiting the disclosure.
FIG. 1 is a schematic diagram of key information being truncated during font typesetting;
FIG. 2 is a diagram illustrating a method for avoiding key information truncation during font typesetting according to the related art;
FIG. 3 is a flow diagram illustrating a method for glyph layout according to an embodiment of the present disclosure;
FIG. 4 is a flow diagram illustrating another glyph layout method according to an embodiment of the present disclosure;
FIG. 5 is a diagram illustrating an effect of a glyph layout method according to one embodiment of the disclosure;
FIG. 6 is a diagram illustrating an effect of a glyph layout method according to a second embodiment of the disclosure;
FIG. 7 is a diagram illustrating an effect of a glyph layout method according to a third embodiment of the disclosure;
FIG. 8 is a diagram illustrating an effect of a glyph layout method according to a fourth embodiment of the disclosure;
FIG. 9 is a diagram illustrating effects of a glyph layout method according to the fifth embodiment of the disclosure;
FIG. 10 is a diagram illustrating an effect of a glyph layout method according to six embodiments of the disclosure;
FIG. 11 is a schematic block diagram illustrating a glyph layout apparatus in accordance with an embodiment of the present disclosure;
fig. 12 is a block diagram illustrating an electronic device according to an embodiment of the present disclosure.
Detailed Description
In order to make the technical solutions of the present disclosure better understood by those of ordinary skill in the art, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings.
It should be noted that the terms "first," "second," and the like in the description and claims of the present disclosure and in the above-described drawings are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the disclosure described herein are capable of operation in sequences other than those illustrated or otherwise described herein. The implementations described in the exemplary embodiments below are not intended to represent all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure, as detailed in the appended claims.
The fonts required to be displayed by the electronic device usually have a display area with a fixed size, and may contain key information, such as compound words with hyphens in english, price tags composed of numbers and units, and the like, which usually correspond to a plurality of independent fonts. In the typesetting process before display, if the independent fonts corresponding to the key information are directly typeset respectively, the independent fonts may be displayed in different rows respectively, thereby causing the key information to be cut off or even lost. The font style "50" corresponding to the price label in fig. 1 comprises three separate fonts "5", "0". And "<" and "5" are displayed in the first row and "0" is displayed in the second row, and the whole number "50" indicating the price is displayed in different rows, respectively, it is obvious that the display effect at this time is not convenient for the user to read, and may even cause a misunderstanding that the user thinks that the price of the commodity is "5 yuan".
The related art adopts a blank space occupying mode to solve the problem that the key information is cut off possibly in the process of typesetting, and fig. 2 is a schematic diagram of a method for avoiding the key information from being cut off in the related art. First, a blank space occupying area with the same size as the rectangular area of the font corresponding to the key information is reserved in the typesetting process (as shown in fig. 2 (a)), and then, a picture generated by the font corresponding to the key information is inserted into the reserved blank space occupying area to complete the typesetting (as shown in fig. 2 (b)), so that the finally displayed key information is not truncated. However, the method not only needs to calculate the parameters of width, height, etc. of the rectangular region of the font corresponding to the key information, but also needs to convert each font into a picture and then insert the picture into the blank space occupying region, so that the processing process is complicated, the code amount of the typesetting program is large, and the development efficiency is low.
In order to solve the above technical problem, an embodiment of the present disclosure provides a font typesetting method, which may be performed by an electronic device, where the electronic device may be a smart phone, a tablet device, a wearable device, a tablet device, a medical device, a fitness device, a computer, a digital broadcast terminal, a messaging device, a game console, a personal digital assistant, or other electronic devices capable of typesetting fonts. The font typesetting program corresponding to the font typesetting method can be a middle application program integrated in an operating system, a background running process, a font typesetting functional component integrated in other application programs and the like; accordingly, the operating system may be an iOS system, an Android (Android) system, a Windows system, and the like, which is not limited by the present disclosure.
FIG. 3 is a flowchart illustrating a glyph layout method according to an embodiment of the present disclosure. The method comprises the following steps:
in step 302, a font set to be laid out is obtained, where the font set includes a plurality of independent fonts to be laid out.
It should be noted that any independent font in the font set to be typeset includes the character corresponding to the font and the description information of the character display effect. For example, the description information may be parameters such as a gray value and an RGB value of each pixel point in the region corresponding to the glyph, or may be a character type corresponding to the glyph, such as sons, regular script, microsoft mauve, Times new roman, and the like, and may also include other related information, which is not described in detail.
In this embodiment, the obtained glyph set to be laid out may include a plurality of independent glyphs to be laid out. As an exemplary embodiment, the characters corresponding to the independent glyphs may include single characters and/or character strings obtained through the word segmentation processing, and correspondingly, the association information of the glyph set may further include word segmentation information of the characters corresponding to the independent glyphs, so as to perform the glyph layout based on the word segmentation result. The characters are subjected to word segmentation processing and then typesetting, so that the font typesetting result can be ensured to meet the semantics of the characters corresponding to each independent font preliminarily, and the range of the independent fonts which correspond to the connection characters and need to be spliced is expanded. As another exemplary embodiment, the characters corresponding to the independent glyphs may include unprocessed single characters, and the layout is directly performed on the independent glyphs corresponding to the single characters, so as to reduce the last invalid blank area of each line, thereby facilitating full utilization of the layout area.
One or more independent glyphs in the glyph set can correspond to key information, wherein the key information can relate to various forms, such as hyphenated compound words in English, price labels formed by numbers and units, proper nouns and the like.
In step 304, if a predefined connection character is detected in the glyph set, the independent glyphs having a preset association relationship with the connection character are spliced into a merged glyph.
In this embodiment, whether a predefined connection character exists in the font set to be typeset is detected, and if the predefined connection character exists, the independent fonts having a preset association relationship with the detected connection character are spliced into a merged font. For example, as an exemplary embodiment, the connection character may be a customized connection character with a connection function that is customized by a developer in advance, so that after the customized connection character in the glyph set is detected, the independent glyphs having a preset association relationship with the connection character are spliced into the merged glyph. The user defines the connection characters by self, so that a developer can select proper characters as the connection characters more flexibly according to the font coding environment and the actual situation, and more efficient font typesetting codes can be developed conveniently.
In an embodiment, the independent font having the preset association relationship with the connection character may be at least one adjacent independent font before the connection character and/or at least one adjacent independent font after the connection character. For example, as an exemplary embodiment, in the case that the concatenated character is a \ u2060 character defined by the Unicode encoding system, the above-mentioned independent glyphs having a preset association relationship with the concatenated character are an independent glyph located before the concatenated character and an independent glyph located after the concatenated character. For example, if the independent fonts including "quotient" and "article" and the connection character "\ u 2060" between them are contained in the font set, the independent fonts "quotient" and "article" are spliced into the merged font "commodity"; for another example, when the font set includes the separate font "commodity" and "selling price" after word segmentation and the connection character "\ u 2060" is included between the two, the separate font "commodity" and the "selling price" are spliced into the merged font "commodity selling price".
As another exemplary embodiment, in the case that the concatenated character is a custom character, the independent glyphs having the preset association relationship with the concatenated character may be n1 independent glyphs located before the concatenated character, n2 independent glyphs located after the concatenated character, n3 independent glyphs located before the concatenated character, and n4 independent glyphs located after the concatenated character; of course, the preset association relationship may also be in various forms, such as an independent font separated from the connection character by n5 independent fonts and located before the connection character, an independent font separated from the connection character by n6 independent fonts and located after the connection character, where n1 to n6 may all be any preset positive integer, and the preset association relationship is not limited in the present disclosure. Developers can preset the incidence relation according to actual conditions, so that the finally generated font typesetting program is simpler and more efficient.
In another embodiment, the characters corresponding to the independent glyphs in the glyph set to be typeset may be characters defined by a Unicode encoding system, and correspondingly, the join character may be a \ u2060 character defined by the Unicode encoding system. The generated typesetting code is simple and efficient and has good portability by adopting the predefined native character \ u2060 in the universal Unicode coding system as the connection character.
In step 306, the independent glyphs and the merged glyphs in the glyph set that do not participate in splicing are typeset.
In an embodiment, the target layout area may be determined first, then the independent fonts and the merged fonts which do not participate in splicing are sequentially arranged in the target layout area in rows, and when the width of the remaining layout area after arranging the independent fonts in any row is smaller than the width of the merged fonts, the merged fonts are arranged to the next row. The combined font generated by the splicing process is used as a whole to participate in typesetting, and the independent fonts with the preset incidence relation with the connection characters are arranged in the same row during typesetting, so that the corresponding key information is not cut off.
For example, the shape of the target layout area may be a rectangle, a positive direction, a circle, an ellipse, an irregular shape, or the like. Moreover, it is understood that the above "rows" may include horizontal rows, vertical rows, and other oblique rows; only one line or a plurality of lines can be arranged in the typesetting area; the height of each row and the space between adjacent rows may be equal or unequal. The shape of the target typesetting area, the direction of the lines in the target typesetting area, the number of lines, the distance and other typesetting parameters can be determined according to the specific application scene, which is not limited by the disclosure.
In another embodiment, if the sum of the widths of all the independent glyphs and the combined glyphs to be arranged is greater than the width of the target layout area, at least one independent glyph is deleted so that the sum of the widths of the remaining independent glyphs and the combined glyphs is not greater than the width of the target layout area. Under the condition that the target typesetting area only has one row to be typeset, the width of the target typesetting area is the width of the row to be typeset; and under the condition that the target typesetting area has a plurality of rows to be typeset, the width of the target typesetting area can be the sum of the widths of the plurality of rows to be typeset. For all the fonts in the self-assembly after the splicing processing, the key degree of the combined font is larger than that of the independent font, so that under the condition that the width of the target typesetting area is smaller than the sum of the widths of the independent font and the combined font (which indicates that all the fonts can not be normally arranged at the moment), the independent font in the font assembly is deleted to ensure that the target typesetting area can normally arrange the residual independent font and the combined font in the font assembly. Meanwhile, because the combined font is reserved, the key information corresponding to the combined font is not lost in the finally displayed font. For example, a preset number of independent glyphs preceding each merged glyph may be deleted; the independent glyphs having a preset second association relationship with the last merged glyph, such as independent glyphs adjacent to the last merged glyph and positioned before and/or after the merged glyph, can also be deleted; the independent glyphs corresponding to the description objects (such as commodities) may also be deleted according to the semantic relationship between each independent glyph in the glyph set and the description objects corresponding to all glyphs, and the like, which is less than a preset threshold, and the disclosure does not limit this.
Further, after deleting at least one independent font, a deletion prompt character can be added in the target layout area to indicate that the deleted independent font exists in the target layout area, so that the user is explicitly informed that the currently displayed font is not all fonts, and the user can know or further view all fonts. For example, the deletion prompt characters may be added at corresponding positions of each deleted independent font in the target layout area; or only adding the corresponding position of the first or the last deleted independent font in the target typesetting area; and adding a deletion prompt character at the tail of the target typesetting area under the condition that the independent font is deleted. Further, a complete display function may be added to the delete prompt character, so that when the user triggers the delete prompt character, all the glyphs in the glyph set are displayed for the user in the updated target layout area, so that the user can obtain complete information corresponding to all the glyphs in the glyph set. Therefore, in the typesetting process, a certain independent font is 'deleted', the independent font is not displayed after typesetting, and the independent font is not deleted in the corresponding storage space.
According to the embodiment of the disclosure, the font corresponding to the key information is spliced into the merged font to participate in normal font typesetting by adding the predefined connection characters in the font to be typeset, so that the key information is ensured not to be cut off. And for the spliced combined font, the size of a rectangular area or a blank space occupying area does not need to be calculated independently, and the font corresponding to the key information does not need to be converted into a picture and inserted into the blank space occupying area, so that the font processing logic in the typesetting process is simplified, the code amount development amount of a typesetting program is reduced, and the development efficiency is improved to a certain extent.
For easy understanding, the technical solution of the present disclosure is further explained below with reference to fig. 4 to 9 by taking the concatenated character as the \ u2060 character defined by the Unicode encoding system as an example. FIG. 4 is a flow chart of another glyph layout method shown in accordance with an embodiment of the present disclosure, referring to FIG. 4:
in step 402, the independent glyphs to be processed are determined.
Before typesetting, the independent font to be processed is firstly determined, wherein the independent font can relate to a plurality of types, such as a word in an English form, a letter in the word and the like, a Chinese character in a Chinese form, a word and the like, or an emoji expression in an image form, a gif picture and the like, and the specific form of the independent font is not limited by the disclosure. Actually, the determined independent font to be processed at this time is the independent font in the font set to be typeset. In fact, the corresponding characters corresponding to the independent glyphs can include single characters and/or character strings obtained through word segmentation processing, and can also include single characters without word segmentation processing.
In step 404, a predefined join character is inserted in the independent glyph to be processed.
In an embodiment, a developer may manually insert a predefined connection character at a preset position of a plurality of independent fonts according to a plurality of independent fonts corresponding to preset key information. In another embodiment, an independent font table corresponding to the key information may be pre-established, and then after all independent fonts to be processed are determined, predefined connection characters are automatically inserted into preset positions of a plurality of independent fonts matched with the independent font table. The independent font table can be pre-established according to specific conditions such as font rules, character characteristics, commodity types and the like.
For example, the preset position of the independent fonts can be the middle of any two adjacent independent fonts in the independent fonts, for example, in a scene that the independent font to be processed is "aluminum alloy folding computer and mobile phone two-in-one bracket 50", if two independent fonts corresponding to the determined key information are respectively "5" and "0", then "u 2060" is inserted between "5" and "0", and the font after the connection character is inserted "aluminum alloy folding computer and mobile phone two-in-one bracket 5\ u 20600" is obtained; for example, if it is determined that three independent fonts corresponding to the key information are 'y', '5' and '0', respectively, then '\\ u 2060' is inserted between 'y', '5' and '0', and the font 'the two-in-one bracket for an aluminum alloy folding computer and mobile phone' is 'y 20605\ u 20600'. The preset positions of the independent fonts can be other positions, and are not described in detail.
In step 406, a set of glyphs to be laid out is determined.
After inserting the connection characters between the independent fonts, the set formed by all the independent fonts and the inserted connection characters is the font set to be typeset.
In step 408, a join character in the set of glyphs to be laid out is detected.
In one embodiment, the layout is detected and executed in real time during the layout process, that is, for any independent font to be laid out, whether a connection character corresponding to the independent font exists is detected (that is, the independent font and the connection character have a preset association relationship), if yes, the procedure goes to step 410; otherwise, if not, the independent font is used as the basic typesetting unit to be typeset, and the step 412 is carried out to participate in the font typesetting. And re-detecting the next independent font after the layout aiming at any independent font is finished, and repeating the processing steps until the layout aiming at all independent fonts in the font set is finished. The basic typesetting unit can comprise an independent font and a combined font.
In another embodiment, all objects in the set of glyphs are first examined to determine whether a connection character is present therein. If any connection character exists in the font set, the step 410 is carried out, and then the next connection character is continuously detected; until all the connection characters in the font set are detected and correspondingly marked or recorded, and then the procedure goes to step 412 for font typesetting.
In step 410, the independent glyphs having the preset association relationship with the connection characters are spliced into a merged glyph.
And after any connection character is detected in the font set, splicing the independent fonts with preset association relation with the connection character into a combined font.
As mentioned above, the preset association relationship may have various forms, for example, two embodiments of inserting the connection character in step 404 are still described as an example: for the font '5 \ u 20600' of an aluminum alloy folding type computer and mobile phone after the connection characters are inserted, wherein the merged font corresponding to the key information is '50'; for the font ' aluminum alloy folding type computer and mobile phone two-in-one bracket ' u20605\ u20600 ' inserted with the connection character, the combined font corresponding to the key information is ' 50 '. In order to distinguish the independent font style from the combined font style in the subsequent typesetting process, a combined mark can be added to the combined font style obtained after splicing, or the connection character in the font style set and the combined font style corresponding to the connection character are recorded in the combined font style table after splicing is finished, so that the spliced combined font style is determined according to the combined mark or the combined font style table in the subsequent typesetting process.
The independent font not participating in splicing in the self-assembly can be aluminum, alloy, gold, folded, computer, mobile phone, machine, second, combined, first, support and frame; under the condition that the characters corresponding to the independent fonts comprise character strings obtained through word segmentation, other basic typesetting units can also be aluminum alloy, folding type, computer, mobile phone, two-in-one and support; of course, other forms are possible and the present disclosure is not intended to be limiting.
In step 412, the independent glyphs and the merged glyphs are laid out.
For a glyph set containing a merged glyph, the basic layout unit in the glyph set at this time comprises an independent glyph and the merged glyph. The process of typesetting the independent fonts and the combined fonts is the process of taking any independent font or any combined font as an inseparable whole (basic typesetting unit) to participate in typesetting according to respective sequence.
In an embodiment, the target layout region and the layout parameters such as the direction, the number of lines, and the distance of the font lines in the target layout region may be determined, then the merged font and the independent fonts which do not participate in the splicing are sequentially arranged in the target layout region in lines, and when the width of the remaining layout region in any line is smaller than the width of the merged font, the merged font is arranged to the next line.
Referring to fig. 5, fig. 5 is a schematic diagram illustrating an effect of a glyph layout method according to one embodiment of the present disclosure, wherein a target layout area is shown by a dashed box in the figure. As shown in fig. 5(a), at this time, the width of the merged glyph "50" is greater than the width of the remaining layout area in the first row in the current target layout area, so the merged glyph "50" is arranged to the second row as shown in fig. 5 (b).
Similarly, referring to fig. 6, fig. 6 is a schematic diagram illustrating an effect of a glyph layout method according to a second embodiment of the disclosure, where the target layout area is shown by a dashed box in the diagram. As shown in fig. 6(a), at this time, the width of the combined font "50" is greater than the width of the remaining layout area in the first row in the current target layout area, so the combined font "@ 50" is arranged to the second row as shown in fig. 6 (b).
In the above embodiments shown in fig. 5(b) and fig. 6(b), the space between all the independent glyphs in the first row may be enlarged by the same amount, so as to fully utilize the remaining layout area of the first row after arranging the merged glyph "50" or "50" to the second row.
In an embodiment, in a case that the sum of the widths of all the independent glyphs not participating in the splicing and the combined glyphs in the glyph set is greater than the sum of the widths of the rows in the target layout area, at least one independent glyph not participating in the splicing may be deleted, so that the sum of the widths of the remaining glyphs in the glyph set is less than or equal to the sum of the widths of the rows in the target layout area.
Referring to fig. 7, fig. 7 is a schematic diagram illustrating an effect of a glyph layout method according to a third embodiment of the disclosure, wherein a target layout area is shown by a dashed box in the figure. As shown in fig. 7(a), the target layout region cannot accommodate all the merged glyphs ("50") of the glyph set and the independent glyphs not participating in the stitching, and at this time, the independent glyph "shelves" preceding and adjacent to the merged glyph "50" may be deleted so that the target layout region can accommodate the remaining glyphs in the glyph set, as shown in fig. 7 (b). Of course, other independent glyphs can be deleted, and are not described in detail.
In another embodiment, a deletion hint character may be added in the target layout area, the deletion hint character indicating that the deleted individual glyph exists in the target layout area.
Referring to fig. 8, fig. 8 is a schematic diagram illustrating an effect of a glyph layout method according to the fourth embodiment of the disclosure, wherein the target layout area is shown by a dashed box in the figure. The target imposition area cannot accommodate all merged glyphs ("50") of a glyph set and independent glyphs not participating in stitching, as shown in fig. 8 (a). At this time, the first independent fonts "aluminum" and "closed" in the row of the merged font "50" can be deleted, as shown in fig. 8 (b); or delete the independent font "skeleton" and "", which precede and are adjacent to the merged font "50", as shown in fig. 8(c), so that the target layout region can accommodate the remaining fonts in the font set. Of course, the independent font in the middle of the row where the merged font "50" is located may be deleted, which is not limited by the present disclosure. The merging font is similar to the above-described font "50", and the description thereof is omitted.
Referring to fig. 9, fig. 9 is a schematic diagram illustrating an effect of a glyph layout method according to the fifth embodiment of the present disclosure. At this time, only one row in the target layout area can be used to lay out the fonts, as shown in fig. 9(a), and the sum of the widths of all the fonts in the font set to be laid out is greater than the width of the target layout area, it is obvious that the target layout area cannot accommodate all the merged fonts ("my50") of the font set and the independent fonts which do not participate in splicing. At this time, a plurality of independent glyphs at the front in the glyph set to be laid out may be deleted, as shown in fig. 9(b), so that the target layout region can accommodate the remaining glyphs in the glyph set. Key independent glyphs (such as "AA", "aluminum alloy", "folded", "two-in-one", "rotated", and "stent") in the glyph set, which have strong correlation with the description object of the glyph set, may also be retained to highlight important information describing the object, as shown in fig. 9 (c).
In addition, when the deletion prompt character is located before the merged font and adjacent to the merged font, the deletion prompt character and the merged font may be secondarily stitched. Referring to fig. 10, fig. 10 is a schematic diagram illustrating the effect of a font typesetting method according to six embodiments of the present disclosure, in which a deletion prompt character "…" and a merged font "50" are secondarily spliced to obtain a merged font "…" as shown in fig. 10(a), at this time, the independent fonts "branch" and "frame" that are before and adjacent to the merged font "…" 50 "may be deleted and replaced with" … "as shown in fig. 10 (b). Corresponding to the embodiment of the font typesetting method, the disclosure also provides an embodiment of the font typesetting device.
Fig. 11 is a schematic block diagram illustrating a glyph layout apparatus according to an embodiment of the present disclosure. The font typesetting device shown in this embodiment may be applied to a font typesetting program, where the font typesetting program is applied to a terminal, and the terminal includes, but is not limited to, an electronic device such as a mobile phone, a tablet computer, a wearable device, and a personal computer.
As shown in fig. 11, the font typesetting apparatus may include:
a font set obtaining module 1101 configured to obtain a font set to be typeset, where the font set includes a plurality of independent fonts to be typeset;
a glyph stitching module 1102 configured to, if a predefined connection character is detected in the glyph set, stitch the independent glyphs having a preset association relationship with the connection character into a merged glyph;
a glyph layout module 1103 configured to layout the independent glyphs and the merged glyphs in the glyph set that do not participate in stitching.
Optionally, the characters corresponding to the independent glyphs in the glyph set include a single character and/or a character string obtained through word segmentation processing.
Optionally, the independent font with a preset association relationship with the connection character includes: at least one adjacent isolated glyph that precedes the join character and/or at least one adjacent isolated glyph that follows the join character.
Optionally, the glyph layout module 1103 is further configured to:
determining a target typesetting area;
and sequentially arranging the independent fonts and the combined fonts which do not participate in splicing in the target typesetting area in rows, and arranging the combined fonts to the next row when the width of the residual typesetting area after arranging the independent fonts in any row is smaller than that of the combined fonts.
Optionally, the apparatus further comprises:
an independent font deleting module 1104 configured to delete at least one of the independent fonts when the sum of the widths of all the independent fonts and the combined fonts to be arranged in any row is greater than the width of the target layout area, so that the sum of the widths of the remaining independent fonts and the combined fonts is not greater than the width of the target layout area.
Optionally, the apparatus further comprises:
a prompt character adding module 1105 configured to add a deletion prompt character in the target layout area, where the deletion prompt character is used to indicate that the deleted independent font exists in the target layout area.
Optionally, the character corresponding to the independent font belongs to a character defined by a Unicode encoding system, and the concatenated character is \ u 2060.
An embodiment of the present disclosure also provides an electronic device, including:
a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement the glyph layout method according to any of the embodiments.
Embodiments of the present disclosure also provide a storage medium, where instructions in the storage medium, when executed by a processor of an electronic device, enable the electronic device to perform the font typesetting method according to any of the above embodiments.
Embodiments of the present disclosure further provide a computer program product configured to execute the glyph layout method according to any one of the above embodiments.
Fig. 12 is a schematic block diagram illustrating an electronic device in accordance with an embodiment of the present disclosure. For example, the electronic device 1200 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, an exercise device, a personal digital assistant, and the like.
Referring to fig. 12, electronic device 1200 may include one or more of the following components: processing component 1202, memory 1204, power component 1206, multimedia component 1208, audio component 1210, input/output (I/O) interface 1212, sensor component 1214, and communications component 1216.
The processing component 1202 generally controls overall operation of the electronic device 1200, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing components 1202 may include one or more processors 1220 that execute instructions to perform all or a portion of the steps of the glyph layout method described above. Further, the processing component 1202 can include one or more modules that facilitate interaction between the processing component 1202 and other components. For example, the processing component 1202 can include a multimedia module to facilitate interaction between the multimedia component 1208 and the processing component 1202.
The memory 1204 is configured to store various types of data to support operation at the electronic device 1200. Examples of such data include instructions for any application or method operating on the electronic device 1200, contact data, phonebook data, messages, pictures, videos, and so forth. The memory 1204 may be implemented by any type or combination of volatile or non-volatile memory devices such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disks.
The power supply component 1206 provides power to the various components of the electronic device 1200. The power components 1206 may include a power management system, one or more power sources, and other components associated with generating, managing, and distributing power for the electronic device 1200.
The multimedia component 1208 includes a screen that provides an output interface between the electronic device 1200 and a user. In some embodiments, the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive an input signal from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 1208 includes a front facing camera and/or a rear facing camera. The front camera and/or the rear camera may receive external multimedia data when the electronic device 1200 is in an operation mode, such as a shooting mode or a video mode. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
The I/O interface 1212 provides an interface between the processing component 1202 and peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to: a home button, a volume button, a start button, and a lock button.
The sensor assembly 1214 includes one or more sensors for providing various aspects of state assessment for the electronic device 1200. For example, the sensor assembly 1214 may detect an open/closed state of the electronic device 1200, the relative positioning of components, such as a display and keypad of the electronic device 1200, the sensor assembly 1214 may also detect a change in the position of the electronic device 1200 or a component of the electronic device 1200, the presence or absence of user contact with the electronic device 1200, orientation or acceleration/deceleration of the electronic device 1200, and a change in the temperature of the electronic device 1200. The sensor assembly 1214 may include a proximity sensor configured to detect the presence of a nearby object in the absence of any physical contact. The sensor assembly 1214 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 1214 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
The communications component 1216 is configured to facilitate communications between the electronic device 1200 and other devices in a wired or wireless manner. The electronic device 1200 may access a wireless network based on a communication standard, such as WiFi, a carrier network (such as 2G, 3G, 4G, or 5G), or a combination thereof. In an exemplary embodiment, the communication component 1216 receives the broadcast signal or broadcast related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communications component 1216 further includes a Near Field Communication (NFC) module to facilitate short-range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, Ultra Wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
In an embodiment of the present disclosure, the electronic device 1200 may be implemented by one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), controllers, micro-controllers, microprocessors or other electronic components for performing the above font typesetting method.
In an embodiment of the present disclosure, there is also provided a non-transitory computer readable storage medium, such as the memory 1204, comprising instructions executable by the processor 1220 of the electronic device 1200 to perform the glyph layout method described above. For example, the non-transitory computer readable storage medium may be a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It will be understood that the present disclosure is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. The terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The method and apparatus provided by the embodiments of the present disclosure are described in detail above, and the principles and embodiments of the present disclosure are explained herein by applying specific examples, and the above description of the embodiments is only used to help understanding the method and core ideas of the present disclosure; meanwhile, for a person skilled in the art, based on the idea of the present disclosure, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present disclosure should not be construed as a limitation to the present disclosure.
Claims (10)
1. A font typesetting method is characterized by comprising the following steps:
acquiring a font set to be typeset, wherein the font set comprises a plurality of independent fonts to be typeset;
if a predefined connection character is detected in the font set, splicing the independent fonts with preset association relation with the connection character into a combined font;
and typesetting the independent fonts and the combined fonts which do not participate in splicing in the font set.
2. The method of claim 1, wherein the characters corresponding to the individual glyphs in the glyph set comprise single characters and/or character strings obtained through word segmentation.
3. The method according to claim 1, wherein the independent glyphs having a preset association relationship with the connection character comprise: at least one adjacent isolated glyph that precedes the join character and/or at least one adjacent isolated glyph that follows the join character.
4. The method of claim 1, wherein typesetting the independent glyphs and the merged glyphs in the glyph set that do not participate in stitching comprises:
determining a target typesetting area;
and sequentially arranging the independent fonts and the combined fonts which do not participate in splicing in the target typesetting area in rows, and arranging the combined fonts to the next row when the width of the residual typesetting area after arranging the independent fonts in any row is smaller than that of the combined fonts.
5. The method of claim 4, further comprising:
and when the sum of the widths of all the independent fonts and the combined fonts to be arranged in any row is larger than the width of the target typesetting area, deleting at least one independent font so that the sum of the widths of the remaining independent fonts and the combined fonts is not larger than the width of the target typesetting area.
6. The method of claim 5, further comprising:
and adding a deletion prompt character in the target typesetting area, wherein the deletion prompt character is used for indicating that the deleted independent font exists in the target typesetting area.
7. The method of claim 1, wherein the character corresponding to the independent glyph belongs to a character defined by the Unicode encoding system, and the concatenated character is \ u 2060.
8. A font typesetting device, comprising:
the system comprises a font set acquisition module, a font setting processing module and a font setting processing module, wherein the font set acquisition module is configured to acquire a font set to be typeset, and the font set comprises a plurality of independent fonts to be typeset;
the font splicing module is configured to splice the independent fonts with preset association relation with the connection characters into a combined font if the predefined connection characters are detected in the font set;
a glyph typesetting module configured to typeset the independent glyphs and the merged glyphs in the glyph set which do not participate in splicing.
9. An electronic device, comprising:
a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement the glyph layout method of any of claims 1-7.
10. A computer-readable storage medium, wherein instructions in the storage medium, when executed by a processor of an electronic device, enable the electronic device to perform the glyph layout method of any of claims 1-7.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202010451111.XA CN111626037A (en) | 2020-05-25 | 2020-05-25 | Font typesetting method and device, electronic equipment and storage medium |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202010451111.XA CN111626037A (en) | 2020-05-25 | 2020-05-25 | Font typesetting method and device, electronic equipment and storage medium |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN111626037A true CN111626037A (en) | 2020-09-04 |
Family
ID=72260007
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202010451111.XA Pending CN111626037A (en) | 2020-05-25 | 2020-05-25 | Font typesetting method and device, electronic equipment and storage medium |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN111626037A (en) |
Citations (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101263450A (en) * | 2005-09-15 | 2008-09-10 | 微软公司 | Enlargement of font characters |
| CN104516866A (en) * | 2013-09-26 | 2015-04-15 | 北大方正集团有限公司 | Text along-line typesetting method |
| US20160274995A1 (en) * | 2015-03-18 | 2016-09-22 | New Iron Systems, Inc. | Diagnostic Tool and Method for Efficient Software Development |
| CN110633437A (en) * | 2018-05-31 | 2019-12-31 | 阿里巴巴集团控股有限公司 | Method and device for omitting display of multiple lines |
| CN111008559A (en) * | 2019-10-31 | 2020-04-14 | 浙江数链科技有限公司 | Typesetting method and system of bill recognition result and computer equipment |
| CN111062186A (en) * | 2019-12-06 | 2020-04-24 | 金蝶软件(中国)有限公司 | Text processing method and device, computer equipment and storage medium |
-
2020
- 2020-05-25 CN CN202010451111.XA patent/CN111626037A/en active Pending
Patent Citations (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101263450A (en) * | 2005-09-15 | 2008-09-10 | 微软公司 | Enlargement of font characters |
| CN104516866A (en) * | 2013-09-26 | 2015-04-15 | 北大方正集团有限公司 | Text along-line typesetting method |
| US20160274995A1 (en) * | 2015-03-18 | 2016-09-22 | New Iron Systems, Inc. | Diagnostic Tool and Method for Efficient Software Development |
| CN110633437A (en) * | 2018-05-31 | 2019-12-31 | 阿里巴巴集团控股有限公司 | Method and device for omitting display of multiple lines |
| CN111008559A (en) * | 2019-10-31 | 2020-04-14 | 浙江数链科技有限公司 | Typesetting method and system of bill recognition result and computer equipment |
| CN111062186A (en) * | 2019-12-06 | 2020-04-24 | 金蝶软件(中国)有限公司 | Text processing method and device, computer equipment and storage medium |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US10761688B2 (en) | Method and apparatus for editing object | |
| JP7617271B2 (en) | Multimedia interaction method, information interaction method, device, equipment, and medium | |
| US20080282153A1 (en) | Text-content features | |
| CN109005283A (en) | Show method, apparatus, terminal and the storage medium of notification message | |
| CN113099297B (en) | Method and device for generating click video, electronic equipment and storage medium | |
| CN113238752B (en) | Code generation method, device, electronic equipment and storage medium | |
| CN110782510B (en) | A sticker generation method and device | |
| CN111612873A (en) | GIF image generation method, device and electronic device | |
| CN111797262B (en) | Poetry generation method, device, electronic device and storage medium | |
| CN105653276A (en) | Method and apparatus for language setting | |
| CN113536172B (en) | Encyclopedia information display method and device and computer storage medium | |
| CN114339076B (en) | Video shooting method, device, electronic device and storage medium | |
| CN113806570A (en) | Image generation method and generation device, electronic device and storage medium | |
| CN107844494B (en) | Entry auditing method and terminal, entry processing method and server | |
| CN118353881A (en) | Method and device for generating multimedia file, electronic equipment and storage medium | |
| CN117670655A (en) | Image generation method, device, electronic equipment, storage medium and chip | |
| CN113920293B (en) | Information identification method, device, electronic equipment and storage medium | |
| CN104951445A (en) | Webpage processing method and device | |
| CN116170626A (en) | Video editing method, device, electronic equipment and storage medium | |
| CN112486362A (en) | Font setting method and device for setting fonts | |
| CN114501042A (en) | Cross-border live broadcast processing method and electronic equipment | |
| CN111626037A (en) | Font typesetting method and device, electronic equipment and storage medium | |
| CN113630644B (en) | Editing method, device and storage medium of video content editor | |
| CN112822394A (en) | Display control method and device, electronic equipment and readable storage medium | |
| CN114021060B (en) | User tag display method and device, electronic equipment and storage medium |
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 |