Glyph layout method and apparatus, electronic device, and storage medium
Patent Information
- Application Number
- CN202010451111.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-05-25
- Publication Date
- 2026-10-27
- Estimated Expiration
- 2040-05-25
AI Technical Summary
但是,该方法不仅需要计算关键信息所对应字形的矩形区域的宽、高等参数,而且还要将各字形转换为图片再插入上述空白占位区域,处理过程较为复杂,因此排版程序的代码量大,开发效率较低
[0040]根据本公开的实施例,通过在待排版字形中添加预定义的连接字符,直接将关键信息所对应字形拼接为合并字形参与正常的字形排版,从而保证了关键信息不会被截断。而且对于拼接后的合并字形,并不需要单独计算矩形区域或空白占位区域的大小,更不需要将关键信息对应的字形转换为图片并插入空白占位区域,从而简化了排版过程中的字形处理逻辑,进而减少了排版程序的代码量,一定程度上提高了开发效率。
Smart Images

Figure CN111626037B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of typesetting, and in particular to typesetting methods, apparatus, electronic devices and storage media. Background Technology
[0002] Electronic devices typically display fonts within a fixed-size display area, and may contain multiple independent fonts corresponding to key information such as compound words with hyphens in English or price tags consisting of numbers and units. If these multiple independent fonts are directly typed separately during the layout process before display, they may be displayed on different lines, resulting in truncated key information and making the display difficult for users to read or understand.
[0003] To address the aforementioned issues, related technologies first calculate the rectangular area corresponding to the key information's glyphs. Then, during the typesetting process, a blank placeholder area of the same size as this rectangular area is reserved. Finally, the image generated from the glyphs corresponding to the key information is inserted into the reserved blank placeholder area to complete the typesetting, ensuring that the final displayed key information is not truncated. However, this method not only requires calculating the width and height parameters of the rectangular area corresponding to the key information's glyphs but also converting each glyph into an image before inserting it into the aforementioned blank placeholder area. The processing is complex, resulting in a large amount of code in the typesetting program and low development efficiency. Summary of the Invention
[0004] This 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 solution of this disclosure is as follows:
[0005] According to a first aspect of the present disclosure, a font typesetting method is proposed, comprising:
[0006] Obtain a set of glyphs to be typed, wherein the set of glyphs contains multiple independent glyphs to be typed;
[0007] If a predefined connecting character is detected in the glyph set, then the independent glyphs that have a preset association with the connecting character are concatenated into a merged glyph;
[0008] The merged glyphs and the independent glyphs in the glyph set that were not joined together are typed.
[0009] Optionally, the characters corresponding to the independent glyphs in the glyph set include single characters and / or strings obtained through word segmentation.
[0010] Optionally, the independent glyphs that have a preset association with the connecting character include: at least one adjacent independent glyph located before the connecting character, and / or at least one adjacent independent glyph located after the connecting character.
[0011] Optionally, the step of typesetting the merged glyphs and the independent glyphs in the glyph set that did not participate in the splicing includes:
[0012] Define the target layout area;
[0013] In the target layout area, the merged glyphs and the independent glyphs that are not involved in the splicing are arranged in rows in sequence. If the width of the remaining layout area after arranging the independent glyphs in any row is less than the width of the merged glyphs, the merged glyphs are arranged to the next row.
[0014] Optionally, the method further includes:
[0015] If the sum of the widths of all the independent glyphs and the merged glyphs to be arranged in any row is greater than the width of the target layout area, delete at least one of the independent glyphs so that the sum of the widths of the remaining independent glyphs and the merged glyphs is not greater than the width of the target layout area.
[0016] Optionally, the method further includes:
[0017] Add a deletion prompt character to the target layout area. The deletion prompt character is used to indicate that there are independent glyphs to be deleted in the target layout area.
[0018] Optionally, the character corresponding to the independent glyph belongs to the character defined by the Unicode encoding system, and the connecting character is \u2060.
[0019] According to a second aspect of the present disclosure, a typesetting apparatus is provided, comprising:
[0020] The glyph set acquisition module is configured to acquire a glyph set to be typed, wherein the glyph set contains multiple independent glyphs to be typed;
[0021] The glyph concatenation module is configured to, if a predefined connecting character is detected in the glyph set, concatenate independent glyphs that have a preset association with the connecting character into a merged glyph;
[0022] The character layout module is configured to layout the merged character shapes and the independent character shapes in the character shape set that are not involved in the splicing.
[0023] Optionally, the characters corresponding to the independent glyphs in the glyph set include single characters and / or strings obtained through word segmentation.
[0024] Optionally, the independent glyphs that have a preset association with the connecting character include: at least one adjacent independent glyph located before the connecting character, and / or at least one adjacent independent glyph located after the connecting character.
[0025] Optionally, the font layout module is further configured as follows:
[0026] Define the target layout area;
[0027] In the target layout area, the merged glyphs and the independent glyphs that are not involved in the splicing are arranged in rows in sequence. If the width of the remaining layout area after arranging the independent glyphs in any row is less than the width of the merged glyphs, the merged glyphs are arranged to the next row.
[0028] Optionally, the device further includes:
[0029] The independent glyph deletion module is configured to delete at least one of the independent glyphs when the sum of the widths of all the independent glyphs and the merged glyphs 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 glyphs and the merged glyphs is not greater than the width of the target layout area.
[0030] Optionally, the device further includes:
[0031] The prompt character adding module is configured to add a deletion prompt character in the target typesetting area, the deletion prompt character being used to indicate that there is a deleted independent glyph in the target typesetting area.
[0032] Optionally, the character corresponding to the independent glyph belongs to the character defined by the Unicode encoding system, and the connecting character is \u2060.
[0033] According to a third aspect of the present disclosure, an electronic device is provided, comprising:
[0034] processor;
[0035] Memory used to store the processor's executable instructions;
[0036] The processor is configured to execute the instructions to implement the character typesetting method as described in any of the above embodiments.
[0037] According to a fourth aspect of the present disclosure, a storage medium is provided that, when instructions in the storage medium are executed by a processor of an electronic device, enables the electronic device to perform the font typesetting method described in any of the above embodiments.
[0038] According to a fifth aspect of the present disclosure, a computer program product is provided, the computer program product being configured to perform the font typesetting method described in any of the above embodiments.
[0039] The technical solutions provided by the embodiments of this disclosure bring at least the following beneficial effects:
[0040] According to embodiments of this disclosure, by adding predefined connecting characters to the glyphs to be typed, the glyphs corresponding to the key information are directly concatenated into a merged glyph for normal glyph typesetting, thus ensuring that the key information is not truncated. Furthermore, for the concatenated merged glyphs, there is no need to separately calculate the size of the rectangular area or blank placeholder area, nor is it necessary to convert the glyphs corresponding to the key information into images and insert them into blank placeholder areas. This simplifies the glyph processing logic in the typesetting process, thereby reducing the amount of code in the typesetting program and improving development efficiency to some extent.
[0041] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description
[0042] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure, and are not intended to unduly limit this disclosure.
[0043] Figure 1 This is a diagram illustrating how key information is truncated during the typesetting process;
[0044] Figure 2 This is a diagram illustrating how related technologies prevent key information from being truncated during typesetting.
[0045] Figure 3 This is a flowchart illustrating a font typesetting method according to an embodiment of the present disclosure;
[0046] Figure 4 This is a flowchart illustrating another typesetting method according to an embodiment of the present disclosure;
[0047] Figure 5 This is a schematic diagram illustrating the effect of a font typesetting method according to one of the embodiments of this disclosure;
[0048] Figure 6 This is a schematic diagram illustrating the effect of a font typesetting method according to a second embodiment of the present disclosure;
[0049] Figure 7 This is a schematic diagram illustrating the effect of a font typesetting method according to Embodiment 3 of this disclosure;
[0050] Figure 8This is a schematic diagram illustrating the effect of a font typesetting method according to Embodiment 4 of this disclosure;
[0051] Figure 9 This is a schematic diagram illustrating the effect of a font typesetting method according to Embodiment 5 of this disclosure;
[0052] Figure 10 This is a schematic diagram illustrating the effect of a font typesetting method according to Embodiment Six of this disclosure;
[0053] Figure 11 This is a schematic block diagram illustrating a typesetting device according to an embodiment of the present disclosure;
[0054] Figure 12 This is a structural diagram of an electronic device according to an embodiment of the present disclosure. Detailed Implementation
[0055] To enable those skilled in the art to better understand the technical solutions of this disclosure, the technical solutions in the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings.
[0056] It should be noted that the terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this disclosure are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this disclosure described herein can be implemented in orders other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this disclosure as detailed in the appended claims.
[0057] Electronic devices typically display fonts with a fixed-size display area, and these fonts may contain critical information, such as hyphenated compound words in English or price tags consisting of numbers and units. This critical information usually corresponds to multiple independent fonts. During the layout process before display, if these multiple independent fonts corresponding to such critical information are directly laid out separately, they may be displayed on different lines, resulting in the truncation or even loss of critical information. For example... Figure 1 The price tag "¥50" consists of three separate characters: "¥", "5", and "0". "¥" and "5" are displayed on the first line, while "0" is on the second. This results in the total price "50" being displayed on separate lines, which is clearly difficult for users to read and could even mislead them into thinking the price is "5 yuan".
[0058] The relevant technology uses blank space as a placeholder to solve the problem of the aforementioned key information being truncated during the typesetting process. Figure 2 This is a schematic diagram illustrating a method in related technologies to prevent critical information from being truncated. First, during the typesetting process, a blank placeholder area of the same size as the rectangular area corresponding to the key information's font is reserved (e.g., ...). Figure 2 (a) shows), then, insert the image generated from the glyphs corresponding to the key information into the reserved blank placeholder area to complete the layout (as shown). Figure 2 (b) shows that the key information displayed in the end will not be truncated. However, this method not only requires calculating the width, height and other parameters of the rectangular area corresponding to the key information, but also converting each character into an image and inserting it into the above-mentioned blank placeholder area. The processing is relatively complicated, which in turn makes the typesetting program's code large and the development efficiency relatively low.
[0059] To address the aforementioned technical problems, this disclosure provides a font typesetting method. This method can be executed by an electronic device, such as a smartphone, tablet, wearable device, medical device, fitness device, computer, digital broadcasting terminal, messaging device, game console, personal digital assistant, or other electronic device capable of font typesetting. The font typesetting program corresponding to the above-mentioned font typesetting method can be an application integrated into an operating system, a background process, or a font typesetting function component integrated into other applications. Correspondingly, the operating system can be iOS, Android, Windows, etc., and this disclosure does not impose any limitations on this.
[0060] Figure 3 This is a flowchart illustrating a font typesetting method according to an embodiment of the present disclosure. The method includes:
[0061] In step 302, a set of glyphs to be typed is obtained, wherein the set of glyphs contains multiple independent glyphs to be typed.
[0062] It should be noted that any independent glyph in the set of glyphs to be typed includes the character corresponding to that glyph and a description of the character's display effect. For example, the description information can be parameters such as the grayscale value and RGB value of each pixel in the area corresponding to that glyph, or it can be the character type corresponding to that glyph, such as SimSun, KaiTi, Microsoft YaHei, Times New Roman, etc. Of course, it can also include other relevant information, which will not be elaborated on here.
[0063] In this embodiment, the acquired set of glyphs to be typed may contain multiple independent glyphs to be typed. As an exemplary embodiment, the characters corresponding to the independent glyphs may include single characters and / or strings obtained through word segmentation. Correspondingly, the association information of the aforementioned glyph set may also include word segmentation information of the characters corresponding to each independent glyph, so as to perform glyph typesetting based on the word segmentation results. Performing word segmentation on the characters before typesetting can initially ensure that the glyph typesetting results conform to the semantics of the characters corresponding to each independent glyph, while also expanding the range of independent glyphs that need to be concatenated corresponding to connecting characters. As another exemplary embodiment, the characters corresponding to the independent glyphs may include unprocessed single characters. Typesetting is performed directly on the independent glyphs corresponding to a single character, which helps reduce the invalid blank areas at the end of each line, thereby facilitating full utilization of the typesetting area.
[0064] One or more independent glyphs in the above glyph set can correspond to key information, which can involve various types of information, such as compound words with hyphens in English, price tags composed of numbers and units, proper nouns, etc.
[0065] In step 304, if a predefined connecting character is detected in the glyph set, then the independent glyphs that have a preset association with the connecting character are concatenated into a merged glyph.
[0066] In this embodiment, it is detected whether a predefined connecting character exists in the set of glyphs to be typed. If a predefined connecting character exists, the independent glyphs with a preset association with the detected connecting character are concatenated into a merged glyph. For example, as an exemplary embodiment, the connecting character can be a custom connecting character with connection function predefined by the developer. After the custom connecting character is detected in the glyph set, the independent glyphs with a preset association with the connecting character are concatenated into a merged glyph. User-defined connecting characters allow developers to more flexibly select appropriate characters as connecting characters based on the glyph encoding environment and actual conditions, thereby facilitating the development of more efficient glyph typesetting code.
[0067] In one embodiment, the independent glyphs having a preset association relationship with the connecting character may be at least one adjacent independent glyph located before the connecting character, and / or at least one adjacent independent glyph located after the connecting character. For example, as an exemplary embodiment, when the connecting character is the \u2060 character defined in the Unicode encoding system, the independent glyphs having a preset association relationship with the connecting character are one independent glyph located before the connecting character and one independent glyph located after the connecting character. For instance, if the glyph set includes the independent glyphs "商" and "品", and the connecting character "\u2060" is included between them, the independent glyphs "商" and "品" are spliced into the combined glyph "商品"; for another instance, when the above glyph set includes the segmented independent glyphs "商品" and "售价", and the connecting character "\u2060" is included between them, the independent glyphs "商品" and "售价" are spliced into the combined glyph "商品售价".
[0068] As another exemplary embodiment, when the connecting character is a custom character, the independent glyphs having a preset association relationship with the connecting character may be n1 independent glyphs located before the connecting character, n2 independent glyphs located after the connecting character, n3 independent glyphs located before the connecting character and n4 independent glyphs located after the connecting character; certainly, the above preset association relationship may also take various forms such as an independent glyph that is n5 independent glyphs apart from the connecting character and located before the connecting character, an independent glyph that is n6 independent glyphs apart from the connecting character and located after the connecting character, wherein the above n1 to n6 may each be any preset positive integer, and the present disclosure does not limit the above preset association relationship. Developers may preset the above association relationship according to actual conditions, so that the finally generated glyph typesetting program is more concise and efficient.
[0069] In another embodiment, the characters corresponding to the independent glyphs in the above glyph set to be typeset may be characters belonging to the Unicode encoding system, and correspondingly, the above connecting character may be the \u2060 character defined in the Unicode encoding system. By using the predefined native character \u2060 in the general Unicode encoding system as the connecting character, the generated typesetting code is not only concise and efficient, but also has good portability.
[0070] In step 306, typesetting is performed on the combined glyphs and the independent glyphs in the glyph set that do not participate in splicing.
[0071] In one embodiment, a target layout area can be determined first. Then, within the target layout area, independent glyphs and merged glyphs that are not involved in splicing are arranged sequentially in rows. If the width of the remaining layout area after arranging the independent glyphs in any row is less than the width of the merged glyph, the merged glyph is moved to the next row. The merged glyph generated through the above splicing process participates in the layout as a whole, ensuring that each independent glyph with a preset association with the connecting character is arranged in the same row during layout, thereby ensuring that its corresponding key information is not truncated.
[0072] For example, the shape of the target typesetting area can be rectangular, upright, circular, elliptical, or even irregular. Furthermore, it is understood that the aforementioned "row" can include horizontal rows, vertical rows, and rows in other slanted directions; the typesetting area can have only one row or multiple rows; the height of each row and the character spacing between adjacent rows can be equal or unequal. The shape of the target typesetting area, the direction of the rows within the target typesetting area, the number of rows, and the spacing, etc., can all be determined according to the specific application scenario, and this disclosure does not impose any restrictions in this regard.
[0073] In another embodiment, if the sum of the widths of all independent and merged 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 and merged glyphs is not greater than the width of the target layout area. Specifically, if the target layout area has only one row to be laid out, the width of the target layout area is the width of that row; if the target layout area has multiple rows to be laid out, the width of the target layout area can be the sum of the widths of the multiple rows. For all glyphs in the aforementioned self-set after splicing, merged glyphs are more critical than independent glyphs. Therefore, if the width of the target layout area is less than the sum of the widths of independent and merged glyphs (indicating that not all glyphs can be arranged correctly), deleting independent glyphs ensures that the target layout area can properly arrange the remaining independent and merged glyphs in the glyph set. Simultaneously, because merged glyphs are retained, the key information corresponding to the merged glyphs is not lost in the final displayed glyphs. For example, a preset number of independent characters located before each merged character can be deleted; independent characters with a preset second association relationship with the last merged character can also be deleted, such as independent characters adjacent to the last merged character and located before and / or after the merged character; independent characters with a semantic relationship with the description corresponding to the description that is less than a preset threshold can also be deleted based on the semantic relationship between each independent character in the above character set and the description object (e.g., product) corresponding to all characters. This disclosure does not impose any restrictions on this.
[0074] Furthermore, after deleting at least one independent glyph, a deletion prompt can be added to the target layout area to indicate the presence of the deleted glyph, thus clearly informing the user that the currently displayed glyphs are not all glyphs, allowing the user to be aware of or further view all glyphs. For example, the deletion prompt can be added at the corresponding position of each deleted independent glyph in the target layout area; it can also be added only at the corresponding position of the first or last deleted independent glyph in the target layout area; or, if any independent glyph has been deleted, the deletion prompt can be added at the end of the target layout area. Furthermore, a full display function can be added to the deletion prompt, so that when the user triggers the deletion prompt, all glyphs in the glyph set are displayed in the updated target layout area, allowing the user to obtain complete information about all glyphs in the set. Therefore, "deleting" an independent glyph during the layout process simply means that the independent glyph is not displayed after layout, rather than being deleted from the corresponding storage space.
[0075] According to embodiments of this disclosure, by adding predefined connecting characters to the glyphs to be typed, the glyphs corresponding to key information are concatenated into merged glyphs to participate in normal glyph typesetting, thereby ensuring that key information is not truncated. Furthermore, for the concatenated merged glyphs, it is not necessary to separately calculate the size of the rectangular area or blank placeholder area, nor is it necessary to convert the glyphs corresponding to key information into images and insert them into blank placeholder areas. This simplifies the glyph processing logic in the typesetting process, reduces the amount of code development required for the typesetting program, and thus improves development efficiency to a certain extent.
[0076] To facilitate understanding, the following example uses the \u2060 character as the concatenation character, as defined by the Unicode encoding system. Figures 4-9 The technical solution disclosed herein will be further explained. Figure 4 This is a flowchart illustrating another typesetting method according to an embodiment of the present disclosure. See also... Figure 4 :
[0077] In step 402, the independent glyphs to be processed are determined.
[0078] Before typesetting, the individual glyphs to be processed are first determined. These individual glyphs can be of various types, such as a word or a letter in an English word, a Chinese character or phrase in Chinese, or an emoji or GIF image in image form. This disclosure does not limit the specific form of the individual glyphs. In fact, the individual glyphs to be processed at this stage are the individual glyphs in the set of glyphs to be typeset. The characters corresponding to the aforementioned individual glyphs can include single characters and / or strings obtained through word segmentation, or single characters that have not undergone word segmentation.
[0079] In step 404, a predefined connection character is inserted into the independent glyph to be processed.
[0080] In one embodiment, developers can manually insert predefined connecting characters at preset positions of multiple independent glyphs corresponding to preset key information. In another embodiment, a table of independent glyphs corresponding to key information can be pre-established. Then, after determining all the independent glyphs to be processed, predefined connecting characters are automatically inserted at preset positions of multiple independent glyphs matching the table. The table of independent glyphs can be pre-established based on specific circumstances such as glyph patterns, character features, and product type.
[0081] For example, the preset position of the aforementioned multiple independent glyphs can be the middle of any two adjacent independent glyphs. In a scenario where the independent glyph to be processed is “Aluminum Alloy Foldable Computer / Mobile Phone 2-in-1 Stand ¥50”, if the two independent glyphs corresponding to the identified key information are “5” and “0”, then “\u2060” is inserted between “5” and “0” to obtain the glyph “Aluminum Alloy Foldable Computer / Mobile Phone 2-in-1 Stand ¥5\u20600” after inserting the connecting character. Alternatively, connecting characters can be inserted continuously between multiple independent glyphs to achieve multiple concatenations. For example, if the three independent glyphs corresponding to the identified key information are “¥”, “5”, and “0”, then “\u2060” is inserted between “¥”, “5”, and “0” to obtain the glyph “Aluminum Alloy Foldable Computer / Mobile Phone 2-in-1 Stand ¥\u20605\u20600” after inserting the connecting character. The preset positions of the aforementioned multiple independent glyphs can also be other positions, which will not be elaborated further.
[0082] In step 406, the set of fonts to be typed is determined.
[0083] After inserting connecting characters between the independent glyphs, the set consisting of all the independent glyphs and the inserted connecting characters is the set of glyphs to be typed.
[0084] In step 408, connecting characters in the set of glyphs to be typed are detected.
[0085] In one embodiment, the typesetting process involves real-time detection and layout. Specifically, for any independent glyph to be typed, it checks whether a corresponding connecting character exists (i.e., the independent glyph and the connecting character have a preset association). If they exist, the process proceeds to step 410; otherwise, if they do not exist, the independent glyph is used as the basic typesetting unit and the process proceeds to step 412 for glyph typesetting. After the typesetting of any independent glyph is completed, the next independent glyph is detected again, and the above processing steps are repeated until the typesetting of all independent glyphs in the glyph set is completed. The basic typesetting unit may include independent glyphs and merged glyphs.
[0086] In another embodiment, all objects in the glyph set are first detected to determine whether any connecting characters exist. If any connecting character is detected in the glyph set, the process proceeds to step 410, and then continues to detect the next connecting character; until all connecting characters in the glyph set are detected and marked or recorded accordingly, the process proceeds to step 412 for glyph layout.
[0087] In step 410, independent glyphs that have a preset association with the connecting characters are concatenated into a merged glyph.
[0088] After detecting any connecting character in the above glyph set, the independent glyphs that have a preset association with the connecting character are concatenated into a merged glyph.
[0089] As mentioned above, the aforementioned preset association can take various forms. For example, let's take the two embodiments of inserting connecting characters in step 404 as examples: For the glyph "Aluminum Alloy Foldable Computer / Mobile Phone Two-in-One Stand ¥5\u20600" after inserting connecting characters, the merged glyph corresponding to the key information is "50"; For the glyph "Aluminum Alloy Foldable Computer / Mobile Phone Two-in-One Stand ¥\u20605\u20600" after inserting connecting characters, the merged glyph corresponding to the key information is "¥50". To facilitate the differentiation between independent glyphs and merged glyphs in subsequent typesetting, a merge mark can be added to the merged glyphs obtained after splicing, or the connecting characters in the glyph set and their corresponding merged glyphs can be recorded in the merged glyph table after splicing, so that the merged glyphs after splicing can be determined according to the aforementioned merge mark or merged glyph table in subsequent typesetting.
[0090] The independent glyphs not participating in the splicing in the aforementioned self-assembled set may be "aluminum", "alloy", "gold", "fold", "stack", "type", "electric", "brain", "hand", "machine", "two", "combine", "one", "support", "rack"; in the case where the characters corresponding to the independent glyphs include character strings obtained through word segmentation processing, other basic typesetting units may also be "aluminum alloy", "foldable", "computer", "mobile phone", "two-in-one", "support bracket"; certainly, other forms are also possible, and the present disclosure does not make any limitation thereto.
[0091] In step 412, typesetting is performed on the independent glyphs and the merged glyphs.
[0092] For a glyph set containing merged glyphs, the basic typesetting units in the glyph set at this time include independent glyphs and merged glyphs. The process of typesetting the independent glyphs and the merged glyphs is a process in which any independent glyph or any merged glyph is regarded as an indivisible whole (basic typesetting unit) and participates in typesetting in their respective sequential order.
[0093] In one embodiment, the target typesetting area and the typesetting parameters such as the direction, number of lines, and spacing of glyph lines within the target typesetting area may be determined first, then the merged glyphs and the independent glyphs not participating in splicing are sequentially arranged line by line in the target typesetting area, and when the width of the remaining typesetting area of any line is less than the width of a merged glyph, the merged glyph is arranged to the next line.
[0094] See Figure 5 , Figure 5 which is a schematic diagram showing the effect of a glyph typesetting method according to one embodiment of the present disclosure, where the target typesetting area is shown by the dashed box in the figure. As shown in Figure 5 (a), at this time, the width of the merged glyph "50" is greater than the width of the remaining typesetting area of the first line in the current target typesetting area, so the merged glyph "50" is arranged to the second line, as shown in Figure 5 (b).
[0095] Similarly, see Figure 6 , Figure 6 which is a schematic diagram showing the effect of a glyph typesetting method according to the second embodiment of the present disclosure, where the target typesetting area is shown by the dashed box in the figure. As shown in Figure 6 (a), at this time, the width of the merged glyph "¥50" is greater than the width of the remaining typesetting area of the first line in the current target typesetting area, so the merged glyph "¥50" is arranged to the second line, as shown in Figure 6 (b).
[0096] In the above Figure 5 (b) and Figure 6In the embodiment shown in (b), the spacing between all independent glyphs in the first line at this time may be equally expanded to make full use of the remaining typesetting area of the first line after the combined glyph "50" or "¥50" is arranged to the second line.
[0097] In one embodiment, when the sum of the widths of all independent glyphs that do not participate in splicing and combined glyphs in the glyph set is greater than the sum of the widths of each line of the target typesetting area, at least one independent glyph that does not participate in 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 each line of the target typesetting area.
[0098] See Figure 7 , Figure 7 which is a schematic diagram showing the effect of a glyph typesetting method according to the third embodiment of the present disclosure, wherein the target typesetting area is shown by the dashed box in the figure. As shown in Figure 7 (a), the target typesetting area cannot accommodate all combined glyphs ("50") and independent glyphs that do not participate in splicing in the glyph set. At this time, the independent glyph "frame" adjacent to and before the combined glyph "50" may be deleted, so that the target typesetting area can accommodate the remaining glyphs in the glyph set, as shown in Figure 7 (b). Certainly, other independent glyphs may also be deleted, which will not be repeated here.
[0099] In another embodiment, a deletion prompt character may be added to the target typesetting area, and the deletion prompt character is used to indicate that there is a deleted independent glyph in the target typesetting area.
[0100] See Figure 8 , Figure 8 which is a schematic diagram showing the effect of a glyph typesetting method according to the fourth embodiment of the present disclosure, wherein the target typesetting area is shown by the dashed box in the figure. The target typesetting area cannot accommodate all combined glyphs ("50") and independent glyphs that do not participate in splicing in the glyph set, as shown in Figure 8 (a). At this time, the independent glyphs "aluminum" and "alloy" at the forefront of the line where the combined glyph "50" is located may be deleted, as shown in Figure 8 (b); or the independent glyphs "frame" and "¥" adjacent to and before the combined glyph "50" may be deleted, as shown in Figure 8 (c), so that the target typesetting area can accommodate the remaining glyphs in the glyph set. Certainly, the independent glyphs in the middle of the line where the combined glyph "50" is located may also be deleted, which is not limited in the present disclosure. The case where the combined glyph is "¥50" is similar to the above, and will not be repeated here.
[0101] See Figure 9 , Figure 9 which is a schematic diagram showing the effect of a glyph typesetting method according to the fifth embodiment of the present disclosure. At this time, there is only one line in the target typesetting area that can perform glyph typesetting, as shown in Figure 9 as shown in (a), and the sum of the widths of all glyphs in the to-be-typeset glyph set is greater than the width of the target typesetting area, it is obvious that the target typesetting area cannot accommodate all merged glyphs ("¥50") and independent glyphs not participating in splicing in the glyph set. At this time, a plurality of independent glyphs at the front part in the to-be-typeset glyph set may be deleted, for example, as Figure 9 shown in (b), so that the target typesetting area can accommodate the remaining glyphs in the glyph set. It is also possible to retain key independent glyphs that are highly relevant to the description object of the glyph set in the glyph set (such as "AA", "aluminum alloy", "fold", "two-in-one", "rotate", "bracket"), so as to focus on displaying important information of the description object, for example, as Figure 9 shown in (c).
[0102] In addition, in the case where the above deletion prompt character is located before and adjacent to the merged glyph, the above deletion prompt character and the merged glyph may also be spliced for a second time. Reference is made to Figure 10 , Figure 10 which is a schematic diagram of the effect of a glyph typesetting method shown according to the sixth embodiment of the present disclosure, the deletion prompt character "..." and the merged glyph "¥50" are secondarily spliced to obtain the merged glyph "...¥50", for example, as Figure 10 shown in (a), at this time, the independent glyphs "bracket" and "stand" that are adjacent to and before the merged glyph "...¥50" may be deleted and replaced with "...¥50", for example, as Figure 10 shown in (b). Corresponding to the foregoing embodiments of the glyph typesetting method, the present disclosure further proposes an embodiment of a glyph typesetting apparatus.
[0103] Figure 11 which is a schematic block diagram of a glyph typesetting apparatus shown according to an embodiment of the present disclosure. The glyph typesetting apparatus shown in this embodiment may be applied to a glyph typesetting program, and the glyph typesetting program is applicable to a terminal, where the terminal includes but is not limited to electronic devices such as a mobile phone, a tablet computer, a wearable device, and a personal computer.
[0104] as Figure 11 shown, the glyph typesetting apparatus may include:
[0105] a glyph set acquisition module 1101, configured to acquire a to-be-typeset glyph set, where the glyph set includes a plurality of to-be-typeset independent glyphs;
[0106] a glyph splicing module 1102, configured to, if a predefined connection character is detected in the glyph set, splice independent glyphs having a preset association relationship with the connection character into a merged glyph;
[0107] a glyph typesetting module 1103, configured to typeset the merged glyph and the independent glyphs not participating in splicing in the glyph set.
[0108] Optionally, the characters corresponding to the independent glyphs in the glyph set include single characters and / or strings obtained through word segmentation.
[0109] Optionally, the independent glyphs that have a preset association with the connecting character include: at least one adjacent independent glyph located before the connecting character, and / or at least one adjacent independent glyph located after the connecting character.
[0110] Optionally, the font typesetting module 1103 is further configured as follows:
[0111] Define the target layout area;
[0112] In the target layout area, the merged glyphs and the independent glyphs that are not involved in the splicing are arranged in rows in sequence. If the width of the remaining layout area after arranging the independent glyphs in any row is less than the width of the merged glyphs, the merged glyphs are arranged to the next row.
[0113] Optionally, the device further includes:
[0114] The independent glyph deletion module 1104 is configured to delete at least one of the independent glyphs when the sum of the widths of all the independent glyphs and the merged glyphs 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 glyphs and the merged glyphs is not greater than the width of the target layout area.
[0115] Optionally, the device further includes:
[0116] The prompt character adding module 1105 is configured to add a deletion prompt character in the target typesetting area, the deletion prompt character being used to indicate that there is a deleted independent glyph in the target typesetting area.
[0117] Optionally, the character corresponding to the independent glyph belongs to the character defined by the Unicode encoding system, and the connecting character is \u2060.
[0118] Embodiments of this disclosure also provide an electronic device, comprising:
[0119] processor;
[0120] Memory used to store the processor's executable instructions;
[0121] The processor is configured to execute the instructions to implement the character typesetting method as described in any of the above embodiments.
[0122] Embodiments of this disclosure also propose a storage medium that, when instructions in the storage medium are executed by a processor of an electronic device, enables the electronic device to perform the font typesetting method described in any of the above embodiments.
[0123] Embodiments of this disclosure also provide a computer program product configured to perform the font typesetting method described in any of the above embodiments.
[0124] Figure 12 This is a schematic block diagram illustrating an electronic device according to embodiments of the present disclosure. For example, the electronic device 1200 may be a mobile phone, computer, digital broadcasting terminal, messaging device, game console, tablet device, medical device, fitness equipment, personal digital assistant, etc.
[0125] Reference Figure 12 The electronic device 1200 may include one or more of the following components: a processing component 1202, a memory 1204, a power supply component 1206, a multimedia component 1208, an audio component 1210, an input / output (I / O) interface 1212, a sensor component 1214, and a communication component 1216.
[0126] Processing component 1202 typically controls the overall operation of electronic device 1200, such as operations associated with display, telephone calls, data communication, camera operation, and recording operations. Processing component 1202 may include one or more processors 1220 to execute instructions to complete all or part of the steps of the aforementioned typography method. Furthermore, processing component 1202 may include one or more modules to facilitate interaction between processing component 1202 and other components. For example, processing component 1202 may include a multimedia module to facilitate interaction between multimedia component 1208 and processing component 1202.
[0127] Memory 1204 is configured to store various types of data to support the operation of electronic device 1200. Examples of such data include instructions for any application or method operating on electronic device 1200, contact data, phonebook data, messages, pictures, videos, etc. Memory 1204 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, 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 storage, flash memory, magnetic disk, or optical disk.
[0128] Power supply component 1206 provides power to various components of electronic device 1200. Power supply component 1206 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to electronic device 1200.
[0129] Multimedia component 1208 includes a screen that provides an output interface between 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 touchscreen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensors may sense not only the boundaries of the touch or swipe action but also the duration and pressure associated with the touch or swipe operation. In some embodiments, multimedia component 1208 includes a front-facing camera and / or a rear-facing camera. When electronic device 1200 is in an operating mode, such as a shooting mode or a video mode, the front-facing camera and / or rear-facing camera may receive external multimedia data. Each front-facing camera and rear-facing camera may be a fixed optical lens system or have focal length and optical zoom capabilities.
[0130] Audio component 1210 is configured to output and / or input audio signals. For example, audio component 1210 includes a microphone (MIC) configured to receive external audio signals when electronic device 1200 is in an operating mode, such as call mode, recording mode, and voice recognition mode. The received audio signals may be further stored in memory 1204 or transmitted via communication component 1216. In some embodiments, audio component 1210 also includes a speaker for outputting audio signals.
[0131] I / O interface 1212 provides an interface between processing component 1202 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to, home buttons, volume buttons, power buttons, and lock buttons.
[0132] Sensor assembly 1214 includes one or more sensors for providing state assessments of various aspects of electronic device 1200. For example, sensor assembly 1214 may detect the on / off state of electronic device 1200, the relative positioning of components such as the display and keypad of electronic device 1200, changes in position of electronic device 1200 or a component of electronic device 1200, the presence or absence of user contact with electronic device 1200, the orientation or acceleration / deceleration of electronic device 1200, and temperature changes of electronic device 1200. Sensor assembly 1214 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. 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, sensor assembly 1214 may also include an accelerometer, gyroscope, magnetometer, pressure sensor, or temperature sensor.
[0133] Communication component 1216 is configured to facilitate wired or wireless communication between electronic device 1200 and other devices. Electronic device 1200 can access wireless networks based on communication standards, such as WiFi, carrier networks (such as 2G, 3G, 4G, or 5G), or combinations thereof. In one exemplary embodiment, communication component 1216 receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, communication component 1216 also includes a near-field communication (NFC) module to facilitate short-range communication. 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.
[0134] In one embodiment of this 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, microcontrollers, microprocessors, or other electronic components to perform the above-described character typesetting method.
[0135] In one embodiment of this disclosure, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 1204 including instructions, which can be executed by a processor 1220 of an electronic device 1200 to complete the above-described character typesetting method. For example, the non-transitory computer-readable storage medium may be a ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage device, etc.
[0136] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the disclosure herein. This disclosure is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the following claims.
[0137] It should be understood that this disclosure is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this disclosure is limited only by the appended claims.
[0138] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. The terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0139] The methods and apparatus provided in the embodiments of this disclosure have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of this disclosure. The descriptions of the embodiments above are only for the purpose of helping to understand the methods and core ideas of this disclosure. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this disclosure. Therefore, the content of this specification should not be construed as a limitation of this disclosure.
Claims
1. A font typesetting method, characterized in that, include: Obtain a set of glyphs to be typed, wherein the set of glyphs contains multiple independent glyphs to be typed; If a predefined connecting character is detected in the glyph set, multiple independent glyphs with a preset positional relationship to the connecting character are concatenated into a merged glyph that does not contain the connecting character, and the connecting character is pre-inserted into the glyph set; The merged glyphs and the independent glyphs in the glyph set that were not joined together are typed.
2. The method according to claim 1, characterized in that, The characters corresponding to the independent glyphs in the glyph set include single characters and / or strings obtained through word segmentation.
3. The method according to claim 1, characterized in that, The independent glyphs that have a preset positional relationship with the connecting character include: at least one adjacent independent glyph located before the connecting character, and / or at least one adjacent independent glyph located after the connecting character.
4. The method according to claim 1, characterized in that, The process of arranging the merged glyphs and the independent glyphs in the glyph set that were not joined together includes: Define the target layout area; In the target layout area, the merged glyphs and the independent glyphs that are not involved in the splicing are arranged in rows in sequence. If the width of the remaining layout area after arranging the independent glyphs in any row is less than the width of the merged glyphs, the merged glyphs are arranged to the next row.
5. The method according to claim 4, characterized in that, The method further includes: If the sum of the widths of all the independent glyphs and the merged glyphs to be arranged in any row is greater than the width of the target layout area, delete at least one of the independent glyphs so that the sum of the widths of the remaining independent glyphs and the merged glyphs is not greater than the width of the target layout area.
6. The method according to claim 5, characterized in that, Also includes: Add a deletion prompt character to the target layout area. The deletion prompt character is used to indicate that there are independent glyphs to be deleted in the target layout area.
7. The method according to claim 1, characterized in that, The characters corresponding to the independent glyphs belong to the characters defined by the Unicode encoding system, and the connecting character is \u2060.
8. A typesetting device, characterized in that, include: The glyph set acquisition module is configured to acquire a glyph set to be typed, wherein the glyph set contains multiple independent glyphs to be typed; The glyph concatenation module is configured to, if a predefined connecting character is detected in the glyph set, concatenate multiple independent glyphs with a preset positional relationship to the connecting character into a merged glyph that does not contain the connecting character, wherein the connecting character is pre-inserted into the glyph set; The character layout module is configured to layout the merged character shapes and the independent character shapes in the character shape set that are not involved in the splicing.
9. The apparatus according to claim 8, characterized in that, The characters corresponding to the independent glyphs in the glyph set include single characters and / or strings obtained through word segmentation.
10. The apparatus according to claim 8, characterized in that, The independent glyphs that have a preset positional relationship with the connecting character include: at least one adjacent independent glyph located before the connecting character, and / or at least one adjacent independent glyph located after the connecting character.
11. The apparatus according to claim 8, characterized in that, The font typesetting module is also configured as follows: Define the target layout area; In the target layout area, the merged glyphs and the independent glyphs that are not involved in the splicing are arranged in rows in sequence. If the width of the remaining layout area after arranging the independent glyphs in any row is less than the width of the merged glyphs, the merged glyphs are arranged to the next row.
12. The apparatus according to claim 11, characterized in that, Also includes: The independent glyph deletion module is configured to delete at least one of the independent glyphs when the sum of the widths of all the independent glyphs and the merged glyphs 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 glyphs and the merged glyphs is not greater than the width of the target layout area.
13. The apparatus according to claim 12, characterized in that, Also includes: The prompt character adding module is configured to add a deletion prompt character in the target typesetting area, the deletion prompt character being used to indicate that there is a deleted independent glyph in the target typesetting area.
14. The apparatus according to claim 8, characterized in that, The characters corresponding to the independent glyphs belong to the characters defined by the Unicode encoding system, and the connecting character is \u2060.
15. An electronic device, characterized in that, include: processor; Memory used to store the processor's executable instructions; The processor is configured to execute the instructions to implement the font typesetting method as described in any one of claims 1 to 7.
16. A computer-readable storage medium, characterized in that, When the instructions in the storage medium are executed by the processor of the electronic device, the electronic device is able to perform the font typesetting method as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Multi-line omission display method and device
CN110633437A
Text processing method and device, computer equipment and storage medium
CN111062186A