Character display method and device, storage medium and electronic equipment

By acquiring and adjusting the width and font size of the character display area, and automatically adjusting the font size and layout, the problem of misunderstanding in character display in multilingual scenarios is solved, achieving effective character display in different language environments and saving R&D costs.

CN119294351APending Publication Date: 2025-01-10ALIPAY (HANGZHOU) INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411480392.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-22
Publication Date
2025-01-10

AI Technical Summary

Technical Problem

In multilingual scenarios, the processing of extremely long characters in existing technologies leads to semantic changes and misunderstandings, and existing solutions have high development costs or layout problems when supporting multiple languages.

Method used

By obtaining the target display area width and font size of the characters to be displayed, the font size and layout are automatically adjusted, including reducing the font size, displaying line breaks, and omitting characters, to ensure that the characters are fully displayed and avoid misunderstandings.

Benefits of technology

It achieves automatic character layout in different language environments, displays as many characters as possible, avoids misunderstandings, and saves R&D costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119294351A_ABST
    Figure CN119294351A_ABST
Patent Text Reader

Abstract

The invention discloses a character display method and device, a storage medium and electronic equipment, and the method comprises the steps: obtaining a to-be-displayed character, determining the region width of a target display region for displaying the to-be-displayed character, and determining a first display word size of the to-be-displayed character; determining a first display width required for displaying the to-be-displayed character according to the first display word size, judging whether the first display width exceeds the area width, if the first width exceeds the area width, turning down the word size of the first display word size to obtain a second display word size, and displaying the to-be-displayed character through the second display word size. According to the specification, automatic layout can be carried out according to the display area and the to-be-displayed characters, the characters in the to-be-displayed characters are displayed as many as possible, and the misunderstanding problem can be avoided to a certain extent.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] In order to support users from different countries, an application usually supports multiple language switching. However, since the languages ​​of different countries are different after translation, the original user interface design for the basic language usually needs to be modified to adapt to the character length between different languages.

[0003] In the related art, the user adaptive interface handles overlong characters by truncating them after they are overlong. However, in a multi-language scenario, rashly truncating characters may cause semantic changes and lead to misunderstandings. Summary of the invention

[0004] The embodiments of this specification provide a character display method, device, storage medium and electronic device, which can automatically layout according to the display area and the characters to be displayed, display as many characters as possible in the characters to be displayed, and avoid misunderstanding problems to a certain extent.

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

[0006] Get the characters to be displayed;

[0007] Determining the area width of the target display area for displaying the characters to be displayed, and determining the first display font size of the characters to be displayed;

[0008] Determine a first display width required to display the character to be displayed according to the first display font size;

[0009] Determining whether the first display width exceeds the area width;

[0010] If the first width exceeds the area width, the font size of the first display font size is reduced to obtain a second display font size, and the characters to be displayed are displayed using the second display font size.

[0011] In a possible implementation manner, after determining whether the first display width exceeds the area width, the method further includes:

[0012] If the first width does not exceed the area width, the characters to be displayed are displayed using the first display font size.

[0013] In a possible implementation, the step of reducing the font size of the first display font size to obtain a second display font size, and displaying the characters to be displayed using the second display font size includes:

[0014] Adjust the first display font size to a font size one level smaller to obtain the second display font size;

[0015] Determining whether the second display font size is smaller than a preset minimum font size of the target display area;

[0016] If the second display font size is greater than or equal to the preset minimum font size, determining a second display width required to display the character to be displayed according to the second display font size;

[0017] Determining whether the second display width exceeds the area width;

[0018] If the second width does not exceed the area width, the characters to be displayed are displayed using the second display font size.

[0019] In a possible implementation, after determining whether the second display font size is smaller than the preset minimum font size of the target display area, the method further includes:

[0020] If the second display font size is smaller than the preset minimum font size, the characters to be displayed are displayed using the preset minimum font size.

[0021] In a possible implementation manner, after determining whether the second display width exceeds the area width, the method further includes:

[0022] If the second width exceeds the area width, the second display font size is updated to the first display font size, and the step of adjusting the first display font size to a smaller font size to obtain the second display font size is performed again, until the second display font size is smaller than the preset minimum font size, or until the second display width does not exceed the area width.

[0023] In a possible implementation, displaying the characters to be displayed using the preset minimum font size includes:

[0024] Determine the area height of the above target display area;

[0025] Determine the display height required for displaying the characters to be displayed according to the preset minimum font size and in line breaks according to the width of the area;

[0026] Determine whether the display height is less than or equal to the area height;

[0027] If the display height is less than or equal to the area height, the characters to be displayed are displayed according to the preset minimum font size and line breaks according to the area width;

[0028] If the display height is greater than the area height, some of the characters to be displayed are omitted to obtain omitted characters to be displayed, and the omitted characters to be displayed are displayed using the preset minimum font size.

[0029] In a possible implementation, omitting some characters in the characters to be displayed to obtain omitted characters to be displayed includes:

[0030] Determine that the characters to be displayed are displayed in accordance with the preset minimum font size and in accordance with the area width, and that a first character that cannot be displayed in the target display area and a second character that can be displayed in the target display area are displayed;

[0031] The last preset number of characters in the second character and the first character are used as target omitted characters;

[0032] The target omitted characters in the characters to be displayed are deleted to obtain the omitted characters to be displayed.

[0033] In a possible implementation, displaying the omitted characters to be displayed by using the preset minimum font size includes:

[0034] Add an ellipsis suffix to the above-mentioned omitted characters to obtain the target omitted characters to be displayed;

[0035] The target characters to be omitted are displayed according to the preset minimum font size and line breaks according to the area width.

[0036] In a possible implementation, the determining of the first display width required to display the character to be displayed according to the first display font size includes:

[0037] Obtaining a screen pixel ratio of an electronic device currently displaying the target display area;

[0038] The first display width required for displaying the to-be-displayed character in the first display font size is determined according to the screen pixel ratio.

[0039] In a second aspect, the embodiments of this specification further provide a character display device, including:

[0040] An acquisition module, used to acquire characters to be displayed;

[0041] A first determination module, used to determine the area width of a target display area for displaying the characters to be displayed, and to determine a first display font size of the characters to be displayed;

[0042] A second determining module is used to determine a first display width required to display the character to be displayed according to the first display font size;

[0043] A judging module, used for judging whether the first display width exceeds the area width;

[0044] The display module is used for reducing the font size of the first display font size to obtain a second display font size if the first width exceeds the area width, and displaying the characters to be displayed by using the second display font size.

[0045] In a possible implementation, the display module is configured to display the to-be-displayed characters using the first display font size if the first width does not exceed the area width.

[0046] In a possible implementation, the display module is used to adjust the first display font size to a smaller font size to obtain the second display font size; determine whether the second display font size is smaller than the preset minimum font size of the target display area; if the second display font size is greater than or equal to the preset minimum font size, determine the second display width required to display the characters to be displayed according to the second display font size; determine whether the second display width exceeds the area width; if the second width does not exceed the area width, display the characters to be displayed using the second display font size.

[0047] In a possible implementation, the display module is configured to display the to-be-displayed characters in the preset minimum font size if the second display font size is smaller than the preset minimum font size.

[0048] In one possible implementation, the display module is used to update the second display font size to the first display font size if the second width exceeds the area width, and again execute the step of adjusting the first display font size to a smaller font size to obtain the second display font size, until the second display font size is smaller than the preset minimum font size, or until the second display width does not exceed the area width.

[0049] In a possible implementation, the display module is used to determine the area height of the above-mentioned target display area; determine the display height required to display the above-mentioned characters to be displayed according to the above-mentioned preset minimum font size and wrapping according to the above-mentioned area width; judge whether the above-mentioned display height is less than or equal to the above-mentioned area height; if the above-mentioned display height is less than or equal to the above-mentioned area height, display the above-mentioned characters to be displayed according to the above-mentioned preset minimum font size and wrapping according to the above-mentioned area width; if the above-mentioned display height is greater than the above-mentioned area height, omit some of the above-mentioned characters to be displayed to obtain omitted characters to be displayed, and display the above-mentioned omitted characters to be displayed in the above-mentioned preset minimum font size.

[0050] In a possible implementation, a display module is used to determine the first character that cannot be displayed in the target display area and the second character that can be displayed in the target display area when the characters to be displayed are displayed according to the preset minimum font size and wrapped according to the area width; the last preset number of characters in the second character and the first character are used as target omitted characters; and the target omitted characters in the characters to be displayed are deleted to obtain the omitted characters to be displayed.

[0051] In a possible implementation, the display module is used to add an ellipsis suffix to the above-mentioned omitted characters to be displayed to obtain the target characters to be omitted; according to the above-mentioned preset minimum font size and line breaks according to the above-mentioned area width, the above-mentioned target characters to be omitted are displayed.

[0052] In a possible implementation, the second determination module is used to obtain the screen pixel ratio of the electronic device currently displaying the target display area; and determine the first display width required to display the characters to be displayed in the first display font size according to the screen pixel ratio.

[0053] In a third aspect, an embodiment of the present specification also provides a computer-readable storage medium having a computer program stored thereon. When the computer program runs on a computer, the computer executes the method provided by the first aspect of the embodiment of the present specification or any possible implementation of the first aspect.

[0054] In a fourth aspect, an embodiment of this specification provides an electronic device, including: a processor and a memory;

[0055] The processor is connected to the memory;

[0056] The above-mentioned memory is used to store executable program code;

[0057] The processor runs a program corresponding to the executable program code by reading the executable program code stored in the memory, so as to execute the method provided by the first aspect of the embodiment of this specification or any possible implementation of the first aspect.

[0058] In a fifth aspect, a computer program product comprising instructions, when the computer program product is run on a computer or a processor, enables the computer or the processor to execute the method provided by the first aspect of the embodiment of this specification or any possible implementation of the first aspect.

[0059] The technical solution provided by the embodiment of this specification obtains the characters to be displayed, determines the area width of the target display area for displaying the characters to be displayed, and determines the first display font size of the characters to be displayed, determines the first display width required to display the characters to be displayed according to the first display font size, determines whether the first display width exceeds the area width, and if the first width exceeds the area width, reduces the font size of the first display font size to obtain the second display font size, and displays the characters to be displayed using the second display font size. This specification can automatically layout according to the width of the display area and the width occupied by the characters to be displayed at different font sizes, and display as many characters as possible in the characters to be displayed, which can avoid misunderstandings to a certain extent. BRIEF DESCRIPTION OF THE DRAWINGS

[0060] In order to more clearly illustrate the technical solutions in the embodiments of this specification, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this specification. For those skilled in the art, other drawings can be obtained based on these drawings without paying any creative work.

[0061] Figure 1 This is a schematic diagram of the first flow chart of the character display method provided in the embodiments of this specification.

[0062] Figure 2 A schematic diagram showing the icon and text label of a single menu item provided in an embodiment of this specification.

[0063] Figure 3 Detailed description of the invention is given in the specification as a schematic diagram of a target display area for displaying characters.

[0064] Figure 4 The characters to be displayed provided in the embodiments of this specification are Chinese characters, and the display example is displayed after the font size of the characters to be displayed is reduced.

[0065] Figure 5 The characters to be displayed provided in the embodiments of this specification are in English, and the display example is displayed after the font size of the characters to be displayed is reduced.

[0066] Figure 6 A second flow chart of the character display method provided in the embodiment of this specification.

[0067] Figure 7 This is a third flow chart of the character display method provided in the embodiments of this specification.

[0068] Figure 8 The characters to be displayed provided in the embodiment of this specification are Chinese characters, and are displayed by reducing the font size and wrapping the characters.

[0069] Fig. 9 The characters to be displayed provided in the embodiment of this specification are in English and are displayed by reducing the font size and wrapping the characters.

[0070] Fig.10 A display schematic diagram for omitting characters to be displayed provided in an embodiment of this specification.

[0071] Fig.11 This is a schematic diagram of the structure of a character display device provided in an embodiment of this specification.

[0072] Fig.12 This is a schematic diagram of the first structure of an electronic device provided in an embodiment of this specification.

[0073] Fig.13 This is a second structural diagram of an electronic device provided in an embodiment of this specification. DETAILED DESCRIPTION

[0074] The following will be combined with the drawings in the embodiments of this specification to clearly and completely describe the technical solutions in the embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this specification, not all of the embodiments. Based on the embodiments in this specification, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of this specification.

[0075] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the specification. The appearance of the phrase in various places in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0076] With the increasing number of people from other countries coming to China, some applications need to support multiple languages. In order to support users from different countries, an application usually supports multiple languages ​​for switching. However, due to the differences in languages ​​of different countries after translation, the original user interface design for the basic language usually needs to be modified to adapt to the character length between different languages.

[0077] In the related art, there is a solution that ignores the differences in texts in different languages ​​and directly adopts a unified display solution to process them. The maximum supported length of the area that needs to be adapted is set, and if it is too long, it is truncated or downgraded to an ellipsis. The disadvantage of this solution is that it is not suitable for hiding the text in certain specific scenarios, or it is not reasonable to hide the ellipsis if it exceeds the length of a few characters. This solution may cause confusion in the entire page layout in uncertain scenarios with multiple languages, and in different contexts, truncated characters and not displayed may also cause semantic changes, leading to misunderstandings.

[0078] In addition, another solution is to customize different UI interfaces for different languages, and display the corresponding user interface based on the language. However, in the context of multilingualism and globalization, the disadvantage of this solution is that the R&D cost is extremely high, and it is impossible to quickly modify and create new functions.

[0079] In order to solve the above problems, an embodiment of the present specification provides a character display method, and the executor of the character display method can be the character display device provided in the embodiment of the present specification, or an electronic device integrating the character display device, wherein the character display device can be implemented in hardware or software.

[0080] Among them, the electronic device can be any device equipped with a processor and has processing capabilities, such as mobile electronic devices with processors such as smart phones, tablet computers, PDAs, laptops, or fixed electronic devices with processors such as desktop computers, televisions, and servers.

[0081] Next, combine Figures 1 to 5 , introduces the character display method provided by the embodiment of this specification. Figure 1 , which is a flow chart of the first character display method provided in the embodiment of this specification. Figure 1 As shown, the character display method includes the following steps:

[0082] S102: Obtain characters to be displayed.

[0083] Character refers to the collective name for words, letters, numbers and symbols that make up information and data. In a computer, each character corresponds to a binary code.

[0084] Among them, the characters to be displayed can be text labels corresponding to each menu item in the user interface. The text labels usually refer to the descriptions associated with the menu items, which are used to clearly indicate the function or content of each menu item, helping users to quickly understand and select the operations they want or the information they want to view.

[0085] For example, the functions corresponding to menu items may include "settings", "share", "message", "my", "delete", etc. The functions corresponding to these menu items are usually identified by icons, and the above text labels are displayed in the area below the icons, thereby forming menu items displayed in the user interface. For example, please refer to Figure 2 , Figure 2 For a schematic diagram showing the icons and text labels of a single menu item provided in the embodiments of this specification, please refer to Figure 2 In 2a, the icon display area of ​​the menu item is below the display area of ​​the characters to be displayed. When the menu item indicates a "message" function, the message menu item can be as follows Figure 2 2b in the above, and Figure 2 As shown in 2c.

[0086] It is understandable that in order to facilitate people in other countries to use Chinese applications, the characters to be displayed may include character texts corresponding to multiple languages.

[0087] S104: Determine the area width of the target display area for displaying the characters to be displayed, and determine a first display font size of the characters to be displayed.

[0088] For example, please refer to Figure 3 , Figure 3 2 is a schematic diagram of a target display area for displaying characters provided in this specification. It can be understood that the target display area also corresponds to Figure 2 The display area of ​​the text label of the menu item in 2a.

[0089] Specifically, when determining the area width of the target display area for displaying characters, the screen pixel ratio of the electronic device currently displaying the target display area is obtained, and the area width of the target display area is determined according to the screen pixel ratio.

[0090] Among them, the screen pixel ratio, also known as pixel density or PPI (Pixels Per Inch), is an important indicator to describe screen clarity. It refers to the number of pixels per inch diagonal. Simply put, the higher the PPI value, the finer the image displayed on the screen and the stronger the ability to express details. The pixel ratio of the screen affects the scaling and resolution of the mini program on different devices. Usually, the Ratio of standard screen devices is 1, the Ratio of high-definition screen devices is 2, and the Ratio of ultra-high-definition screen devices is 3 or above.

[0091] The first display font size of the character to be displayed is the display font size corresponding to the display style of the current text label of the target display area. The current text label display style may include font type, font style, font size, font color, font spacing, font effect and other aspects.

[0092] Among them, the font types include: Serif fonts (Serif): There are decorative small lines or strokes at the ends of the letters, such as Times New Roman, Georgia, etc. Sans-serif fonts (Sans-serif): There are no decorative small lines or strokes at the ends of the letters, such as Arial, Helvetica, etc. This type of font looks more concise and modern. Monospace font (Monospace): Each character (including letters, numbers and punctuation marks) occupies the same horizontal space, such as Courier, Consolas, etc. Cursive font (Cursive): Imitates handwriting style, with smooth lines and connected strokes, such as some handwriting or art fonts. Fantasy font (Fantasy): Usually has a unique, exaggerated or decorative appearance, and does not follow the rules of traditional font design, such as some art fonts or special effect fonts. It should be noted that the fonts used in the character display method provided in this specification are not limited to the fonts listed above, and other fonts may also be included in the specific implementation, and the embodiments of this specification are not limited to this.

[0093] Font styles include: Font weight: Change the appearance of a font by adjusting its weight. Common weights include light, regular, bold, and extra bold. Italic / oblique: Oblique or set the font to italic style to emphasize or distinguish the text content. Small caps: Convert lowercase letters to small caps, which can add interest or decoration to the text in some occasions.

[0094] Among them, the font size, also known as the font size, determines the height and width of the characters, and is usually measured in units of points (pt), pixels (px), etc. Different font sizes are suitable for different display scenarios and reading needs.

[0095] Among them, font color can change the visual effect of text, making it more prominent or blending into the background. In web design, font color is usually associated with the page theme, brand image or user preference.

[0096] Among them, font spacing includes: Kerning: adjust the spacing between characters to improve the overall readability and aesthetics of the text. Leading: adjust the spacing between lines to control the density and reading comfort of the text.

[0097] Among them, the font effects include: Shadow: Add shadow effects to the font to increase its three-dimensional and layered sense. Stroke: Add lines or borders to the edges of the font to highlight its shape and outline. Texture: Apply texture to the surface of the font to create a unique visual effect and texture. It should be noted that in the embodiments of this specification, the font size in the current text label display style is adjusted, and other styles remain unchanged to make the interface style more unified.

[0098] S106: Determine a first display width required to display the character to be displayed according to the first display font size.

[0099] Specifically, when determining the first display width required to display the characters to be displayed in the first display font size, the screen pixel ratio of the electronic device currently displaying the target display area is obtained, and the first display width required to display the characters to be displayed in the first display font size is determined based on the screen pixel ratio.

[0100] S108: Determine whether the first display width exceeds the area width.

[0101] S110: If the first width exceeds the area width, the font size of the first display font size is reduced to obtain a second display font size, and the characters to be displayed are displayed using the second display font size.

[0102] Among them, font size refers to the size attribute of the font, which determines the size of the pixels occupied by the font on the user interface.

[0103] In the embodiment of the present specification, if the first width exceeds the area width, the first display font size is reduced to obtain a second display font size, and the characters to be displayed are displayed using the second display font size.

[0104] For example, please refer to Figure 4 , when the character to be displayed is a Chinese character, Figure 4 , an example is shown in which the font size of the characters to be displayed "train ticket and air ticket" is reduced so that the characters to be displayed are fully displayed in the target display area. The first display font size corresponding to the target display area is 60pt, and the second display font size is 48pt. It can be seen that when the font size of the characters to be displayed is 60pt, the first display width of the characters to be displayed is greater than the width of the area. At this time, the characters to be displayed cannot be fully displayed in the target display area. By reducing the display font size to 48pt, the characters to be displayed can be fully displayed in the target display area.

[0105] For example, please refer to Figure 5 , when the character to be displayed is an English character, Figure 5The example in which the font size of the characters to be displayed "Rail Ticket OR Flight Ticket" is reduced so that the characters to be displayed are fully displayed in the target display area is shown. The first display font size corresponding to the target display area is 60pt, and the second display font size is 18pt. It can be seen that when the font size of the characters to be displayed is 60pt, the first display width of the characters to be displayed is greater than the width of the area. At this time, the characters to be displayed cannot be fully displayed in the target display area. By reducing the display font size to 18pt, the characters to be displayed can be fully displayed in the target display area.

[0106] It should be noted that Figure 3 as well as Figure 4 The dotted lines in the figure are for auxiliary illustration and have no actual meaning. Figure 3 as well as Figure 4 The examples are intended to illustrate the solutions provided in this specification and to make the schematic diagrams clearer. A larger font size is set. In actual applications, the font size will be set according to the actual scenario.

[0107] It can be understood that in the embodiments of the present specification, the first display width corresponding to the display in the target display area using the first display font size is pre-determined by the character to be displayed, and the first display width is compared with the display width corresponding to the target display area. If the first display width exceeds the display width corresponding to the target display area, the font size of the character to be displayed is reduced, so that the character to be displayed is displayed in the target display area using the reduced font size.

[0108] During specific implementation, this specification is not limited by the execution order of the various steps described. If no conflict occurs, some steps can be performed in other orders or simultaneously.

[0109] As can be seen from the above, the character display method provided in the embodiment of this specification obtains the characters to be displayed, determines the area width of the target display area for displaying the characters to be displayed, and determines the first display font size of the characters to be displayed, determines the first display width required to display the characters to be displayed according to the first display font size, and determines whether the first display width exceeds the area width. If the first width exceeds the area width, the font size of the first display font size is reduced to obtain the second display font size, and the characters to be displayed are displayed by the second display font size. This specification can automatically layout according to the width of the display area and the width occupied by the characters to be displayed at different font sizes, and display as many characters as possible in the characters to be displayed, which can avoid misunderstandings to a certain extent.

[0110] For example, please refer to Figure 2 , Figure 2The character to be displayed in 2c is "message". If the character to be displayed is directly truncated, the character displayed after truncation may be "mess", and "message" means news, and "mess" means dirty and messy. Therefore, it will cause misunderstanding when users use the menu item, affecting the user's use.

[0111] For example, please refer to Figure 4 In the related art, when displaying the characters to be displayed "train ticket and air ticket", they will be displayed in the first display font size. Since the target display area cannot fully display the characters to be displayed in the first display font size, a truncated display will be performed, that is, only "train ticket" in the characters to be displayed can be displayed in the target display area. At this time, since all the characters to be displayed cannot be fully displayed, the user cannot understand that this menu item can also include the function of purchasing air tickets when using it, which causes misunderstanding and affects the user's use.

[0112] The method described in the above embodiments is further described in detail below with examples.

[0113] Next, combine Figures 6 to 9 , introduces the character display method provided by the embodiment of this specification. Figure 6 , which is a flow chart of the second character display method provided in the embodiment of this specification. Figure 6 As shown, the character display method includes the following steps:

[0114] S202: Obtain characters to be displayed.

[0115] Character refers to the collective name for words, letters, numbers and symbols that make up information and data. In a computer, each character corresponds to a binary code.

[0116] Among them, the characters to be displayed can be text labels corresponding to each menu item in the user interface. The text labels usually refer to the descriptions associated with the menu items, which are used to clearly indicate the function or content of each menu item, helping users to quickly understand and select the operations they want or the information they want to view.

[0117] For example, the functions corresponding to the menu items may include "settings", "share", "message", "my", "scan", "payment", "travel", "card wallet", "health care", "train tickets and air tickets", etc. The functions corresponding to these menu items are usually identified by icons, and the above text labels are displayed in the area below the icons, thus forming the menu items displayed in the user interface. For example, please refer to Figure 2 , Figure 2 For a schematic diagram showing the icons and text labels of a single menu item provided in the embodiments of this specification, please refer to Figure 2 In 2a, the icon display area of ​​the menu item is below the display area of ​​the characters to be displayed. When the menu item indicates the "message" function, the message menu item can be displayed as follows: Figure 2 2b, and Figure 2 As shown in 2c.

[0118] It is understandable that in order to facilitate people in other countries to use Chinese applications, the characters to be displayed may include characters corresponding to multiple languages.

[0119] S204: Determine the area width of the target display area for displaying the characters to be displayed, and determine a first display font size of the characters to be displayed.

[0120] For example, please refer to Figure 3 , Figure 3 2 is a schematic diagram of a target display area for displaying characters provided in this specification. It can be understood that the target display area also corresponds to Figure 2 The display area of ​​the text label of the menu item in 2a.

[0121] Specifically, when determining the area width of the target display area for displaying characters, the screen pixel ratio of the electronic device currently displaying the target display area is obtained, and the area width of the target display area is determined according to the screen pixel ratio.

[0122] S206: Determine a first display width required to display the character to be displayed in the first display font size.

[0123] Specifically, when determining the first display width required to display the characters to be displayed in the first display font size, the screen pixel ratio of the electronic device currently displaying the target display area is obtained, and the first display width required to display the characters to be displayed in the first display font size is determined based on the screen pixel ratio.

[0124] S208, determining whether the first display width exceeds the area width; if so, executing step S212; if not, executing step S210.

[0125] S210: If the first width does not exceed the area width, display the characters to be displayed using the first display font size.

[0126] In the embodiment of the present specification, if the first width does not exceed the width of the area, it means that the character to be displayed can be fully displayed in the target display area according to the first display font size. Therefore, at this time, the character to be displayed is displayed in the target display area according to the first display font size.

[0127] S212: If the first width exceeds the area width, adjust the first display font size to a font size one level smaller to obtain a second display font size.

[0128] In an embodiment of the present specification, if the first width exceeds the width of the area, it means that the characters to be displayed cannot be fully displayed in the target display area according to the first display font size, that is, some characters in the characters to be displayed cannot be displayed in the target display area. Therefore, the display font size is reduced at this time. Specifically, the first display font size can be adjusted to a smaller font size to obtain a second display font size.

[0129] For example, if the first display font size is size 4, then the second display font size is size 4. For another example, if the first display font size is size 5, then the second display font size is size 5.

[0130] S214, determining whether the second display font size is smaller than the preset minimum font size of the target display area; if so, executing step S216; if not, executing step S218.

[0131] The preset minimum font size is the minimum font size that can be seen by the human eye. The preset minimum font size can be set by a person skilled in the art according to the public's vision level, or can be set by the user of the electronic device, or can be set after the electronic device instructs the user to perform a vision test and obtains the user's vision.

[0132] S216: If the second display font size is smaller than the preset minimum font size, display the characters to be displayed using the preset minimum font size.

[0133] In the present embodiment, when the second display font size is smaller than the preset minimum font size, the characters to be displayed are displayed using the preset minimum font size, so as to display as many characters to be displayed as possible.

[0134] In a possible implementation manner, in step S216, the characters to be displayed are displayed by presetting the minimum font size. Figure 7 , which is a third flow chart of a character display method provided in the embodiment of this specification. Figure 7 As shown, the process of displaying the characters to be displayed by presetting the minimum font size may include the following steps:

[0135] S21602: Determine the area height of the target display area.

[0136] In the embodiments of this specification, when determining the area height of the target display area, it is also necessary to perform calculations based on the screen pixel ratio of the electronic device currently displaying the target area, and determine the area height of the target display area based on the screen pixel ratio.

[0137] For example, please refer to Figure 3 The area height of the target display area shown in .

[0138] S21604, determining the display height required for displaying the characters to be displayed according to the preset minimum font size and line breaks according to the area width.

[0139] In the embodiment of the present specification, when determining the display height, the screen pixel ratio corresponding to the above-mentioned electronic device is also used for calculation. Specifically, after predetermining that the characters to be displayed are to be wrapped according to the preset minimum font size and the area width of the target display area, the required display height of the characters to be displayed is calculated by the screen pixel ratio.

[0140] S21606. Determine whether the display height is less than or equal to the area height; if so, execute step S21608; if not, execute step S21610.

[0141] S21608. If the display height is less than or equal to the area height, the characters to be displayed are displayed according to the preset minimum font size and line breaks according to the area width.

[0142] If the display height is less than or equal to the area height, it means that the character to be displayed can be fully displayed according to the preset minimum font size and by wrapping the line according to the area width. Therefore, the character to be displayed is displayed according to the preset minimum font size and by wrapping the line according to the area width.

[0143] For example, please refer to Figure 8 , Figure 8 The figure shows that the characters to be displayed are Chinese, and the characters to be displayed "Train Tickets and Air Tickets" are displayed in a preset minimum font size and wrapped in a line. The first display font size is 60pt, and the preset minimum font size is 52pt. Since the characters to be displayed cannot be fully displayed by reducing the font size, the characters to be displayed are displayed in the preset minimum font size and wrapped in a line according to the area width.

[0144] For example, please refer to Fig. 9 , Fig. 9 In the figure, it is indicated that the characters to be displayed are in English, and the characters to be displayed "RailTicket OR Flight Ticket" are displayed in a preset minimum font size and in a line break. The first display font size is 60pt, and the preset minimum font size is 50pt. Since the characters to be displayed cannot be fully displayed even if the font size is reduced, the characters to be displayed are displayed in the preset minimum font size and in a line break according to the area width.

[0145] S21610: If the display height is greater than the area height, some characters in the characters to be displayed are omitted to obtain omitted characters to be displayed, and the omitted characters to be displayed are displayed using a preset minimum font size.

[0146] If the display height is greater than the area height, it means that the characters to be displayed cannot be fully displayed according to the preset minimum font size and the line break display according to the area width, that is, some characters in the characters to be displayed cannot be displayed. Therefore, some characters in the characters to be displayed are omitted to obtain the omitted characters to be displayed, and the omitted characters to be displayed are displayed in the preset minimum font size.

[0147] For example, please refer to Fig.10 , Fig.10 This is a schematic diagram of omitting the characters to be displayed provided in the embodiments of this specification. Fig.10 In 10a, a schematic diagram is shown in which some characters of the characters to be displayed "train ticket and flight ticket" are omitted and then displayed in a preset minimum font size. 10b is a schematic diagram in which some characters of the characters to be displayed "train ticket and flight ticket" are omitted and then displayed in a preset minimum font size and in a line break. 10c is a schematic diagram in which some characters of the characters to be displayed "Rail Ticket ORFlight Ticket" are omitted and then displayed in a preset minimum font size. 10d is a schematic diagram in which some characters of the characters to be displayed "Rail Ticket OR Flight Ticket" are omitted and then displayed in a preset minimum font size and in a line break. It should be noted that Fig.10 10a, 10b, 10c, and 10d are for illustration only.

[0148] In a possible implementation, when some characters in the characters to be displayed are omitted to obtain the omitted characters to be displayed, it is determined that the characters to be displayed will be displayed according to the preset minimum font size and wrapped according to the area width. When displaying, the first character that cannot be displayed in the target display area and the second character that can be displayed in the target display area are used, and the last preset number of characters in the second character and the first character are used as target omitted characters, and the target omitted characters in the characters to be displayed are deleted to obtain the omitted characters to be displayed.

[0149] For example, see Fig.10 In 10c, the characters to be displayed are "Rail Ticket OR Flight Ticket", the first character is "ket", and the second character is "Rail Ticket OR Flight Tic". For example, the last 3 characters of the second character and the first character are used as target omitted characters, and the omitted characters to be displayed are obtained as "Rail Ticket ORFlight".

[0150] In a possible implementation, when displaying the elliptical character to be displayed using a preset minimum font size, an ellipsis suffix is ​​added to the elliptical character to be displayed to obtain the target elliptical character to be displayed, and the target elliptical character to be displayed is displayed using the preset minimum font size and line breaks according to the area width.

[0151] For example, see Fig.10 In 10d, the characters to be displayed are “Rail Ticket OR Flight Ticket”, and the corresponding omitted characters to be displayed are “Rail Ticket OR Flight”. An ellipsis suffix is ​​added to the omitted characters to obtain the target omitted display characters “Rail Ticket OR Flight…”. Then, the target omitted display characters are displayed according to the preset minimum font size and line breaks according to the area width. Please refer to 10d.

[0152] S218: If the second display font size is greater than or equal to the preset minimum font size, determine a second display width required to display the character to be displayed according to the second display font size.

[0153] In an embodiment of the present specification, if the second display font size is greater than or equal to the preset minimum font size, then the second display width required to display the character to be displayed according to the second display font size is determined, that is, after the character to be displayed is reduced in size, it is determined whether the reduced font size meets the restricted preset minimum font size. If so, it means that the reduced font size is allowed to be displayed in the target display area. At this time, the display width of the character to be displayed when it is displayed with the reduced font size is determined.

[0154] S220, determining whether the second display width exceeds the area width; if so, executing step S224; if not, executing step S222.

[0155] S222: If the second width does not exceed the area width, display the characters to be displayed using the second display font size.

[0156] In the embodiment of the present description, that is, the display width of the above-mentioned characters to be displayed when displayed in the reduced font size satisfies the range of the area width corresponding to the target display area, which means that the characters to be displayed can be fully displayed in the target display area according to the reduced font size. At this time, the characters to be displayed are displayed in the reduced font size.

[0157] S224: If the second width exceeds the area width, the second display font size is updated to the first display font size, and step S212 is executed again until the second display font size is smaller than the preset minimum font size, or until the second display width does not exceed the area width.

[0158] In the embodiment of the present specification, that is, the display width of the above-mentioned characters to be displayed when displayed in the reduced font size does not meet the range of the area width corresponding to the target display area, indicating that the characters to be displayed cannot be fully displayed by the target display area according to the reduced font size. At this time, continue to reduce the font size, that is, go to step S212, until the font size is less than the preset minimum font size during the process of reducing the font size, go to step S216, or until the characters to be displayed can be fully displayed by the target display area.

[0159] For example, please refer to Figure 3 , when the character to be displayed is a Chinese character, Figure 3 An example is shown in which the font size of the characters to be displayed "train ticket and air ticket" is reduced so that the characters to be displayed are fully displayed in the target display area. The first display font size corresponding to the target display area is 60pt, and the second display font size is 48pt. The adjustment from the first display font size to the second display font size can be made by reducing the font size by one level each time until a font size that meets the requirements is found, so that the characters to be displayed can be fully displayed with the reduced font size that meets the requirements. It can be seen that when the font size of the characters to be displayed is 60pt, the first display width of the characters to be displayed is greater than the width of the area. At this time, the characters to be displayed cannot be fully displayed in the target display area. By reducing the display font size to 48pt, the characters to be displayed can be fully displayed in the target display area.

[0160] For example, please refer to Figure 4 , when the character to be displayed is an English character, Figure 4 The example of reducing the font size of the characters to be displayed "Rail Ticket OR Flight Ticket" so that the characters to be displayed are fully displayed in the target display area is illustrated in FIG. Among them, the first display font size corresponding to the target display area is 60pt, and the second display font size is 18pt. The adjustment from the first display font size to the second display font size can be performed by reducing the font size by one level each time until a font size that meets the requirements is found, so that the characters to be displayed can be fully displayed with the reduced font size that meets the requirements. It can be seen that when the font size of the characters to be displayed is 60pt, the first display width of the characters to be displayed is greater than the width of the area. At this time, the characters to be displayed cannot be fully displayed in the target display area. By reducing the display font size to 18pt, the characters to be displayed can be fully displayed in the target display area.

[0161] It should be noted that in the embodiments of this specification, when calculating the area width and area height of the target display area, and when calculating the display width and display height of the characters to be displayed, the calculation is performed using the screen pixel ratio corresponding to the electronic device displaying the target display area.

[0162] From the above, it can be seen that the character display method proposed in the embodiment of this specification obtains the width and height of the target display area, jointly calculates the display width of characters in different languages ​​and the current font size for automatic merging calculation, and performs three levels of adaptive adaptation of character reduction, line break adaptation, and over-long overflow ellipsis within the target display area. It can not only automatically layout according to the display area and the characters to be displayed, but also display as many characters as possible in the characters to be displayed, which can avoid misunderstandings to a certain extent, and can also save research and development costs.

[0163] In one embodiment, a character display device is also provided. Fig.11 , Fig.11 The structure diagram of the character display device 300 provided in the embodiment of the present specification. The character display device 200 is applied to an electronic device, and the character display device 300 includes an acquisition module 301, a first determination module 302, a second determination module 303, a judgment module 304 and a display module 305, as follows:

[0164] An acquisition module 301 is used to acquire characters to be displayed;

[0165] A first determination module 302 is used to determine the width of a target display area for displaying the characters to be displayed, and to determine a first display font size of the characters to be displayed;

[0166] The second determination module 303 is used to determine a first display width required to display the character to be displayed according to the first display font size;

[0167] A determination module 304 is used to determine whether the first display width exceeds the area width;

[0168] The display module 305 is configured to reduce the font size of the first display font size to obtain a second display font size if the first width exceeds the area width, and display the characters to be displayed using the second display font size.

[0169] In a possible implementation, the display module 305 is configured to display the to-be-displayed character using the first display font size if the first width does not exceed the area width.

[0170] In one possible implementation, the display module 305 is used to adjust the first display font size to a font size one level smaller to obtain the second display font size; determine whether the second display font size is smaller than the preset minimum font size of the target display area; if the second display font size is greater than or equal to the preset minimum font size, determine the second display width required to display the characters to be displayed according to the second display font size; determine whether the second display width exceeds the area width; if the second width does not exceed the area width, display the characters to be displayed using the second display font size.

[0171] In a possible implementation, the display module 305 is configured to display the to-be-displayed character in the preset minimum font size if the second display font size is smaller than the preset minimum font size.

[0172] In one possible implementation, the display module 305 is used to update the second display font size to the first display font size if the second width exceeds the area width, and again perform the step of adjusting the first display font size to a smaller font size to obtain the second display font size, until the second display font size is smaller than the preset minimum font size, or until the second display width does not exceed the area width.

[0173] In a possible implementation, the display module 305 is used to determine the area height of the target display area; determine the display height required to display the characters to be displayed according to the preset minimum font size and by wrapping the characters according to the area width; determine whether the display height is less than or equal to the area height; if the display height is less than or equal to the area height, display the characters to be displayed according to the preset minimum font size and by wrapping the characters according to the area width; if the display height is greater than the area height, omit some of the characters to be displayed to obtain omitted characters to be displayed, and display the omitted characters to be displayed using the preset minimum font size.

[0174] In a possible implementation, the display module 305 is used to determine the first character that cannot be displayed in the above-mentioned target display area and the second character that can be displayed in the above-mentioned target display area when the above-mentioned characters to be displayed are displayed according to the above-mentioned preset minimum font size and wrapped according to the above-mentioned area width; the last preset number of characters in the above-mentioned second character and the above-mentioned first character are used as target omitted characters; and the above-mentioned target omitted characters in the above-mentioned characters to be displayed are deleted to obtain the above-mentioned omitted characters to be displayed.

[0175] In a possible implementation, the display module 305 is used to add an ellipsis suffix to the above-mentioned omitted characters to be displayed to obtain the target characters to be omitted; and display the above-mentioned target characters to be omitted according to the above-mentioned preset minimum font size and line breaks according to the above-mentioned area width.

[0176] In a possible implementation, the second determination module 303 is used to obtain the screen pixel ratio of the electronic device currently displaying the target display area; and determine the first display width required to display the characters to be displayed in the first display font size according to the screen pixel ratio.

[0177] The division of the modules in the above-mentioned character display device is only for illustration. In other embodiments, the character display device can be divided into different modules as needed to complete all or part of the functions of the above-mentioned character display device. The implementation of each module in the character display device provided in the embodiments of this specification can be in the form of a computer program. The computer program can be run on a terminal or a server. The program modules constituted by the computer program can be stored in the memory of the terminal or the server. When the computer program is executed by the processor, all or part of the steps of the character display method described in the embodiments of this specification are implemented.

[0178] In addition, in order to better implement the character display method in the embodiment of this specification, this specification also provides an electronic device based on the character display method. Fig.12 , Fig.12 The first structural diagram of the electronic device provided in the embodiment of this specification. The electronic device 400 includes a processor 401 and a memory 402. The processor 401 is electrically connected to the memory 402.

[0179] The processor 401 is the control center of the electronic device 400. It uses various interfaces and lines to connect various parts of the entire electronic device. By running or calling the computer program stored in the memory 402, and calling the data stored in the memory 402, it executes various functions of the electronic device and processes data, thereby monitoring the electronic device as a whole. Among them, the processor 401 can be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc.

[0180] The memory 402 can be used to store computer programs and data. The computer program stored in the memory 402 contains instructions that can be executed in the processor, that is, executable program codes are stored. Computer programs can form various functional modules. The processor 401 executes various functional applications and data processing by calling the computer program stored in the memory 402. Among them, the memory 402 can mainly include a program storage area and a data storage area. The program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area can store data created according to the use of the electronic device 400 (such as audio data, video data, etc.), etc. In addition, the memory can include a high-speed random access memory, and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (FlashCard), at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.

[0181] In this embodiment, the processor 401 in the electronic device 400 will load instructions corresponding to the processes of one or more computer programs into the memory 402 according to the following steps, and the processor 401 will run the computer program corresponding to the executable program code stored in the memory 402, thereby realizing various functions:

[0182] Get the characters to be displayed;

[0183] Determining the area width of the target display area for displaying the characters to be displayed, and determining the first display font size of the characters to be displayed;

[0184] Determine a first display width required to display the character to be displayed according to the first display font size;

[0185] Determining whether the first display width exceeds the area width;

[0186] If the first width exceeds the area width, the font size of the first display font size is reduced to obtain a second display font size, and the characters to be displayed are displayed using the second display font size.

[0187] In one possible implementation, see Fig.13 , Fig.13 The second structural diagram of the electronic device provided in the embodiment of this specification. The electronic device 400 further includes: a radio frequency circuit 403, a display screen 404, a control circuit 405, an input unit 406, an audio circuit 407, a sensor 408, and a power supply 409. The processor 401 is electrically connected to the radio frequency circuit 403, the display screen 404, the control circuit 405, the input unit 406, the audio circuit 407, the sensor 408, and the power supply 409, respectively.

[0188] The radio frequency circuit 403 is used to send and receive radio frequency signals to communicate with network devices or other electronic devices through wireless communication.

[0189] The display screen 404 may be used to display information input by a user or information provided to a user and various graphical user interfaces of the electronic device. These graphical user interfaces may be composed of images, texts, icons, videos and any combination thereof.

[0190] The control circuit 405 is electrically connected to the display screen 404 and is used to control the display screen 404 to display information.

[0191] The input unit 406 can be used to receive input numbers, character information or user feature information (such as fingerprints), and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control. The input unit 406 can include a fingerprint recognition module.

[0192] The audio circuit 407 can provide an audio interface between the user and the electronic device through a speaker and a microphone. The audio circuit 407 includes a microphone. The microphone is electrically connected to the processor 401. The microphone is used to receive voice information input by the user.

[0193] The sensor 408 is used to collect external environment information. The sensor 408 may include one or more sensors such as an environment brightness sensor, an acceleration sensor, and a gyroscope.

[0194] The power supply 409 is used to supply power to various components of the electronic device 400. In a possible implementation, the power supply 409 may be logically connected to the processor 401 through a power management system, so that the power management system can manage charging, discharging, power consumption and other functions.

[0195] Although not shown in the figure, the electronic device 400 may also include a camera, a Bluetooth module, etc., which will not be described in detail here.

[0196] In this embodiment, the processor 401 in the electronic device 400 loads instructions corresponding to the processes of one or more computer programs into the memory 402 according to the following steps, and the processor 401 runs the computer programs stored in the memory 402 to implement various functions:

[0197] Get the characters to be displayed;

[0198] Determining the area width of the target display area for displaying the characters to be displayed, and determining the first display font size of the characters to be displayed;

[0199] Determine a first display width required to display the character to be displayed according to the first display font size;

[0200] Determining whether the first display width exceeds the area width;

[0201] If the first width exceeds the area width, the font size of the first display font size is reduced to obtain a second display font size, and the characters to be displayed are displayed using the second display font size.

[0202] In a possible implementation, after determining whether the first display width exceeds the area width, the processor 401 may further execute:

[0203] If the first width does not exceed the area width, the characters to be displayed are displayed using the first display font size.

[0204] In a possible implementation, when the processor 401 reduces the font size of the first display font size to obtain a second display font size and displays the to-be-displayed character using the second display font size, the processor 401 may execute:

[0205] Adjust the first display font size to a font size one level smaller to obtain the second display font size;

[0206] Determining whether the second display font size is smaller than a preset minimum font size of the target display area;

[0207] If the second display font size is greater than or equal to the preset minimum font size, determining a second display width required to display the character to be displayed according to the second display font size;

[0208] Determining whether the second display width exceeds the area width;

[0209] If the second width does not exceed the area width, the characters to be displayed are displayed using the second display font size.

[0210] In a possible implementation, after determining whether the second display font size is smaller than the preset minimum font size of the target display area, the processor 401 may further execute:

[0211] If the second display font size is smaller than the preset minimum font size, the characters to be displayed are displayed using the preset minimum font size.

[0212] In a possible implementation, after determining whether the second display width exceeds the area width, the processor 401 may further execute:

[0213] If the second width exceeds the area width, the second display font size is updated to the first display font size, and the step of adjusting the first display font size to a smaller font size to obtain the second display font size is performed again, until the second display font size is smaller than the preset minimum font size, or until the second display width does not exceed the area width.

[0214] In a possible implementation, when the processor 401 displays the characters to be displayed using the preset minimum font size, the processor 401 may execute:

[0215] Determine the area height of the above target display area;

[0216] Determine the display height required for displaying the characters to be displayed according to the preset minimum font size and in line breaks according to the width of the area;

[0217] Determine whether the display height is less than or equal to the area height;

[0218] If the display height is less than or equal to the area height, the characters to be displayed are displayed according to the preset minimum font size and line breaks according to the area width;

[0219] If the display height is greater than the area height, some of the characters to be displayed are omitted to obtain omitted characters to be displayed, and the omitted characters to be displayed are displayed using the preset minimum font size.

[0220] In a possible implementation, when the processor 401 omits some of the characters to be displayed to obtain the omitted characters to be displayed, the processor 401 may execute:

[0221] Determine that the characters to be displayed are displayed in accordance with the preset minimum font size and in accordance with the area width, and that a first character that cannot be displayed in the target display area and a second character that can be displayed in the target display area are displayed;

[0222] The last preset number of characters in the second character and the first character are used as target omitted characters;

[0223] The target omitted characters in the characters to be displayed are deleted to obtain the omitted characters to be displayed.

[0224] In a possible implementation, when the processor 401 displays the omitted characters to be displayed using the preset minimum font size, it may execute:

[0225] Add an ellipsis suffix to the above-mentioned omitted characters to obtain the target omitted characters to be displayed;

[0226] The target characters to be omitted are displayed according to the preset minimum font size and line breaks according to the area width.

[0227] In a possible implementation, when determining the first display width required to display the to-be-displayed character according to the first display font size, the processor 401 may execute:

[0228] Obtaining a screen pixel ratio of an electronic device currently displaying the target display area;

[0229] The first display width required for displaying the to-be-displayed character in the first display font size is determined according to the screen pixel ratio.

[0230] The embodiments of this specification also provide a computer-readable storage medium, in which a computer program is stored. When the computer program is run on a computer, the computer executes one or more steps in the above embodiments. If the components of the above electronic device are implemented in the form of software functional units and sold or used as independent products, they can be stored in the computer-readable storage medium.

[0231] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of this specification is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted through the computer-readable storage medium. The computer instructions can be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (Digital Subscriber Line, DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server, data center, etc. that contains one or more available media integrated. The available medium may be a magnetic medium (eg, a floppy disk, a hard disk, a magnetic tape), an optical medium (eg, a digital versatile disc (DVD)), or a semiconductor medium (eg, a solid state disk (SSD)).

[0232] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. The aforementioned storage medium includes: ROM, RAM, magnetic disk or optical disk and other media that can store program codes. In the absence of conflict, the technical features in this embodiment and the implementation scheme can be combined arbitrarily.

[0233] The embodiments described above are merely preferred embodiments of this specification and are not intended to limit the scope of this specification. Without departing from the design spirit of this specification, various modifications and improvements made to the technical solutions of this specification by ordinary technicians in this field should fall within the scope of protection determined by the claims of this specification.

[0234] The above is a description of a specific embodiment of the present specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0235] In addition, the terms "first", "second", and "third" in this specification are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or device that includes a series of steps or modules is not limited to the listed steps or modules, but some embodiments also include steps or modules that are not listed, or some embodiments also include other steps or modules that are inherent to these processes, methods, products, or devices.

[0236] The above is a detailed introduction to the character display method, device, storage medium and electronic device provided in the embodiments of this specification. This article uses specific examples to illustrate the principles and implementation methods of this specification. The description of the above embodiments is only used to help understand the method and core ideas of this specification; at the same time, for technicians in this field, according to the ideas of this specification, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on this specification.

Claims

1. A character display method, comprising: Get the characters to be displayed; Determining the area width of the target display area for displaying the characters to be displayed, and determining a first display font size of the characters to be displayed; Determine a first display width required for displaying the character to be displayed according to the first display font size; Determining whether the first display width exceeds the area width; If the first width exceeds the area width, the font size of the first display font size is reduced to obtain a second display font size, and the to-be-displayed characters are displayed using the second display font size.

2. The method according to claim 1, after determining whether the first display width exceeds the area width, further comprising: If the first width does not exceed the area width, the characters to be displayed are displayed using the first display font size.

3. The method according to claim 1, wherein the first display font size is reduced to obtain a second display font size, and the characters to be displayed are displayed using the second display font size, comprising: Adjusting the first display font size to a font size one level smaller to obtain the second display font size; Determining whether the second display font size is smaller than a preset minimum font size of the target display area; If the second display font size is greater than or equal to the preset minimum font size, determining a second display width required to display the character to be displayed according to the second display font size; Determining whether the second display width exceeds the area width; If the second width does not exceed the area width, the characters to be displayed are displayed using the second display font size.

4. The method according to claim 3, after determining whether the second display font size is smaller than the preset minimum font size of the target display area, further comprising: If the second display font size is smaller than the preset minimum font size, the to-be-displayed character is displayed using the preset minimum font size.

5. The method according to claim 3, after determining whether the second display width exceeds the area width, further comprising: If the second width exceeds the area width, the second display font size is updated to the first display font size, and the step of adjusting the first display font size to a smaller font size to obtain the second display font size is performed again until the second display font size is smaller than the preset minimum font size, or until the second display width does not exceed the area width.

6. The method according to claim 4, wherein displaying the characters to be displayed using the preset minimum font size comprises: Determining the area height of the target display area; Determine the display height required for displaying the characters to be displayed in line breaks according to the preset minimum font size and the area width; Determining whether the display height is less than or equal to the area height; If the display height is less than or equal to the area height, the characters to be displayed are displayed according to the preset minimum font size and line breaks according to the area width; If the display height is greater than the area height, some characters in the characters to be displayed are omitted to obtain omitted characters to be displayed, and the omitted characters to be displayed are displayed using the preset minimum font size.

7. The method according to claim 6, wherein omitting some of the characters to be displayed to obtain omitted characters to be displayed comprises: Determine that the characters to be displayed are displayed in the preset minimum font size and in line breaks according to the area width, and display a first character that cannot be displayed in the target display area and a second character that can be displayed in the target display area; The last preset number of characters in the second character and the first character are used as target omitted characters; The target omitted character in the characters to be displayed is deleted to obtain the omitted character to be displayed.

8. The method according to claim 6, wherein displaying the to-be-displayed omitted characters by using the preset minimum font size comprises: Adding an ellipsis suffix to the to-be-displayed omitted character to obtain a target to-be-displayed omitted character; The target characters to be omitted are displayed according to the preset minimum font size and line breaks according to the area width.

9. The method according to claim 1, wherein determining a first display width required for displaying the character to be displayed in the first display font size comprises: Acquire a screen pixel ratio of an electronic device currently displaying the target display area; The first display width required for displaying the character to be displayed in the first display font size is determined according to the screen pixel ratio.

10. A character display device, comprising: An acquisition module, used to acquire characters to be displayed; A first determination module, used to determine the area width of a target display area for displaying the characters to be displayed, and to determine a first display font size of the characters to be displayed; A second determining module is used to determine a first display width required to display the character to be displayed according to the first display font size; A judging module, used for judging whether the first display width exceeds the area width; A display module is used for reducing the font size of the first display font size to obtain a second display font size if the first width exceeds the area width, and displaying the characters to be displayed by using the second display font size.

11. A computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed on a computer, the computer is caused to execute the method according to any one of claims 1 to 9.

12. An electronic device, comprising a processor and a memory; the processor is connected to the memory; The memory is used to store executable program code; The processor runs a program corresponding to the executable program code by reading the executable program code stored in the memory, so as to execute the method according to any one of claims 1 to 9.

13. A computer program product comprising instructions, which, when executed on a computer or a processor, causes the computer or the processor to execute the steps of the method according to any one of claims 1 to 9.