Character display method and device, electronic equipment and storage medium

By determining the information of the target character under the original font and the replacement font, the layout adjustment is made, which solves the character layout problem caused by the lack of original fonts in the computer and improves the readability of character display.

CN119150797APending Publication Date: 2024-12-17ZHUHAI KINGSOFT OFFICE SOFTWARE +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310724495.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-06-16
Publication Date
2024-12-17

AI Technical Summary

Technical Problem

In the prior art, when the original font is lacking in the computer, using a replacement font for character display will lead to character layout problems, such as inconsistent character spacing, resulting in dyslexia.

Method used

Typesetting adjustments are made by determining the information of the target character under the original font and the replacement font, including area information, origin position and size, so that the character position displayed in the replacement font is close to the position displayed in the original font, reducing the impact of typesetting.

Benefits of technology

It effectively reduces the impact of font replacement on character typesetting before and after font replacement, and reduces the negative impact of typography problems on user reading.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119150797A_ABST
    Figure CN119150797A_ABST
Patent Text Reader

Abstract

The embodiment of the invention relates to a character display method and device, electronic equipment and a storage medium. The method comprises the steps that first character information of a target character is determined; wherein the first character information is the information of the target character under the condition that the target character is drawn according to the original font; the original fonts are fonts which do not exist locally; determining second character information of the target character based on the first character information; wherein the second character information is the information of the target character under the condition that the target character is drawn according to a replacement font; the replacement fonts are locally existing fonts; and displaying a target character according to a replacement font based on the second character information. Therefore, the position of the character displayed by the replacement font is close to the position of the character displayed by the original font, so that the influence on character typesetting before and after font replacement is reduced, and the reading influence of the typesetting problem on a user can be reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a character display method, device, electronic device and storage medium. Background Art

[0002] In the prior art, if the original font is not available in the computer, a default font is selected in the computer as a replacement font for the original font. However, since the original font and the replacement font have different designs, the fonts of each identical character are different. The font is affected by various parameters, such as the occupied width, occupied height, and the distance between other characters. Even when the font size is the same, the size of each character is different.

[0003] In this scenario, after replacing the original font with a replacement font, the typesetting of characters is prone to misalignment. For example, the character spacing in some words is too wide, which is easy to be misunderstood as multiple words; the character spacing in some words is too narrow, which is easy to cause character overlap or even connect with other words. For example, kingsoft office becomes kingsoft office. This seriously affects reading. Summary of the invention

[0004] In view of this, in order to solve some or all of the above technical problems, the embodiments of the present application provide a character display method, device, electronic device and storage medium.

[0005] In a first aspect, an embodiment of the present application provides a character display method, the method comprising:

[0006] Determine first character information of a target character; wherein the first character information is: information of the target character when the target character is drawn according to an original font; the original font is a font that does not exist locally;

[0007] Based on the first character information, second character information of the target character is determined; wherein the second character information is: information of the target character when the target character is drawn according to a replacement font; the replacement font is a locally existing font;

[0008] Based on the second character information, the target character is typeset to display the target character in the replacement font.

[0009] In a possible implementation manner, determining the second character information of the target character based on the first character information includes:

[0010] Based on the first character information, first area information is determined; wherein the first area information is: area information occupied by the target character when the target character is drawn according to the original font;

[0011] Determine the first area information as second area information; wherein the second area information is: area information occupied by the target character when the target character is drawn according to the replacement font;

[0012] Based on the second area information, second character information of the target character is determined.

[0013] In a possible implementation manner, determining the second character information of the target character based on the first character information includes:

[0014] Based on the first character information, determining a first origin position; wherein the first origin position is: the position where the origin of the target character is located when the target character is drawn according to the original font;

[0015] Determine the first origin position as the second origin position; wherein the second origin position is: the position where the origin of the target character is located when the target character is drawn according to the replacement font;

[0016] Based on the second origin position, second character information of the target character is determined.

[0017] In a possible implementation manner, determining the second character information of the target character based on the first character information includes:

[0018] Based on the first character information, third area information is determined; wherein the third area information is: information about the area where the bounding box of the target character is located when the target character is drawn according to the replacement font;

[0019] The third area information is determined as the second character information of the target character.

[0020] In a possible implementation manner, determining the third region information based on the first character information includes:

[0021] Determine a first character size of the target character, wherein the first character size is: a size of a bounding box of the target character when the target character is drawn according to a replacement font;

[0022] Determine a second character size of the target character, wherein the second character size is: the size of an area occupied by the target character when the target character is drawn according to the original font;

[0023] Based on the first character information, the first character size, and the second character size, third area information is determined.

[0024] In a possible implementation manner, determining the third area information based on the first character information, the first character size, and the second character size includes:

[0025] Based on the first character information, first area information is determined; wherein the first area information is: area information occupied by the target character when the target character is drawn according to the original font;

[0026] Based on the first character size and the second character size, third area information is determined in the first area information; wherein the third area information is: information about the area where the bounding box of the target character is located when the target character is drawn according to the replacement font; the center of the area represented by the third area information is the center of the area represented by the first area information.

[0027] In a possible implementation manner, determining the third region information based on the first character information includes:

[0028] Based on the first character information, a first distance and a second distance are determined; wherein the first distance represents: when the target character is drawn according to the original font, the distance from the origin of the target character to the first side of the bounding box of the target character; the second distance represents: when the target character is drawn according to the original font, the distance from the origin of the target character to the second side of the bounding box of the target character; the second side is parallel to the first side;

[0029] Based on the first distance and the second distance, a third distance and a fourth distance are determined; wherein the third distance represents: when the target character is drawn according to the replacement font, the distance from the origin of the target character to the third side of the bounding box of the target character; the fourth distance represents: when the target character is drawn according to the replacement font, the distance from the origin of the target character to the fourth side of the bounding box of the target character; the third side and the fourth side are respectively parallel to the second side;

[0030] Based on the third distance and the fourth distance, third area information is determined.

[0031] In a possible implementation, the area width of the area represented by the third area information and the area width of the area represented by the fourth area information are both target widths, and the fourth area information is: information about the area where the bounding box of the target character is located when the target character is drawn according to the original font; and

[0032] The determining a third distance and a fourth distance based on the first distance and the second distance includes:

[0033] Determine a difference between the target width and the second distance to obtain a first difference;

[0034] Determine a ratio of the first distance to the first difference to obtain a target ratio;

[0035] Based on the target ratio, a third distance and a fourth distance are determined, wherein the ratio of the third distance to the second difference is the target ratio, and the second difference is the difference between the target width and the fourth distance.

[0036] In a second aspect, an embodiment of the present application provides a character display device, the device comprising:

[0037] A first determining unit is used to determine first character information of a target character; wherein the first character information is: information of the target character when the target character is drawn according to an original font; the original font is a font that does not exist locally;

[0038] A second determining unit is configured to determine second character information of the target character based on the first character information; wherein the second character information is information of the target character when the target character is drawn according to a replacement font; and the replacement font is a locally existing font;

[0039] The display unit is used to typeset the target character based on the second character information, so as to display the target character in the replacement font.

[0040] In a possible implementation manner, determining the second character information of the target character based on the first character information includes:

[0041] Based on the first character information, first area information is determined; wherein the first area information is: area information occupied by the target character when the target character is drawn according to the original font;

[0042] Determine the first area information as second area information; wherein the second area information is: area information occupied by the target character when the target character is drawn according to the replacement font;

[0043] Based on the second area information, second character information of the target character is determined.

[0044] In a possible implementation manner, determining the second character information of the target character based on the first character information includes:

[0045] Based on the first character information, determining a first origin position; wherein the first origin position is: the position where the origin of the target character is located when the target character is drawn according to the original font;

[0046] Determine the first origin position as the second origin position; wherein the second origin position is: the position where the origin of the target character is located when the target character is drawn according to the replacement font;

[0047] Based on the second origin position, second character information of the target character is determined.

[0048] In a possible implementation manner, determining the second character information of the target character based on the first character information includes:

[0049] Based on the first character information, third area information is determined; wherein the third area information is: information about the area where the bounding box of the target character is located when the target character is drawn according to the replacement font;

[0050] The third area information is determined as the second character information of the target character.

[0051] In a possible implementation manner, determining the third region information based on the first character information includes:

[0052] Determine a first character size of the target character, wherein the first character size is: a size of a bounding box of the target character when the target character is drawn according to a replacement font;

[0053] Determine a second character size of the target character, wherein the second character size is: the size of an area occupied by the target character when the target character is drawn according to the original font;

[0054] Based on the first character information, the first character size, and the second character size, third area information is determined.

[0055] In a possible implementation manner, determining the third area information based on the first character information, the first character size, and the second character size includes:

[0056] Based on the first character information, first area information is determined; wherein the first area information is: area information occupied by the target character when the target character is drawn according to the original font;

[0057] Based on the first character size and the second character size, third area information is determined in the first area information; wherein the third area information is: information about the area where the bounding box of the target character is located when the target character is drawn according to the replacement font; the center of the area represented by the third area information is the center of the area represented by the first area information.

[0058] In a possible implementation manner, determining the third region information based on the first character information includes:

[0059] Based on the first character information, a first distance and a second distance are determined; wherein the first distance represents: when the target character is drawn according to the original font, the distance from the origin of the target character to the first side of the bounding box of the target character; the second distance represents: when the target character is drawn according to the original font, the distance from the origin of the target character to the second side of the bounding box of the target character; the second side is parallel to the first side;

[0060] Based on the first distance and the second distance, a third distance and a fourth distance are determined; wherein the third distance represents: when the target character is drawn according to the replacement font, the distance from the origin of the target character to the third side of the bounding box of the target character; the fourth distance represents: when the target character is drawn according to the replacement font, the distance from the origin of the target character to the fourth side of the bounding box of the target character; the third side and the fourth side are respectively parallel to the second side;

[0061] Based on the third distance and the fourth distance, third area information is determined.

[0062] In a possible implementation, the area width of the area represented by the third area information and the area width of the area represented by the fourth area information are both target widths, and the fourth area information is: information about the area where the bounding box of the target character is located when the target character is drawn according to the original font; and

[0063] The determining a third distance and a fourth distance based on the first distance and the second distance includes:

[0064] Determine a difference between the target width and the second distance to obtain a first difference;

[0065] Determine a ratio of the first distance to the first difference to obtain a target ratio;

[0066] Based on the target ratio, a third distance and a fourth distance are determined, wherein the ratio of the third distance to the second difference is the target ratio, and the second difference is the difference between the target width and the fourth distance.

[0067] In a third aspect, an embodiment of the present application provides an electronic device, including:

[0068] Memory for storing computer programs;

[0069] The processor is used to execute the computer program stored in the memory, and when the computer program is executed, the method of any embodiment of the character display method of the first aspect of the present application is implemented.

[0070] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the method of any embodiment of the character display method of the first aspect described above is implemented.

[0071] In a fifth aspect, an embodiment of the present application provides a computer program, which includes a computer-readable code. When the computer-readable code is executed on a device, a processor in the device implements a method as in any embodiment of the character display method of the first aspect described above.

[0072] The character display method provided by the embodiment of the present application can determine the first character information of the target character; wherein the first character information is: the information of the target character when the target character is drawn according to the original font; the original font is a font that does not exist locally, and then, based on the first character information, the second character information of the target character is determined; wherein the second character information is: the information of the target character when the target character is drawn according to the replacement font; the replacement font is a font that exists locally, and then, based on the second character information, the target character is typeset to display the target character according to the replacement font. Thus, the position of the characters of the local replacement font is determined by the position of the characters of the local original font that does not exist locally, and then the target character is typeset based on the determined information to display the character according to the style of the replacement font, so that the position of the characters displayed by the replacement font can be made close to the position of the characters displayed by the original font, thereby reducing the impact of the font replacement on the character typesetting, thereby reducing the reading impact of the typesetting problem on the user. BRIEF DESCRIPTION OF THE DRAWINGS

[0073] Figure 1A flowchart of a character display method provided in an embodiment of the present application;

[0074] Figure 2A A schematic diagram of an area represented by first area information or second area information provided in an embodiment of the present application;

[0075] Figure 2B A schematic diagram of an area represented by fourth area information or third area information provided in an embodiment of the present application;

[0076] Figure 2C A schematic diagram of a first origin position or a second origin position provided in an embodiment of the present application;

[0077] Figure 3 A flowchart of another character display method provided in an embodiment of the present application;

[0078] Figure 4 A flowchart of another character display method provided in an embodiment of the present application;

[0079] Figure 5A A schematic diagram of a first distance and a second distance in a character display method provided in an embodiment of the present application;

[0080] Figure 5B A schematic diagram of a third distance and a fourth distance in a character display method provided in an embodiment of the present application;

[0081] Fig. 6A and Figure 6B A schematic diagram of character information display before and after typesetting of a character display method provided in an embodiment of the present application;

[0082] Figure 7 A structural schematic diagram of a character display device provided in an embodiment of the present application;

[0083] Figure 8 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0084] Various exemplary embodiments of the present application will now be described in detail with reference to the accompanying drawings. It should be noted that unless otherwise specifically stated, the relative arrangement of components and steps, numerical expressions and numerical values ​​set forth in these embodiments do not limit the scope of the present application.

[0085] Those skilled in the art will understand that the terms "first" and "second" in the embodiments of the present application are only used to distinguish between different steps, devices, modules and other objects, and do not represent any specific technical meanings, nor do they indicate the logical order between them.

[0086] It should also be understood that in this embodiment, “plurality” may refer to two or more than two, and “at least one” may refer to one, two or more than two.

[0087] It should also be understood that any component, data or structure mentioned in the embodiments of the present application can generally be understood as one or more, unless explicitly limited or otherwise indicated in the context.

[0088] In addition, the term "and / or" in this application is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this application generally indicates that the associated objects before and after are in an "or" relationship.

[0089] It should also be understood that the description of the various embodiments in this application focuses on the differences between the various embodiments, and the same or similar aspects thereof can be referenced to each other, and for the sake of brevity, they will not be described one by one.

[0090] The following description of at least one exemplary embodiment is merely illustrative in nature and is in no way intended to limit the present application, its application, or uses.

[0091] Technologies, methods, and equipment known to ordinary technicians in the relevant art may not be discussed in detail, but where appropriate, the above-mentioned technologies, methods, and equipment should be considered as part of the specification.

[0092] It should be noted that like reference numerals and letters refer to similar items in the following figures, and therefore, once an item is defined in one figure, it need not be further discussed in subsequent figures.

[0093] It should be noted that, in the absence of conflict, the embodiments in this application and the features in the embodiments can be combined with each other. To facilitate the understanding of the embodiments of the present application, the present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments. Obviously, the described embodiments are part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0094] Figure 1A flow chart of a character display method provided for an embodiment of the present application. The method can be applied to one or more electronic devices such as smart phones, laptops, desktop computers, portable computers, servers, etc. In addition, the execution subject of the method can be hardware or software. When the above-mentioned execution subject is hardware, the execution subject can be one or more of the above-mentioned electronic devices. For example, a single electronic device can execute the method, or multiple electronic devices can cooperate with each other to execute the method. When the above-mentioned execution subject is software, the method can be implemented as multiple software or software modules, or as a single software or software module. No specific limitation is made here.

[0095] like Figure 1 As shown, the method specifically includes:

[0096] Step 101, determining first character information of a target character; wherein the first character information is: information of the target character when the target character is drawn according to an original font; the original font is a font that does not exist locally.

[0097] In this embodiment, the target character can be any character. As an example, the target character can be one of the following: Chinese characters, English characters, punctuation marks, Greek characters, etc.

[0098] The original font may be an external form feature determined for the target character. As an example, the original font may be one of the following: Songti, Huawen Kaiti, Times New Roman, HGMaruGothicMPRO, etc.

[0099] Specifically, during the document editing process, the default font in the document can be used as the original font of any character in the document; or, the font of a character can be set so that the set font is used as the original font of the character. Usually, the information of the original font of the character can be stored in the document data of the document. After the access operation of the document is triggered, the device that triggers the access operation can obtain the original font of the character from the document data. If the device has the above-mentioned original font, it can further determine the information of the character when drawing the character according to the above-mentioned original font, and then draw the corresponding character according to the above-mentioned original font based on the determined information; if the device does not have the above-mentioned original font, it can determine the font used to replace the above-mentioned original font (that is, the replacement font) from the fonts existing in the device, and then further determine the information of the character when drawing the character according to the above-mentioned replacement font, and then draw the corresponding character according to the above-mentioned replacement font based on the determined information.

[0100] In addition, the character rendering process may include two parts: a character drawing process and a character display process. After drawing the character, the character may be displayed to complete the character rendering.

[0101] Here, the original font may be a font that does not exist locally (i.e., the execution subject, such as at least one of the terminal device or software). In the case where the terminal device and the software exist, the font that does not exist locally includes one of the following: the font does not exist in the terminal device, the font does not exist in the software, or the font does not exist in both the terminal device and the software.

[0102] The first character information may include at least one of the following: first region information, fourth region information, and first origin position.

[0103] The first area information is: area information occupied by the target character when the target character is drawn according to the original font. The length of the area represented by the first area information may be greater than or equal to the width width of the character and less than the distance between the two characters on the left and right sides of the character (such as the character spacing described below), and the height of the area represented by the first area information may be greater than or equal to the height height of the character and less than the distance between the two characters on the upper and lower sides of the character.

[0104] In one example, in the process of typesetting characters, a preset distance may be set as the advance width for drawing characters, that is, characters are drawn in the space represented by the preset distance, and after one character is drawn, the preset distance is continued to be advanced, and the next character is continued to be drawn in the space represented by the new preset distance. The length of the area represented by the first area information may be the preset distance, and the height of the area represented by the first area information may be the height of the character.

[0105] In yet another example, a spacing may be set between the regions indicated by the first region information to form a spacing between characters, that is, word spacing.

[0106] As an example, Figure 2A As shown, Figure 2A A schematic diagram of an area represented by first area information provided in an embodiment of the present application.

[0107] like Figure 2A As shown, in the figure, when g is a target character drawn according to the original font and is horizontally laid out, the region information 10 may represent the first region information. For example, the length of the first region information 10 may be advance, and the height may be height, where height may be the height of the character. Wherein advance represents the occupied width of the character.

[0108] The fourth area information is: information about the area where the bounding box (BoundingBox, ie, the minimum circumscribed rectangle) of the target character is located when the target character is drawn according to the original font.

[0109] As an example, Figure 2B As shown, Figure 2B A schematic diagram of an area represented by fourth area information provided in an embodiment of the present application.

[0110] like Figure 2B As shown, in the figure, when g is a target character drawn according to the original font, the region information 20 may represent the fourth region information. The width of the fourth region information 20 may be the width of the character, and the height of the fourth region information 20 may be the height of the character.

[0111] The first origin position is: the position of the origin of the target character when the target character is drawn according to the original font.

[0112] The first origin position may be located at a fixed position of the area indicated by the first area information or the fourth area information.

[0113] As an example, Figure 2C As shown, Figure 2C A schematic diagram of a first origin position provided in an embodiment of the present application.

[0114] like Figure 2C As shown, in the case where g in the figure is a target character drawn according to the original font, the position 30 can represent the first origin position. The first origin position 30 can be located at the third quarter-division point of the left border of the first region information 10. Among them, the upper vertex of the left border of the first region information 10 can be used as the first quarter-division point.

[0115] Optionally, the first origin position 30 may also be located at the third quarter-dividing point of the left side border of the fourth region information 20 .

[0116] Furthermore, in practice, the layout of characters usually includes horizontal layout and vertical layout. Figure 2A , Figure 2B and Figure 2C In the present invention, the horizontal layout is taken as an example for illustrative explanation.

[0117] The width and height in the diagram are the width and height of the bounding box (BoundingBox, i.e. the above minimum bounding rectangle) of the character body (i.e. the target character). These two values ​​are related to the layout direction.

[0118] bearingX represents the horizontal distance from the current focus (which can be regarded as the coordinate origin in the figure) to the left edge of the character bounding box.

[0119] bearingY represents the vertical distance from the current focus to the upper edge of the character bounding box.

[0120] Advance can be considered as the width of the character area (that is, the width occupied by the above characters). After a character is drawn as part of the text, the step length of the pen can be understood as the origin of the next character. In addition, advance is a vector that stores the translation vector in the transformation of the glyph.

[0121] Step 102, based on the first character information, determine the second character information of the target character; wherein the second character information is: information of the target character when the target character is drawn according to a replacement font; the replacement font is a locally existing font.

[0122] In this embodiment, the replacement font may be a font existing locally (i.e., the execution subject, such as a terminal device). Specifically, the replacement font may be a local default font, or may be a font determined by a preset strategy. For example, an association relationship between a single or multiple original fonts and their replacement fonts may be established in advance, so as to determine the replacement font of the original font based on the above association relationship.

[0123] In addition, the replacement font may be another font different from the original font. For example, it may be preset that when the original font is HGMaruGothicMPRO, the replacement font may be Times New Roman.

[0124] The second character information may include at least one of the following: second area information, third area information, and a second origin position.

[0125] The second area information is: area information occupied by the target character when the target character is drawn according to the replacement font.

[0126] As an example, the second area information corresponds to the first area information. For example, when the length of the area represented by the first area information is the advance of the character drawn according to the original character, and the height is the height of the character drawn according to the original character, the length of the area represented by the second area information is the advance of the character drawn according to the replacement character, and the height is the height of the character drawn according to the replacement character. In addition, other methods can also be used to determine the second area information based on the first area information.

[0127] The length of the area represented by the second area information can be greater than the width width of the character and less than the distance between the two characters on the left and right sides of the character (such as the character spacing described later), and the height of the area represented by the second area information can be greater than or equal to the height height of the character and less than the distance between the two characters on the upper and lower sides of the character.

[0128] like Figure 2A As shown, Figure 2A A schematic diagram of an area represented by second area information provided in an embodiment of the present application.

[0129] like Figure 2A As shown, in the figure, when g is a target character drawn according to the replacement font, the region information 10 can represent the second region information. For example, the length of the second region information 10 can be advance, and the height can be height, and height can be the height of the character. Wherein advance represents the occupied width of the character.

[0130] The third area information is: information about the area where the bounding box (BoundingBox, ie, the minimum circumscribed rectangle) of the target character is located when the target character is drawn according to the replacement font.

[0131] Here, the third region information corresponds to the fourth region information. For example, if the width of the region represented by the fourth region information is the width width of the characters drawn in the original font, and the height is the height height of the characters drawn in the original font, then the width of the region represented by the third region information is the width width of the characters drawn in the replacement font, and the height is the height height of the characters drawn in the replacement font. In addition, the third region information can also be determined based on the fourth region information in other ways.

[0132] In one example, in the case where the second region information is set to correspond to the first region information, the third region information is set to correspond to the fourth region information.

[0133] In another example, when the width of the area represented by the fourth area information is set to the width width of the characters drawn according to the original font, and the height is set to the height height of the characters drawn according to the original font, when drawing replacement characters in the area represented by the fourth area information, at least one of the following operations can be performed: the width of the characters drawn in the replacement font is scaled to the width of the characters drawn in the original font, and the height of the characters drawn in the replacement font is scaled to the height of the characters drawn in the original font.

[0134] As an example, Figure 2B As shown, Figure 2BA schematic diagram of an area represented by third area information provided in an embodiment of the present application.

[0135] like Figure 2B As shown, in the figure, when g is a target character drawn according to the replacement font, the area 20 may represent the area represented by the third area information. The width of the area 20 represented by the third area information may be the width of the character, and the height of the area 20 represented by the third area information may be the height of the character.

[0136] The second origin position is: the position of the origin of the target character when the target character is drawn according to the replacement font.

[0137] Here, the second origin position corresponds to the first origin position. For example, when the first origin position is located at the third quarter point of the left border of the first region information, the second origin position may be located at the third quarter point of the left border of the second region information. In addition, other methods may be used to determine the second origin position based on the first origin position.

[0138] As an example, Figure 2C As shown, Figure 2C A schematic diagram of a second origin position provided in an embodiment of the present application.

[0139] like Figure 2C As shown, in the figure, when g is a target character drawn according to the replacement font, the position 30 can represent the second origin position. The second origin position 30 can be located at the third quarter-division point of the left border of the second region information 10. Among them, the upper vertex of the left border of the second region information 10 can be used as the first quarter-division point.

[0140] Optionally, the second origin position 30 may also be located at the third quarter-division point of the left side border of the fourth region information 20 .

[0141] Exemplarily, at least one of the first region information, the fourth region information, and the first origin position may be determined based on the first character information, and then the second character information of the target character may be determined based on at least one of the first region information, the fourth region information, and the first origin position. For example, at least one of the first region information, the fourth region information, and the first origin position may be determined as the second character information of the target character.

[0142] Step 103: typeset the target character based on the second character information to display the target character in the replacement font.

[0143] In this embodiment, if the second character information includes the above-mentioned second area information, then the second area information can be used as the area information occupied by the target character, so as to typeset the target character to display the target character according to the replacement font; if the second character information includes the above-mentioned third area information, then the third area information can be used as the information of the area where the bounding box (that is, the minimum circumscribed rectangle) of the target character is located, so as to typeset the target character to display the target character according to the replacement font; if the second character information includes the above-mentioned second origin position, then the second origin position can be used as the position where the origin of the target character is located, so as to typeset the target character to display the target character according to the replacement font.

[0144] In some optional implementations of this embodiment, the following method may be used to determine the second character information of the target character based on the first character information:

[0145] Firstly, based on the first character information, a first origin position is determined.

[0146] The first origin position is: the position of the origin of the target character when the target character is drawn according to the original font.

[0147] Afterwards, the first origin position is determined as the second origin position.

[0148] The second origin position is: the position of the origin of the target character when the target character is drawn according to the replacement font.

[0149] Here, regarding the definitions of the first origin position and the second origin position, please refer to the above description and will not be repeated here.

[0150] Then, based on the second origin position, second character information of the target character is determined.

[0151] As an example, the second origin position may be used as the second character information of the target character, so as to typeset the target character, so as to display the target character in the replacement font. Alternatively, at least one of the second area information and the third area information may be further determined, and then the second origin position and at least one of the second area information and the third area information may be used as the second character information of the target character, so as to typeset the target character, so as to display the target character in the replacement font.

[0152] It can be understood that in the above optional implementation, the first origin position can be determined as the second origin position, thereby making the position of the origin of the characters drawn according to the replaced font consistent with the position of the origin of the characters drawn according to the original font, further reducing the impact of the character layout before and after the font replacement, and further reducing the reading impact of the layout problem on the user.

[0153] It should be noted that all or part of the steps in the character display method provided in the embodiment of the present application can be executed via a typesetting engine, or the execution subject of the character display method provided in the embodiment of the present application can cooperate with the typesetting engine to implement the method, and the embodiment of the present application is not limited here.

[0154] For example, the above step 103 may be executed via a typesetting engine, and the above steps 101 and 102 may be executed via other software modules except the typesetting engine.

[0155] In addition, it should be noted that the definitions of width, height, length, origin, positive direction, etc. in this embodiment are merely exemplary. In practice, different or even opposite definitions can be made according to actual needs. In addition, in the field of document typesetting, for the horizontal typesetting and vertical typesetting of characters, different methods can be used to define concepts such as width, height, length, origin, positive direction, etc., which are not limited in this embodiment.

[0156] The character display method provided by the embodiment of the present application can determine the first character information of the target character; wherein the first character information is: the information of the target character when the target character is drawn according to the original font; the original font is a font that does not exist locally, and then, based on the first character information, the second character information of the target character is determined; wherein the second character information is: the information of the target character when the target character is drawn according to the replacement font; the replacement font is a font that exists locally, and then, based on the second character information, the target character is typeset to display the target character according to the replacement font. Thus, by using the information of the characters of the original font that does not exist locally, the information of the characters of the replacement font that exists locally is determined, and then based on the determined information, the target character is typeset to display the character according to the style of the replacement font, so that the position of the character displayed by the replacement font can be made close to the position of the character displayed by the original font, thereby reducing the impact of the font replacement on the character typesetting, thereby reducing the reading impact of the typesetting problem on the user.

[0157] Figure 3 A flowchart of another character display method provided in an embodiment of the present application. Figure 3As shown, the method specifically includes:

[0158] Step 201, determining first character information of a target character; wherein the first character information is: information of the target character when the target character is drawn according to an original font; the original font is a font that does not exist locally.

[0159] In this embodiment, step 201 and Figure 1 Step 101 in the corresponding embodiment is basically the same and will not be described again here.

[0160] Step 202, determining first area information based on the first character information; wherein the first area information is: area information occupied by the target character when the target character is drawn according to the original font.

[0161] In this embodiment, when the first character information includes the area indicated by the first area information, the first area information can be determined from the first character information. When the first character information includes the fourth area information and also includes the relative position between the area indicated by the fourth area information and the area indicated by the first area information, the fourth area information and the relative position can be first determined from the first character information, and then the first area information can be determined based on the fourth area information and the relative position.

[0162] Step 203: determine the first area information as second area information; wherein the second area information is: area information occupied by the target character when the target character is drawn according to the replacement font.

[0163] Step 204, based on the second area information, determine the second character information of the target character; wherein the second character information is: information of the target character when the target character is drawn according to a replacement font; the replacement font is a locally existing font.

[0164] In this embodiment, the second region information may be determined as the second character information of the target character. Alternatively, at least one of the second origin position and the third region information may be further determined, and then the second region information and at least one of the second origin position and the third region information may be used as the second character information of the target character.

[0165] Step 205: typeset the target character based on the second character information to display the target character in the replacement font.

[0166] In this embodiment, step 205 and Figure 1 Step 103 in the corresponding embodiment is basically the same and will not be described again here.

[0167] It should be noted that, in addition to the above contents, this embodiment may also include Figure 1 The corresponding technical features described in the corresponding embodiments are realized Figure 1 For details, please refer to the technical effect of the character display method shown in Figure 1 For the sake of brevity, the relevant description is not repeated here.

[0168] The character display method provided in the embodiment of the present application can determine the first area information as the second area information, thereby making the area information occupied by the characters drawn according to the replaced font consistent with the area information occupied by the characters drawn according to the original font, further reducing the impact of the font replacement on the character typesetting, and further reducing the impact of the typesetting problem on the user's reading.

[0169] Figure 4 A flowchart of another character display method provided in an embodiment of the present application.

[0170] Specifically, if Figure 4 As shown, the method specifically includes:

[0171] Step 301, determining first character information of a target character; wherein the first character information is: information of the target character when the target character is drawn according to an original font; the original font is a font that does not exist locally.

[0172] In this embodiment, step 301 and Figure 1 Step 101 in the corresponding embodiment is basically the same and will not be described again here.

[0173] Step 302, determining third area information based on the first character information; wherein the third area information is: information on the area where the bounding box of the target character is located when the target character is drawn according to the replacement font.

[0174] In this embodiment, the definition of the area represented by the third area information can refer to the above description and will not be repeated here.

[0175] Step 303, determining the third area information as the second character information of the target character; wherein the second character information is: information of the target character when the target character is drawn according to a replacement font; the replacement font is a locally existing font.

[0176] Step 304: typeset the target character based on the second character information to display the target character in the replacement font.

[0177] In this embodiment, step 304 and Figure 1 Step 103 in the corresponding embodiment is basically the same and will not be described again here.

[0178] In some optional implementations of this embodiment, the following method may be used to determine the third region information based on the first character information:

[0179] First, a first character size of the target character is determined.

[0180] The first character size is: the size of the bounding box of the target character when the target character is drawn according to the replacement font.

[0181] Specifically, the first character size may include at least one of a width and a height of a bounding box of the target character when the target character is drawn according to the replacement font.

[0182] Then, a second character size of the target character is determined.

[0183] The second character size is: the size of the area occupied by the target character when the target character is drawn according to the original font.

[0184] Specifically, the second character size may include at least one of a width and a height of a bounding box of the target character when the target character is drawn according to the original font.

[0185] Then, based on the first character information, the first character size, and the second character size, third area information is determined.

[0186] The definition of the area represented by the first character information can refer to the above description and will not be repeated here.

[0187] As an example, when the first character size and the second character size represent the same size, the fourth area information in the first character information can be determined as the third area information. When the first character size and the second character size represent different sizes, the ratio of the second character size to the first character size can be first determined to obtain a scaling ratio, and then the fourth area information in the first character information can be scaled according to the scaling ratio to obtain the third area information.

[0188] It can be understood that in the above optional implementation, the third area information can be determined based on the first character information, the first character size and the second character size, thereby further reducing the impact of character typesetting before and after font replacement, and further reducing the reading impact of typesetting problems on users.

[0189] In some application scenarios of the above optional implementation manners, the following manner may be used to determine the third region information based on the first character information, the first character size, and the second character size:

[0190] First, based on the first character information, first region information is determined.

[0191] The first area information is: area information occupied by the target character when the target character is drawn according to the original font.

[0192] Then, based on the first character size and the second character size, third area information is determined in the first area information.

[0193] The third area information is: information about the area where the bounding box of the target character is located when the target character is drawn according to the replacement font.

[0194] The center of the area indicated by the third area information is the center of the area indicated by the first area information.

[0195] It can be understood that in the above application scenario, the center of the bounding box of the characters drawn according to the replaced font is the same as the center of the area occupied by the characters drawn according to the original font. In this way, the impact of the character layout before and after the font replacement can be further reduced, and the reading impact of the layout problem on the user can be further reduced.

[0196] In some optional implementations of this embodiment, the following method may be used to determine the third region information based on the first character information:

[0197] First, based on the first character information, a first distance and a second distance are determined.

[0198] The first distance represents: when the target character is drawn according to the original font, the distance from the origin of the target character to the first side of the bounding box of the target character.

[0199] Specifically, Figure 5A As shown, in the case where the character g in the diagram represents the target character drawn according to the original font, the first side can be the side whose distance from the vertical axis is bearingX, and the first distance can be the distance between the origin origin and the above-mentioned first side, that is, the first distance is bearingX.

[0200] The second distance represents: when the target character is drawn according to the original font, the distance from the origin of the target character to the second side of the bounding box of the target character.

[0201] Specifically, Figure 5A As shown, in the case where the character g in the figure represents the target character drawn according to the original font, the second side can be an side whose distance from the vertical axis is bearingX+width, and the second distance can be the distance between the origin origin and the above-mentioned second side, that is, the second distance is bearingX+width.

[0202] The second side is parallel to the first side.

[0203] Here, since the first distance and the second distance are related to the original character, the first distance and the second distance are known, or the first distance and the second distance can be calculated based on the first character information of the target character.

[0204] Afterwards, a third distance and a fourth distance are determined based on the first distance and the second distance.

[0205] The third distance represents: when the target character is drawn according to the replacement font, the distance from the origin of the target character to the third side of the bounding box of the target character.

[0206] Specifically, Figure 5B As shown, in the case where the character g in the figure represents the target character drawn according to the replacement font, the third side can be an side whose distance from the vertical axis is bearingX, and the third distance can be the distance between the origin origin and the above-mentioned third side, that is, the third distance can be recorded as bearingX.

[0207] The fourth distance represents: when the target character is drawn according to the replacement font, the distance from the origin of the target character to the fourth side of the bounding box of the target character.

[0208] Specifically, Figure 5B As shown, in the case where the character g in the figure represents the target character drawn according to the replacement font, the fourth side can be an side whose distance from the vertical axis is bearingX+width, and the fourth distance can be the distance between the origin origin and the above-mentioned fourth side, that is, the fourth distance can be recorded as bearingX+width.

[0209] The third side and the fourth side are respectively parallel to the second side.

[0210] Here, since the first distance and the second distance are related to the replacement character, the third distance and the fourth distance can be calculated based on the first distance and the second distance using a preset algorithm.

[0211] Specifically, the third distance and the fourth distance may be determined by using the following formula 1:

[0212] L3 / L1=(Adv2–L4+L3) / (Adv1–L2+L1)

[0213] L4–L3=W2

[0214] Formula 1

[0215] Wherein, L1 represents the first distance, L2 represents the second distance, L3 represents the third distance, L4 represents the fourth distance, and Adv2 represents the width of the area represented by the second area information (that is, Figure 2C In the case where the target character is drawn according to the replacement font, Adv1 represents the width of the area represented by the first area information (ie, Figure 2C In the case where the target character is drawn according to the original font, W1 represents the advance of the target character, and W2 represents the width of the target character when the target character is drawn according to the replacement font. L1, L2, W2, Adv1, Adv2 are known quantities, and L3 and L4 are unknown quantities.

[0216] Then, third area information is determined based on the third distance and the fourth distance.

[0217] Here, the difference between the fourth distance and the third distance can be determined as the width of the third area information (that is, the position of the minimum circumscribed rectangle of the target font when the target character is drawn according to the replacement font). The above third distance is taken as the distance from the origin position of the target character to the left border of the area represented by the third area information when the target character is drawn according to the replacement font (that is, the third distance), thereby determining the left and right borders of the area represented by the third area information. The above origin origin is taken as the third quarter point from top to bottom in the left border of the area represented by the third area information, thereby determining the upper and lower borders of the area represented by the third area information.

[0218] It can be understood that in the above optional implementation method, the third distance and the fourth distance can be determined based on the first distance and the second distance, and then the third area information can be determined based on the third distance and the fourth distance. This can further reduce the impact of character typesetting before and after font replacement and reduce the reading impact of typesetting problems on users.

[0219] In some optional implementations of this embodiment, the area width of the area represented by the third area information and the area width of the area represented by the fourth area information are both target widths, and the fourth area information is information about the area where the bounding box of the target character is located when the target character is drawn according to the original font. In other words, the area width of the area represented by the fourth area information can be determined as the area width of the area represented by the third area information.

[0220] On this basis, the following method may be used to determine the third distance and the fourth distance based on the first distance and the second distance:

[0221] First, determine the target width (i.e. Figure 2C The difference between the advance) and the second distance is used to obtain a first difference.

[0222] The first difference may be a difference between the target width and the second distance.

[0223] Afterwards, a ratio of the first distance to the first difference is determined to obtain a target ratio.

[0224] The target ratio may be a ratio of the first distance to the first difference.

[0225] Then, based on the target ratio, a third distance and a fourth distance are determined.

[0226] The ratio of the third distance to the second difference is the target ratio, and the second difference is the difference between the target width and the fourth distance.

[0227] It can be understood that in the above optional implementation method, the ratio of the third distance to the second difference can be determined according to the ratio of the first distance to the first difference, and then the third distance and the fourth distance can be determined. This can further reduce the impact of character typesetting before and after font replacement and reduce the reading impact of typesetting problems on users.

[0228] Optionally, the third distance and the fourth distance may be determined based on the first distance and the second distance in the following manner:

[0229] determining a ratio of the first distance to the second distance to obtain a target ratio;

[0230] Based on the target ratio, a third distance and a fourth distance are determined, wherein a ratio of the third distance to the fourth distance is the target ratio.

[0231] The following is an illustrative description of the embodiments of the present application, but it should be noted that the embodiments of the present application may have the features described below, but the following description does not constitute a limitation on the scope of protection of the embodiments of the present application.

[0232] Here, refer to Figure 2C , when the original character (i.e., the target character drawn according to the original font) and the replaced character (i.e., the target character drawn according to the replaced font) keep the same advance (i.e., the width advance1 of the area represented by the first area information and the width advance2 of the area represented by the second area information are consistent), the value of bearingX2 is controlled so that the spacing between adjacent characters is not too large or too small.

[0233] The replacement font may be a drawing font that is replaced when the system lacks a font, and the original font may be a font set in the current document.

[0234] First, ensure that the advance2 of the replacement character is consistent with the advance1 of the original character.

[0235] Furthermore, adjust the bearingX2 of the replacement character. The specific steps are as follows:

[0236] Step 1: Get the font drawing width W2 of the replacement font. Figure 2C The g in the string represents the width of the character g when replacing the character.

[0237] Step 2: Get the original font information Adv in the cache. Adv is Figure 2C In the case where g represents the original character, the advance of the character g. The Adv is also the advance of the character g when g represents the replacement character.

[0238] Step 3: Recalculate the drawing position of the replacement character's bearingX2.

[0239] There are two ways to calculate the new bearingX2:

[0240] The first method is to evenly distribute the characters so that the replacement characters are centered in the advance1 of the original characters. Specifically, the following formula 2 can be used to calculate the bearingX2 of the replacement characters:

[0241] bearingX2=(Adv–W2) / 2

[0242] Formula 2

[0243] The second method is to distribute the characters evenly in proportion so that the distance ratio between the original characters is retained between the replaced characters.

[0244] according to Figure 2C It can be seen that:

[0245] Adv=bearingX1+W1+W3, where W1 is Figure 2C In the figure, g represents the width of the character g when the character is original. W3 is the difference between Adv and bearingX1 and W1 in the figure.

[0246] Calculate the ratio of bearingX1 to W3, denoted as BW1.

[0247] The remaining width of (Adv–W1) is evenly distributed using the ratio BW1.

[0248] Then bearingX2=(Adv–W3) / (bearingX2+W2)×bearingX1.

[0249] Among them, bearingX1 and W1 are the parameters of the original characters, and bearingX2 and W2 are the parameters of the replacement characters.

[0250] The above W1 is known or measurable. As an example, the stored font measurement data may be directly obtained to obtain W1, or a function may be called to measure the font to obtain W1.

[0251] Furthermore, for Fig. 6A The characters in the document before typeset can be Figure 6B The positions shown are used to display the characters after typeset.

[0252] It should be noted that, in addition to the contents recorded above, this embodiment may also include the technical features described in the above embodiments, so as to achieve the technical effects of the character display method shown above. Please refer to the above description for details. For the sake of brevity, it will not be repeated here.

[0253] The character display method provided in the embodiment of the present application can determine the third area information as the second character information of the target character, thereby determining the information of the bounding box of the character drawn according to the replaced font based on the first character information, further reducing the impact of the font replacement on the character typesetting, and further reducing the reading impact of the typesetting problem on the user.

[0254] Figure 7 This is a structural diagram of a character display device provided in an embodiment of the present application. Specifically comprising:

[0255] The first determining unit 401 is used to determine first character information of a target character; wherein the first character information is: information of the target character when the target character is drawn according to an original font; the original font is a font that does not exist locally;

[0256] A second determining unit 402 is configured to determine second character information of the target character based on the first character information; wherein the second character information is information of the target character when the target character is drawn according to a replacement font; and the replacement font is a locally existing font;

[0257] The display unit 403 is configured to typeset the target character based on the second character information, so as to display the target character in the replacement font.

[0258] In a possible implementation manner, determining the second character information of the target character based on the first character information includes:

[0259] Based on the first character information, first area information is determined; wherein the first area information is: area information occupied by the target character when the target character is drawn according to the original font;

[0260] Determine the first area information as second area information; wherein the second area information is: area information occupied by the target character when the target character is drawn according to the replacement font;

[0261] Based on the second area information, second character information of the target character is determined.

[0262] In a possible implementation manner, determining the second character information of the target character based on the first character information includes:

[0263] Based on the first character information, determining a first origin position; wherein the first origin position is: the position where the origin of the target character is located when the target character is drawn according to the original font;

[0264] Determine the first origin position as the second origin position; wherein the second origin position is: the position where the origin of the target character is located when the target character is drawn according to the replacement font;

[0265] Based on the second origin position, second character information of the target character is determined.

[0266] In a possible implementation manner, determining the second character information of the target character based on the first character information includes:

[0267] Based on the first character information, third area information is determined; wherein the third area information is: information about the area where the bounding box of the target character is located when the target character is drawn according to the replacement font;

[0268] The third area information is determined as the second character information of the target character.

[0269] In a possible implementation manner, determining the third region information based on the first character information includes:

[0270] Determine a first character size of the target character, wherein the first character size is: a size of a bounding box of the target character when the target character is drawn according to a replacement font;

[0271] Determine a second character size of the target character, wherein the second character size is: the size of an area occupied by the target character when the target character is drawn according to the original font;

[0272] Based on the first character information, the first character size, and the second character size, third area information is determined.

[0273] In a possible implementation manner, determining the third area information based on the first character information, the first character size, and the second character size includes:

[0274] Based on the first character information, first area information is determined; wherein the first area information is: area information occupied by the target character when the target character is drawn according to the original font;

[0275] Based on the first character size and the second character size, third area information is determined in the first area information; wherein the third area information is: information about the area where the bounding box of the target character is located when the target character is drawn according to the replacement font; the center of the area represented by the third area information is the center of the area represented by the first area information.

[0276] In a possible implementation manner, determining the third region information based on the first character information includes:

[0277] Based on the first character information, a first distance and a second distance are determined; wherein the first distance represents: when the target character is drawn according to the original font, the distance from the origin of the target character to the first side of the bounding box of the target character; the second distance represents: when the target character is drawn according to the original font, the distance from the origin of the target character to the second side of the bounding box of the target character; the second side is parallel to the first side;

[0278] Based on the first distance and the second distance, a third distance and a fourth distance are determined; wherein the third distance represents: when the target character is drawn according to the replacement font, the distance from the origin of the target character to the third side of the bounding box of the target character; the fourth distance represents: when the target character is drawn according to the replacement font, the distance from the origin of the target character to the fourth side of the bounding box of the target character; the third side and the fourth side are respectively parallel to the second side;

[0279] Based on the third distance and the fourth distance, third area information is determined.

[0280] In a possible implementation, the area width of the area represented by the third area information and the area width of the area represented by the fourth area information are both target widths, and the fourth area information is: information about the area where the bounding box of the target character is located when the target character is drawn according to the original font; and

[0281] The determining a third distance and a fourth distance based on the first distance and the second distance includes:

[0282] Determine a difference between the target width and the second distance to obtain a first difference;

[0283] Determine a ratio of the first distance to the first difference to obtain a target ratio;

[0284] Based on the target ratio, a third distance and a fourth distance are determined, wherein the ratio of the third distance to the second difference is the target ratio, and the second difference is the difference between the target width and the fourth distance.

[0285] The character display device provided in this embodiment can be as follows Figure 4 The character display device shown in can execute all the steps of the above-mentioned character display methods, thereby achieving the technical effects of the above-mentioned character display methods. Please refer to the above related description for details. For the sake of brevity, it will not be repeated here.

[0286] Figure 8 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application, Figure 8 The electronic device 500 shown includes: at least one processor 501, a memory 502, at least one network interface 504 and other user interfaces 503. The various components in the electronic device 500 are coupled together via a bus system 505. It is understood that the bus system 505 is used to achieve connection and communication between these components. In addition to the data bus, the bus system 505 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, the bus system 505 is not shown in FIG. Figure 8 Various buses are labeled as bus system 505 .

[0287] The user interface 503 may include a display, a keyboard, or a pointing device (eg, a mouse, a trackball, a touch pad, or a touch screen).

[0288] It can be understood that the memory 502 in the embodiment of the present application can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example but not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM) and direct RAM bus random access memory (DRRAM). The memory 502 described herein is intended to include, but is not limited to, these and any other suitable types of memory.

[0289] In some implementations, the memory 502 stores the following elements, executable units or data structures, or a subset thereof, or an extended set thereof: an operating system 5021 and an application program 5022 .

[0290] Among them, the operating system 5021 includes various system programs, such as a framework layer, a core library layer, a driver layer, etc., which are used to implement various basic services and process hardware-based tasks. The application 5022 includes various application programs, such as a media player (Media Player), a browser (Browser), etc., which are used to implement various application services. The program for implementing the method of the embodiment of the present application can be included in the application 5022.

[0291] In this embodiment, by calling the program or instruction stored in the memory 502, specifically, the program or instruction stored in the application 5022, the processor 501 is used to execute the method steps provided by each method embodiment, for example, including:

[0292] Determine first character information of a target character; wherein the first character information is: information of the target character when the target character is drawn according to an original font; the original font is a font that does not exist locally;

[0293] Based on the first character information, second character information of the target character is determined; wherein the second character information is: information of the target character when the target character is drawn according to a replacement font; the replacement font is a locally existing font;

[0294] Based on the second character information, the target character is typeset to display the target character in the replacement font.

[0295] The method disclosed in the above embodiment of the present application can be applied to the processor 501, or implemented by the processor 501. The processor 501 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 501. The above processor 501 can be a general processor, a digital signal processor (Digital Signal Processor, DSP), an application specific integrated circuit (Application Specific Integrated Circuit, ASIC), a field programmable gate array (Field Programmable Gate Array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present application can be implemented or executed. The general processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the embodiment of the present application can be directly embodied as a hardware decoding processor to execute, or the hardware and software units in the decoding processor can be executed. The software unit can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 502, and the processor 501 reads the information in the memory 502 and completes the steps of the above method in combination with its hardware.

[0296] It is understood that the embodiments described herein may be implemented in hardware, software, firmware, middleware, microcode, or a combination thereof. For hardware implementation, the processing unit may be implemented in one or more application specific integrated circuits (ASIC), digital signal processors (DSP), digital signal processing devices (DSPDevice, DSPD), programmable logic devices (PLD), field programmable gate arrays (FPGA), general purpose processors, controllers, microcontrollers, microprocessors, other electronic units for performing the above-mentioned functions of the present application, or a combination thereof.

[0297] For software implementation, the technology described above in this article can be implemented by a unit that performs the functions described above in this article. The software code can be stored in a memory and executed by a processor. The memory can be implemented in the processor or outside the processor.

[0298] The electronic device provided in this embodiment may be Figure 8 The electronic device shown in can execute all the steps of the above-mentioned character display methods, thereby achieving the technical effects of the above-mentioned character display methods. Please refer to the above related description for details. For the sake of brevity, it will not be repeated here.

[0299] The embodiment of the present application also provides a storage medium (computer-readable storage medium). The storage medium here stores one or more programs. The storage medium may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a read-only memory, a flash memory, a hard disk or a solid-state drive; the memory may also include a combination of the above-mentioned types of memory.

[0300] When one or more programs in the storage medium can be executed by one or more processors, the character display method executed on the electronic device side can be implemented.

[0301] The processor is used to execute the character display program stored in the memory to implement the following steps of the character display method executed on the electronic device side:

[0302] Determine first character information of a target character; wherein the first character information is: information of the target character when the target character is drawn according to an original font; the original font is a font that does not exist locally;

[0303] Based on the first character information, second character information of the target character is determined; wherein the second character information is: information of the target character when the target character is drawn according to a replacement font; the replacement font is a locally existing font;

[0304] Based on the second character information, the target character is typeset to display the target character in the replacement font.

[0305] The professionals should also be further aware that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented with electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0306] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

[0307] The specific implementation methods described above further describe the purpose, technical solutions and beneficial effects of the present application in detail. It should be understood that the above description is only the specific implementation method of the present application and is not intended to limit the scope of protection of the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included in the scope of protection of the present application. In addition, for the aforementioned embodiments, for the sake of simple description, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present invention is not limited by the described order of actions, because according to the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily required by the present invention.

Claims

1. A character display method, characterized in that: The method comprises: Determine first character information of a target character; wherein the first character information is: information of the target character when the target character is drawn according to an original font; the original font is a font that does not exist locally; Based on the first character information, second character information of the target character is determined; wherein the second character information is: information of the target character when the target character is drawn according to a replacement font; the replacement font is a locally existing font; Based on the second character information, the target character is typeset to display the target character in the replacement font.

2. The method according to claim 1, characterized in that The step of determining the second character information of the target character based on the first character information includes: Based on the first character information, first area information is determined; wherein the first area information is: area information occupied by the target character when the target character is drawn according to the original font; Determine the first area information as second area information; wherein the second area information is: area information occupied by the target character when the target character is drawn according to the replacement font; Based on the second area information, second character information of the target character is determined.

3. The method according to claim 1, characterized in that The step of determining the second character information of the target character based on the first character information includes: Based on the first character information, determining a first origin position; wherein the first origin position is: the position where the origin of the target character is located when the target character is drawn according to the original font; Determine the first origin position as the second origin position; wherein the second origin position is: the position where the origin of the target character is located when the target character is drawn according to the replacement font; Based on the second origin position, second character information of the target character is determined.

4. The method according to claim 1, characterized in that: The step of determining the second character information of the target character based on the first character information includes: Based on the first character information, third area information is determined; wherein the third area information is: information about the area where the bounding box of the target character is located when the target character is drawn according to the replacement font; The third area information is determined as the second character information of the target character.

5. The method according to claim 4, characterized in that The determining the third region information based on the first character information includes: Determine a first character size of the target character, wherein the first character size is: a size of a bounding box of the target character when the target character is drawn according to a replacement font; Determine a second character size of the target character, wherein the second character size is: the size of an area occupied by the target character when the target character is drawn according to the original font; Based on the first character information, the first character size, and the second character size, third area information is determined.

6. The method according to claim 5, characterized in that The determining the third area information based on the first character information, the first character size and the second character size includes: Based on the first character information, first area information is determined; wherein the first area information is: area information occupied by the target character when the target character is drawn according to the original font; Based on the first character size and the second character size, third area information is determined in the first area information; wherein the third area information is: information about the area where the bounding box of the target character is located when the target character is drawn according to the replacement font; the center of the area represented by the third area information is the center of the area represented by the first area information.

7. The method according to claim 4, characterized in that The determining the third region information based on the first character information includes: Based on the first character information, a first distance and a second distance are determined; wherein the first distance represents: when the target character is drawn according to the original font, the distance from the origin of the target character to the first side of the bounding box of the target character; the second distance represents: when the target character is drawn according to the original font, the distance from the origin of the target character to the second side of the bounding box of the target character; the second side is parallel to the first side; Based on the first distance and the second distance, a third distance and a fourth distance are determined; wherein the third distance represents: when the target character is drawn according to the replacement font, the distance from the origin of the target character to the third side of the bounding box of the target character; the fourth distance represents: when the target character is drawn according to the replacement font, the distance from the origin of the target character to the fourth side of the bounding box of the target character; the third side and the fourth side are respectively parallel to the second side; Based on the third distance and the fourth distance, third area information is determined.

8. The method according to claim 7, characterized in that The area width of the area indicated by the third area information and the area width of the area indicated by the fourth area information are both target widths, and the fourth area information is: information about the area where the bounding box of the target character is located when the target character is drawn according to the original font; as well as The determining a third distance and a fourth distance based on the first distance and the second distance includes: Determine a difference between the target width and the second distance to obtain a first difference; Determine a ratio of the first distance to the first difference to obtain a target ratio; Based on the target ratio, a third distance and a fourth distance are determined, wherein the ratio of the third distance to the second difference is the target ratio, and the second difference is the difference between the target width and the fourth distance.

9. A character display device, characterized in that: The device comprises: A first determining unit is used to determine first character information of a target character; wherein the first character information is: information of the target character when the target character is drawn according to an original font; the original font is a font that does not exist locally; A second determining unit is configured to determine second character information of the target character based on the first character information; wherein the second character information is information of the target character when the target character is drawn according to a replacement font; and the replacement font is a locally existing font; The display unit is used to typeset the target character based on the second character information, so as to display the target character in the replacement font.

10. An electronic device, characterized in that: include: Memory for storing computer programs; A processor, configured to execute a computer program stored in the memory, and when the computer program is executed, implement the method described in any one of claims 1 to 8.

11. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method described in any one of claims 1 to 8 is implemented.