Text display apparatus and text display method

By splitting the characters in the target text into multiple strings with a width not greater than the preset width threshold, and determining the part to be omitted in multiple strings, the problem of difficult to display excessive text content in the smart device interface is solved, and multiple lines of display effects and unified and friendly interface display are realized in a limited display area.

CN119718488APending Publication Date: 2025-03-28HISENSE VISUAL TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311253197.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-09-26
Publication Date
2025-03-28

AI Technical Summary

Technical Problem

In the interface of smart devices, it is difficult to fully display excessive text content in limited display areas. The existing technologies such as scrolling text and font adaptive interfaces have problems such as high device performance consumption, low user search efficiency and unsightly interfaces.

Method used

By splitting the characters in the target text into a plurality of character strings with a width not greater than the preset width threshold, if the number of character strings is more than the preset text display line number, the first character string to be omitted and the second character string to be retained are determined in the plurality of character strings, and some characters in the first character string are deleted according to the width threshold and ellipses to obtain reserved characters, and the second character string, omitted and reserved characters are displayed.

Benefits of technology

It improves the multi-line display effect of the target text in a limited display area, has good adaptability, can meet the unified and friendly interface display, and avoids the problems of large equipment performance consumption, low user search efficiency and unsightly interface.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119718488A_ABST
    Figure CN119718488A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides text display equipment and a text display method, and belongs to the technical field of interface development. The text display apparatus includes: a display; the controller is in communication connection with the display and is configured to obtain a to-be-displayed target text; splitting characters in the target text into a plurality of character strings of which the widths are not greater than a preset width threshold value; if the number of the character strings is greater than the preset text display line number, determining a first character string to be omitted and a second character string to be reserved in a plurality of character strings; deleting part of characters in the first character string according to the width threshold value and a preset provincial symbol to obtain reserved characters; and displaying the second character string, the provincial character and the reserved character. According to the embodiment of the invention, the multi-line display effect of the target text in the limited display area can be improved, the method has good adaptive ability, and unified and friendly interface display can be met.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the technical field of interface development, and more specifically, to a text display device and a text display method. Background Art

[0002] When displaying files, applications, article titles and other objects in the interface of smart devices, it is often necessary to display text content in a limited display area. Due to the limited display area, it is difficult to fully display long text content in the display area. Currently, scrolling text, font adaptive interface and other methods are generally used to display text content in a limited display area.

[0003] However, scrolling text consumes a lot of device performance, and when the text is long, the user needs to wait for the text content to scroll and display before confirming the object. The font adaptive interface method has high requirements on the device, and when there are many objects, the font size is different, and the interface effect is not uniform. Summary of the invention

[0004] The exemplary implementation of the present application provides a text display device and a text display method for improving the multi-line display effect of a target text in a limited display area, having good adaptability and being able to meet the requirements of a unified and friendly interface display.

[0005] The technical solutions provided by the embodiments of this application are as follows:

[0006] In a first aspect, an embodiment of the present application provides a text display device, including:

[0007] monitor;

[0008] A controller, in communication with the display, is configured to:

[0009] Get the target text to be displayed;

[0010] Splitting characters in the target text into multiple character strings whose widths are not greater than a preset width threshold;

[0011] If the number of the character strings is greater than the preset number of text display lines, determining a first character string to be omitted and a second character string to be retained from the plurality of character strings;

[0012] Deleting some characters in the first character string according to the width threshold and a preset ellipsis symbol to obtain reserved characters;

[0013] The second character string, the ellipsis, and the reserved characters are displayed.

[0014] In some embodiments, a first character string to be omitted and a second character string to be retained are determined from the plurality of character strings, and the controller is further configured to:

[0015] Determine a first number that is one less than the number of text display lines as the number of character strings to be retained;

[0016] Determine a second number remaining from the number of the plurality of character strings minus the first number as the number of character strings to be omitted;

[0017] determining the second number of consecutive character strings among the plurality of character strings as the first character strings to be omitted;

[0018] The other character strings among the plurality of character strings except the first character string are determined as the second character string to be retained.

[0019] In some embodiments, the second number of consecutive character strings is determined from the plurality of character strings as the first character string to be omitted, and the controller is further configured to:

[0020] Starting from the character string at the end of the target text, determining the second number of consecutive character strings as the first character string to be omitted;

[0021] Alternatively, starting from the character string located at the head of the target text, the second number of consecutive character strings are determined as the first character string to be omitted;

[0022] Alternatively, a middle character string excluding the head character string and the last character string among the plurality of character strings is determined, and the second number of consecutive first character strings is determined from the middle character string.

[0023] In some embodiments, a first character string to be omitted and a second character string to be retained are determined from the plurality of character strings, and the controller is further configured to:

[0024] When there are multiple target texts to be displayed on the interface of the display, each of the target texts is used as the current target text one by one;

[0025] Determining similarities between the character string of the current target text and the character strings of other target texts;

[0026] Among the multiple character strings of the current target text, a first number of character strings with the lowest similarity are determined as second character strings to be retained, and other character strings except the second character strings are determined as first character strings to be omitted; wherein the first number is one less than the number of text display lines.

[0027] In some embodiments, some characters in the first character string are deleted according to the width threshold and a preset ellipsis to obtain reserved characters, and the controller is further configured to:

[0028] Determine a target width remaining after subtracting the width of the ellipsis from the width threshold;

[0029] In the case where the first character string is located at the end of the target text, determining whether the target text is a file name including a file extension type;

[0030] If not, retain the reserved characters that meet the target width starting from the last character of the first string, and delete the remaining characters;

[0031] If yes, then starting from the character with a specified number of digits before the character representing the file extension type in the first character string, multiple characters are deleted in reverse order to obtain the reserved characters that meet the target width.

[0032] In some embodiments, some characters in the first character string are deleted according to the width threshold and a preset ellipsis to obtain reserved characters, and the controller is further configured to:

[0033] Determine a target width remaining after subtracting the ellipsis from the width threshold;

[0034] In the case that the first character string is located at the head or the middle of the target text, the reserved characters that meet the target width are reserved starting from the first character of the first character string, and the remaining characters are deleted.

[0035] In some embodiments, the second character string, the ellipsis, and the reserved character are displayed, and the controller is further configured to:

[0036] concatenating the ellipsis character and the reserved character into a third character string;

[0037] According to the order of the first character string and the second character string in the target text, the second character string and the third character string are drawn and displayed line by line in the Textview control.

[0038] In some embodiments, the characters in the target text are split into a plurality of character strings whose widths are not greater than a preset width threshold, and the controller is further configured to:

[0039] Determine that the drawable width of the Textview control is the width threshold;

[0040] Traversing the characters in the target text in a preset order;

[0041] Starting from the first character, when the character drawing width between the current character and the first character reaches the width threshold, intercept the character string between the first character and the current character;

[0042] The next character of the current character is used as a new first character and the traversal is continued until all characters in the target text are traversed to obtain a plurality of the character strings.

[0043] In some embodiments, the controller is further configured to:

[0044] Setting the font size of the target text;

[0045] Detecting whether the width of the target text is greater than the width threshold;

[0046] If yes, executing the step of splitting the characters in the target text into a plurality of character strings whose width is not greater than a preset width threshold;

[0047] If not, the target text is drawn and displayed in the Textview control.

[0048] In a second aspect, an embodiment of the present application provides a text display method, which is applied to a text display device, and the method includes:

[0049] Get the target text to be displayed;

[0050] Splitting characters in the target text into multiple character strings whose widths are not greater than a preset width threshold;

[0051] If the number of the character strings is greater than the preset number of text display lines, determining a first character string to be omitted and a second character string to be retained from the plurality of character strings;

[0052] Deleting some characters in the first character string according to the width threshold and a preset ellipsis symbol to obtain reserved characters;

[0053] The second character string, the ellipsis, and the reserved characters are displayed.

[0054] It can be seen from the above technical scheme that the text display device and text display method provided in the embodiment of the present application, when the text display device obtains the target text to be displayed, splits the characters in the target text into multiple character strings whose width is not greater than a preset width threshold; if the number of the character strings is more than the preset number of text display lines, then determine the first character string to be omitted and the second character string to be retained in the multiple character strings; delete part of the characters in the first character string according to the width threshold and the preset ellipsis to obtain the retained characters; and display the second character string, the ellipsis and the retained characters. In the text display device and text display method provided in the embodiment of the present application, firstly, the characters in the target text are split into multiple character strings whose width is not greater than the preset width threshold, so that the text content to be displayed can be limited to a limited width range; if the number of character strings is more than the preset number of text display lines, it means that the target text needs to be displayed in multiple lines and exceeds the limited number of text display lines. In this case, some characters need to be omitted so that the remaining characters can adapt to the limited number of text display lines and width threshold. When omitting characters, first determine the first string to be omitted and the second string to be retained; for the first string, delete characters according to the width threshold and the ellipsis symbol, so that the width occupied by the retained characters can adapt to the remaining width range after removing the ellipsis symbol, that is, arrange the retained characters and the ellipsis symbol within the width threshold, which meets the expected arrangement effect; by deleting some characters in the first string, the number of lines occupied by the retained characters and the ellipsis symbol and the total number of lines occupied by the originally retained second string can adapt to the preset number of text display lines, so the originally retained second string, the omitted retained characters and the ellipsis symbol are displayed. Therefore, compared with existing methods such as scrolling text and font adaptive interface, the embodiment of the present application can effectively improve the problems of high consumption of device performance, low user search efficiency, and unsightly interface, thereby improving the multi-line display effect of the target text in a limited display area, having good adaptive ability, and being able to meet the requirements of unified and friendly interface display. BRIEF DESCRIPTION OF THE DRAWINGS

[0055] In order to more clearly illustrate the implementation methods in the embodiments of the present application or the related technologies, the following is a brief introduction to the drawings required for use in the embodiments or the related technology descriptions. Obviously, the drawings described below are some embodiments of the present application, and a person skilled in the art can also obtain other drawings based on these drawings.

[0056] Figure 1 A scene architecture diagram showing a text display method in some embodiments;

[0057] Figure 2 A hardware configuration block diagram of a text display device in some embodiments is shown;

[0058] Figure 3 A schematic diagram of scrolling text in some embodiments is shown;

[0059] Figure 4 shows schematic diagrams of omitted text in some embodiments;

[0060] Figure 5 A flowchart showing the steps of a text display method in some embodiments is shown;

[0061] Figure 6 Schematic diagrams of splitting character strings in other embodiments are shown;

[0062] Figure 7 A schematic diagram of a Textview control in some embodiments is shown;

[0063] Figure 8 A schematic diagram showing a plurality of character strings displayed in multiple lines in some embodiments;

[0064] Fig. 9 A schematic diagram of a first character string in some embodiments is shown;

[0065] Fig.10 Schematic diagrams of first character strings in some other embodiments are shown;

[0066] Fig.11 Schematic diagrams of first character strings in some other embodiments are shown;

[0067] Fig.12 Schematic diagrams of first character strings in some other embodiments are shown;

[0068] Fig.13 Schematic diagrams of first character strings in some other embodiments are shown;

[0069] Fig.14 A flowchart showing the steps of the text display method in some other embodiments is shown;

[0070] Fig.15 A schematic diagram showing reserved text in some embodiments;

[0071] Fig.16 A schematic diagram showing display text in some embodiments;

[0072] Fig.17 A schematic diagram of displaying multiple texts in some embodiments is shown. DETAILED DESCRIPTION

[0073] In order to make the purpose and implementation method of the present application clearer, the exemplary implementation method of the present application will be clearly and completely described below in conjunction with the drawings in the exemplary embodiments of the present application. Obviously, the described exemplary embodiments are only part of the embodiments of the present application, rather than all the embodiments.

[0074] It should be noted that the brief description of terms in this application is only for the convenience of understanding the embodiments described below, and is not intended to limit the embodiments of this application. Unless otherwise specified, these terms should be understood according to their common and usual meanings.

[0075] The terms "first", "second", "third", etc. in the specification and claims of this application and the above drawings are used to distinguish similar or similar objects or entities, and do not necessarily mean to limit a specific order or sequence, unless otherwise noted. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances.

[0076] The terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover but not exclude inclusion, for example, a product or device comprising a list of components is not necessarily limited to all the components expressly listed but may include other components not expressly listed or inherent to such product or device.

[0077] The display device provided in the embodiments of the present application may have various implementation forms, for example, it may be a television, a smart television, a laser projection device, a monitor, an electronic bulletin board, an electronic table, etc. Figure 1 and Figure 2 This is a specific implementation of the text display device of the present application.

[0078] The text display device provided in the embodiments of the present application may have various implementation forms, for example, it may be a television, a smart television, a laser projection device, a monitor, an electronic bulletin board, an electronic table, etc. Figure 1 This is a specific implementation of the text display device of the present application.

[0079] Figure 1 FIG. 1 is a schematic diagram of an operation scenario between a text display device and a control device according to an embodiment. Figure 1 As shown, the user can operate the text display device 200 through the smart device 300 or the input device 100. The text display device includes a display and a controller.

[0080] In some embodiments, the input device 100 may be a keyboard, a mouse, etc. The user may input user commands through buttons on the input device 100 , voice input, control panel input, etc. to control the text display 200 .

[0081] In some embodiments, a smart device 300 (such as a mobile terminal, a tablet computer, a computer, a laptop computer, etc.) may also be used to control the display device 200. For example, the text display device 200 is controlled using an application running on the smart device.

[0082] In some embodiments, the text display device may not use the above-mentioned smart device or input device to receive instructions, but may receive user control through touch or gestures.

[0083] In some embodiments, the text display device 200 can also be controlled in ways other than the input device 100 and the smart device 300. For example, the user's voice command control can be directly received through a module for obtaining voice commands configured inside the text display device 200, or the user's voice command control can be received through a voice control device set outside the text display device 200.

[0084] In some embodiments, the text display device 200 also communicates data with the server 400. The display device 200 may be allowed to communicate via a local area network (LAN), a wireless local area network (WLAN), and other networks. The server 400 may provide various content and interactions to the display device 200. The server 400 may be one cluster or multiple clusters, and may include one or more types of servers.

[0085] like Figure 2 The text display device 200 includes at least one of a tuner and demodulator 210, a communicator 220, a detector 230, an external device interface 240, a controller 250, a display 260, an audio output interface 270, a memory, a power supply, and a user interface.

[0086] In some embodiments, the controller includes a processor, a video processor, an audio processor, a graphics processor, a RAM, a ROM, and a first interface to an nth interface for input / output.

[0087] The display 260 includes a display screen component for presenting images and a driving component for driving image display, which is used to receive target text output from the controller, display the content of the target text, and a component of a menu control interface and a user control UI interface.

[0088] The display 260 may be a liquid crystal display, an OLED display, or a projection display, and may also be a projection device and a projection screen.

[0089] The communicator 220 is a component for communicating with an external device or server according to various communication protocol types. For example, the communicator may include at least one of a Wifi module, a Bluetooth module, a wired Ethernet module, or other network communication protocol chips or near field communication protocol chips, and an infrared receiver. The display device 200 may establish transmission and reception of control signals and data signals with the external input device 100 or the server 400 through the communicator 220.

[0090] The user interface may be used to receive a control signal from the input device 100 .

[0091] The detector 230 is used to collect signals from the external environment or the external interaction. For example, the detector 230 includes a light receiver, a sensor for collecting the intensity of ambient light; or, the detector 230 includes an image collector, such as a camera, which can be used to collect external environment scenes, user attributes or user interaction gestures; or, the detector 230 includes a sound collector, such as a microphone, etc., for receiving external sounds.

[0092] The external device interface 240 may include, but is not limited to, any one or more of the following: a high-definition multimedia interface (HDMI), an analog or digital high-definition component input interface (component), a composite video input interface (CVBS), a USB input interface (USB), an RGB port, etc. It may also be a composite input / output interface formed by the above multiple interfaces.

[0093] The tuner-demodulator 210 receives broadcast television signals via wired or wireless reception, and demodulates audio and video signals, such as EPG data signals, from a plurality of wireless or wired broadcast television signals.

[0094] In some embodiments, the controller 250 and the tuner-demodulator 210 may be located in different separate devices, that is, the tuner-demodulator 210 may also be located in an external device of the main device where the controller 250 is located, such as an external set-top box.

[0095] The controller 250 controls the operation of the display device and responds to user operations through various software control programs stored in the memory. The controller 250 controls the overall operation of the display device 200. For example, in response to receiving a user command for selecting a UI object to be displayed on the display 260, the controller 250 can perform operations related to the object selected by the user command.

[0096] In some embodiments, the controller includes a central processing unit (CPU), a video processor, an audio processor, a graphics processing unit (GPU), RAM Random Access Memory (RAM), ROM (Read-Only Memory, ROM), a first interface to an nth interface for input / output, a communication bus (Bus), etc.

[0097] The user may input a user command through a graphical user interface (GUI) displayed on the display 260, and the user input interface receives the user input command through the graphical user interface (GUI). Alternatively, the user may input a user command through a specific sound or gesture, and the user input interface recognizes the sound or gesture through a sensor to receive the user input command.

[0098] "User interface" is the medium interface for interaction and information exchange between applications or operating systems and users. It realizes the conversion between the internal form of information and the form acceptable to users. The commonly used form of user interface is the Graphical User Interface (GUI), which refers to the user interface related to computer operation displayed in a graphical way. It can be an interface element such as an icon, window, control, etc. displayed on the display screen of an electronic device, where the control can include icons, buttons, menus, tabs, text boxes, dialog boxes, status bars, navigation bars, widgets, etc.

[0099] When displaying text content in the interface of a smart device, due to the limited display area, it is difficult to fully display long text content in the display area. The above display area is such as the Textview control commonly used in Android interface development. The Textview control is mainly used to undertake the task of text display. The Textview control does not support ellipsis in the middle of multiple lines. At present, scrolling text, font adaptive interface, elliptical display and other methods are generally used to display text content in a limited display area.

[0100] However, scrolling text consumes a lot of device performance, and, for example, Figure 3 As shown in the figure, when the text is long, the user needs to wait for the text content to scroll and display before confirming the object. The font adaptive interface method has high requirements on the device, and when there are many objects, the font size is different, and the interface effect is not uniform. Figure 4 , the valid parts of the files that are similar may be directly omitted, and the text contents displayed on the interface are basically the same, so users cannot find the objects correctly in a short time.

[0101] In order to solve at least one of the many problems such as high device performance consumption, low user search efficiency, unsightly interface and Textview control not supporting ellipsis in the middle of multiple lines, the embodiment of the present application provides a text display method. When the character string of the target text exceeds the number of text display lines, the method determines a first character string to be omitted and a second character string to be retained, deletes some characters in the first character string, and obtains reserved characters, so that the total number of lines occupied by the second character string and the reserved characters and ellipsis can adapt to the number of text display lines, and displays the second character string, ellipsis and reserved characters, thereby improving the multi-line display effect of the target text in a limited display area and meeting the requirements of a unified and friendly interface display.

[0102] like Figure 5 As shown, Figure 5 The following is a flowchart of a text display method according to some embodiments. The method includes:

[0103] S501, obtaining a target text to be displayed, wherein the target text is generally a text that is long and needs to be displayed in multiple lines after the font size is set, such as a file name, an application name, a news title, etc.

[0104] S502: Split characters in the target text into multiple character strings whose widths are not greater than a preset width threshold, wherein the width threshold is used to indicate a displayable width limited by drawing a single line of text.

[0105] Reference Figure 6 As shown, in this embodiment, the characters in the target text can be split into multiple character strings from the first character of the target text and from the beginning to the end according to the width threshold; or, the characters in the target text can be split into multiple character strings from the end to the beginning starting from the last character of the target text. It can be understood that the width of the last character string split is less than or equal to the width threshold.

[0106] In this embodiment, the characters in the target text are split into multiple character strings according to the width threshold, which can ensure that the width of each character string does not exceed the width threshold. At the same time, the number of split character strings represents the total number of lines required to fully display the target text.

[0107] S503: If the number of the character strings is greater than the preset number of text display lines, determine a first character string to be omitted and a second character string to be retained from the plurality of character strings. The maximum number of text display lines limited in the display area can be set to the number of text display lines in this embodiment.

[0108] It can be understood that if the number of character strings is not more than the number of text display lines, it means that the limited display area can accommodate all the character strings, so each character string can be directly drawn line by line to display the complete target text.

[0109] If the number of character strings is greater than the number of text display lines, it means that the target text exceeds the limited display range of the display area, and some characters need to be deleted so that the number of lines occupied by the remaining characters does not exceed the number of text display lines. In this case, the present embodiment can determine a first character string to be omitted and a second character string to be retained from the plurality of character strings.

[0110] In some examples, several consecutive character strings are selected from multiple character strings as the first character string to be omitted, so that the multiple consecutive first character strings can be omitted as a whole at one time, avoiding the problem of multiple omissions and cumbersome processing of multiple character strings. Alternatively, in other examples, considering that the head and tail of the text are generally more critical, the character string at the head and / or tail can be determined as the second character string to be retained, and the character string in the middle can be determined as the first character string to be omitted.

[0111] The number of second character strings to be retained determined in this embodiment may be one less than the number of text display lines, thereby retaining as much content of the target text as possible and reducing the workload of omission processing accordingly.

[0112] S504: Delete some characters in the first character string according to the width threshold and a preset ellipsis character to obtain reserved characters.

[0113] In one embodiment, the target width remaining after the width of the ellipsis is subtracted from the width threshold is used as the width for accommodating the reserved characters. Some characters in the first character string are deleted to obtain the reserved characters that meet the target width.

[0114] It can be understood that by deleting some characters in the first character string, the total number of lines occupied by the reserved characters, ellipsis characters and the originally reserved second character string can be limited within the number of text display lines.

[0115] S505: Display the second character string, the ellipsis, and the reserved characters.

[0116] In this embodiment, the position of the ellipsis character can be set to the position of the deleted characters in the first character string, and based on the positions of the second character string and the retained characters in the target text, the second character string, the ellipsis character and the retained characters are spliced ​​together; then the spliced ​​characters are drawn and displayed line by line according to the width threshold and the number of text display lines, and finally the omitted target text is displayed.

[0117] It can be seen from the above technical scheme that the text display method provided by the embodiment of the present application, when the text display device obtains the target text to be displayed, splits the characters in the target text into multiple character strings whose width is not greater than a preset width threshold; if the number of the character strings is more than the preset number of text display lines, then determine the first character string to be omitted and the second character string to be retained in the multiple character strings; delete part of the characters in the first character string according to the width threshold and the preset ellipsis to obtain the retained characters; and display the second character string, the ellipsis and the retained characters. In the text display device and text display method provided by the embodiment of the present application, firstly, the characters in the target text are split into multiple character strings whose width is not greater than the preset width threshold, so that the text content to be displayed can be limited to a limited width range; if the number of character strings is more than the preset number of text display lines, it means that the target text needs to be displayed in multiple lines and exceeds the limited number of text display lines. In this case, some characters need to be omitted so that the remaining characters can adapt to the limited number of text display lines and width threshold. When omitting characters, first determine the first string to be omitted and the second string to be retained; for the first string, delete characters according to the width threshold and the ellipsis symbol, so that the width occupied by the retained characters can adapt to the remaining width range after removing the ellipsis symbol, that is, arrange the retained characters and the ellipsis symbol within the width threshold, which meets the expected arrangement effect; by deleting some characters in the first string, the number of lines occupied by the retained characters and the ellipsis symbol and the total number of lines occupied by the originally retained second string can adapt to the preset number of text display lines, so the originally retained second string, the omitted retained characters and the ellipsis symbol are displayed. Therefore, compared with existing methods such as scrolling text and font adaptive interface, the embodiment of the present application can effectively improve the problems of high consumption of device performance, low user search efficiency, and unsightly interface, thereby improving the multi-line display effect of the target text in a limited display area, having good adaptive ability, and being able to meet the requirements of unified and friendly interface display.

[0118] In some embodiments, the text display method may further include:

[0119] The font size of the target text is set; whether the width of the target text is greater than the width threshold is detected; if so, the step of splitting the characters in the target text into multiple strings whose widths are not greater than the preset width threshold is performed, that is, the above step S502. If not, the target text is drawn and displayed in the Textview control.

[0120] In a specific implementation, after setting the font size of the target text, the width required to completely draw the target text in a single line is calculated through tools such as Paint.measureText; the above Paint.measureText is a function for measuring the width value of the string display.

[0121] Check whether the width of the target text is greater than the width threshold. For example, the drawable width of the Textview control can be determined as the width threshold; Figure 7 The Textview control shown in the figure has padding areas on the left and right sides. The width threshold that can be used to draw text is obtained by subtracting the width of the two padding areas from the total width of the Textview control.

[0122] If the width of the target text is not greater than the width threshold, the target text can be directly drawn and displayed in the Textview control.

[0123] If the width of the target text is greater than the width threshold, it means that the target text cannot be fully displayed in one line and needs to be split. Referring to the following embodiment, a method for splitting characters in the target text into multiple strings whose widths are not greater than a preset width threshold is provided.

[0124] This embodiment includes: determining that the drawable width of the Textview control is the width threshold.

[0125] Traverse the characters in the target text in a preset order; start from the first character, and when the character drawing width between the current character and the first character reaches the width threshold, intercept the character string between the first character and the current character; take the next character of the current character as the new first character and continue traversing until all the characters in the target text are traversed to obtain multiple character strings.

[0126] The above-mentioned preset order is, for example, an order from the first character in the target text to the end, or vice versa, an order from the end to the beginning. Taking the preset order from the beginning to the end as an example, character traversal is performed starting from the first character of the target text. Each time a character is traversed, the accumulated character drawing width from the character to the first character is calculated, and the character drawing width is compared to see whether it reaches the width threshold. When the character drawing width from the current character to the first character reaches the width threshold, the character string from the first character to the current character is intercepted. In addition, this embodiment can also add the character string as a whole to the text split list displayed by line.

[0127] Then, the traversal starts again from the next character of the current character until all characters in the target text are traversed to obtain multiple character strings. Multiple character strings are added to the text split list. Figure 8 As shown, the target text is split into multiple strings that are displayed on multiple lines and whose width is not greater than the width threshold.

[0128] For example, assume that the target text is HabcdefVirtualAssistant-common-release061601.apk, and the width threshold is 264. Start traversing from the first character H, and when the accumulated character drawing width reaches l when traversing to the current character l, the HabcdefVirtual string is intercepted and stored in the text split list. Continue traversing from the next character A after l, and finally obtain the following four strings: HabcdefVirtual, Assistant-com, mon-release06, 1601.apk.

[0129] The strings split according to the width threshold each occupy one line respectively. Based on this, the embodiment compares whether the number of strings is greater than the preset number of text display lines. If the number of strings is less than or equal to the number of text display lines, the text split list is directly stored in the final list, and then each string in the final list is drawn line by line to fully display the target text.

[0130] If the number of the character strings is greater than the preset number of text display lines, a first character string to be omitted and a second character string to be retained are determined from the plurality of character strings.

[0131] In one embodiment, a first number less than the number of text display lines is determined as the number of character strings to be retained; a second number remaining from the number of multiple character strings minus the first number is determined as the number of character strings to be omitted. For example, if the number of text display lines is 2, the first number of character strings to be retained is determined to be 1, i.e., one character string is retained completely; if the number of character strings is 4, minus one character string to be retained, the number of character strings to be omitted is determined to be 3. This method can retain complete character strings to the greatest extent, leaving only one line of space for drawing the character strings to be omitted, thereby reducing the workload of omission processing.

[0132] The second number of consecutive character strings are determined from the plurality of character strings as the first character string to be omitted; and the other character strings from the plurality of character strings except the first character string are determined as the second character string to be retained. In this embodiment, the plurality of consecutive character strings are used as the first character string to be omitted, and the first character string can be regarded as a character string connected as a whole, so as to simplify the process of omission.

[0133] In this embodiment, the second number of consecutive character strings are determined from the plurality of character strings as the first character strings to be omitted. For details, refer to the following examples.

[0134] Example 1. Starting from the character string at the end of the target text, the second number of consecutive character strings are determined as the first character string to be omitted. Fig. 9 As shown, starting from the string at the end of the target text (i.e., string 4), three consecutive strings are determined as the first string to be omitted. For easy distinction, the first string to be omitted is represented by a dotted line, while the string to be retained is represented by a solid line. This method can retain the header text content of the target text and omit the text content in the middle and tail, and is suitable for scenarios where the header content is more critical.

[0135] Or, Example 2: Starting from the character string located at the head of the target text, the second number of consecutive character strings are determined as the first character string to be omitted.

[0136] In some embodiments, when the target text is split from the beginning to the end, and the width of the last character string in the target text satisfies a specified width value (such as half of the width threshold), starting from the character string at the beginning of the target text, a second number of consecutive character strings can be determined as the first character string to be omitted, and correspondingly, the remaining character string at the end is the second character string to be retained. Fig.10 As shown, starting from the string at the head of the target text (i.e., string 1), three consecutive strings are determined as the first string to be omitted, and the remaining string 4 to be retained at the end is wider and can occupy most of the space of a line. In this embodiment, although the last string to be retained does not necessarily occupy an entire line, it can still express the key content at the end due to its wider width.

[0137] In other embodiments, Fig.11 As shown, in the case of splitting the target text from the tail to the head in reverse order, starting from the string at the head of the target text, the second number of continuous strings are determined as the first string to be omitted, and correspondingly, the remaining string at the tail is the second string to be retained. It can be understood that when splitting the target text from the tail to the head, the last string in the target text is the first string to be split out, and its width is equal to the width threshold, which can occupy an entire line; the width of the string at the head of the target text is less than or equal to the width threshold, and starting from the string at the head, the second number of continuous strings are determined as the first string to be omitted.

[0138] The method provided in this example can retain the tail text content of the target text and omit the head and middle text content. It is suitable for scenarios where the tail content is more critical.

[0139] Or, Example 3: Determine a middle string except the head and the last string among the plurality of strings, and determine the second number of consecutive first strings from the middle string. Fig.12 As shown, the middle character strings except the head and the last character string are character string 2 and character string 3, and character string 2 and character string 3 are determined as the first character string. Fig.13 As shown, the middle character string excluding the head and the last character string includes character string 2, character string 3 and character string 4. The two first continuous character strings determined from the middle character string may be character string 2 and character string 3 (left figure), or may be character string 3 and character string 4 (right figure). This example is applicable to the case where the number of character strings to be retained is at least two lines, and the text content of the head and tail in the target text can be relatively completely retained.

[0140] The above are only several examples of the first character string to be omitted, and are not limited thereto in practical applications.

[0141] In this embodiment, another implementation method for determining a first character string to be omitted and a second character string to be retained from a plurality of character strings may be provided, as shown below.

[0142] When there are multiple target texts to be displayed on the interface of the display, each of the target texts is used as the current target text one by one; the similarity between the character string of the current target text and the character strings of other target texts is determined; among the multiple character strings of the current target text, the first number of character strings with the lowest similarity are determined as the second character strings to be retained, and the other character strings except the second character strings are determined as the first character strings to be omitted; wherein the first number is one less than the number of text display lines.

[0143] This embodiment compares the similarity of character strings between different target texts, retains the second character string with the lowest similarity and the greatest difference, and omits the character string with higher similarity. In this way, multiple target texts on the interface can be displayed differently, which facilitates users to quickly find the target text they want and improves text search efficiency.

[0144] Based on the above embodiment, after determining the first character string to be omitted, some characters in the first character string can be deleted according to the width threshold and the preset ellipsis symbol to obtain reserved characters, which is described in detail in this embodiment.

[0145] Reference Fig.14 , this embodiment includes:

[0146] S1401: Determine a target width remaining after subtracting the width of the ellipsis from the width threshold.

[0147] S1402: When the first character string is located at the end of the target text, determine whether the target text is a file name including a file extension type.

[0148] Specifically, the method for determining whether the target text is a file name including a file extension type is as follows: a plurality of characters indicating file extension types may be preset, and characters in the target text are compared with the plurality of characters indicating file extension types to determine whether the target text can match any of the characters indicating file extension types; if the characters cannot match, it is determined that the target text is not a file name including a file extension type, in which case, the following step S1403 is executed. If the characters can match, it is determined that the target text is a file name including a file extension type, in which case, the following step S1404 is executed to perform special processing on the characters indicating file extension types in the target text.

[0149] S1403, starting from the last character of the first character string, retain the reserved characters that meet the target width, and delete the remaining characters. In the case where the target text is not a file name including a file extension type, there is no need to consider retaining the characters representing the file extension type. In most cases, the content at the end of the text is relatively more critical, and the user has a stronger demand to retain the content at the end of the text. Based on this, the present embodiment retains a plurality of characters that meet the target width starting from the last character of the first character string, obtains the reserved characters, and deletes the remaining characters. The deleted characters are represented by a preset ellipsis, such as ...

[0150] S1404. Starting from the characters of the specified number of places before the characters representing the file extension type in the first character string, delete multiple characters in reverse order to obtain the retained characters that meet the target width. In the case where the target text is a file name including a file extension type, the characters representing the file extension type need to be retained. In this case, since the format of the file extension type is generally composed of a decimal point and its suffix, all characters of the decimal point and its suffix in the first character string are retained, and characters of a certain number of places (such as two places) before the decimal point can also be further retained. Fig.15 For example, retain the following characters .apk indicating the file extension type, and retain the two characters 01 before it, so that 01.apk is retained.

[0151] Starting from character 0, delete multiple characters in reverse order to obtain the reserved characters that meet the target width. Specifically, each character can be deleted one by one in reverse order. Each time a character is deleted, it is determined whether the width of the remaining characters meets the target width. The loop is traversed until the width of the remaining characters meets the target width, and the reserved characters are obtained. It can be understood that the reserved characters include the above-mentioned 01.apk, and also include some characters after the characters deleted in reverse order in the first character string. The width of the reserved characters and the ellipsis is equal to the width threshold.

[0152] Next, the ellipsis and the reserved characters are concatenated into a third string; the second string and the third string are drawn and displayed line by line in the Textview control according to the order of the first string and the second string in the target text.

[0153] like Fig.16 As shown, in this embodiment, when the ellipsis and the reserved characters are concatenated into a third string, the position of the reserved characters in the third string is the same as its position in the first string, and the position of the ellipsis in the third string corresponds to the position of the deleted characters in the first string. The second string and the third string are drawn and displayed line by line in the Textview control according to the order of the first string and the second string in the target text.

[0154] like Fig.17 As shown, the target texts corresponding to multiple folders are displayed simultaneously in the interface, the first character string is located at the end of the target text, and the target text is a file name including a file extension type. After the omission and splicing are performed by this embodiment, the multiple texts finally displayed can be distinguished by the characters "01", "02", and "03" at the end of the third character string, which is convenient for users to quickly locate the required text from multiple similar texts.

[0155] S1405: When the first character string is located at the head or the middle of the target text, retain the reserved characters that meet the target width starting from the first character of the first character string, and delete the remaining characters.

[0156] In the case where the first character string is located at the head or the middle of the target text, the character string to be retained is located at the tail of the target text. Considering that if the width of the character string at the tail is small, such as only one character, the display area will be wasted. Based on this, the present embodiment can be arranged to adopt the solution of the present embodiment when the width of the second character string located at the tail is greater than a specified width value (such as half of the width threshold).

[0157] Then, the second character string, the ellipsis and the reserved characters are displayed accordingly. The specific display method can refer to the above embodiment and will not be described in detail here.

[0158] A text display device is also provided in an embodiment of the present application, including: a display; a controller, which is communicatively connected to the display and is configured to: obtain a target text to be displayed; split the characters in the target text into multiple character strings whose width is not greater than a preset width threshold; if the number of the character strings is more than the preset number of text display lines, determine a first character string to be omitted and a second character string to be retained from the multiple character strings; delete part of the characters in the first character string according to the width threshold and a preset ellipsis character to obtain retained characters; and display the second character string, the ellipsis character and the retained characters.

[0159] In some embodiments, the embodiments of the present application also provide an electronic device, including: a memory and a processor, wherein the memory is used to store a computer program; and the processor is used to enable the electronic device to implement the text display method described in any of the above embodiments when executing the computer program.

[0160] In some embodiments, an embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a computing device, the computing device implements the text display method described in any of the above embodiments.

[0161] In some embodiments, an embodiment of the present application provides a computer program product. When the computer program product runs on a computer, the computer implements the text display method described in the second aspect or any embodiment of the second aspect.

[0162] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.

[0163] For the convenience of explanation, the above description has been made in conjunction with specific embodiments. However, the above exemplary discussion is not intended to be exhaustive or limit the embodiments to the specific forms disclosed above. Based on the above teachings, various modifications and variations can be obtained. The selection and description of the above embodiments are to better explain the principles and practical applications, so that those skilled in the art can better use the embodiments and various different variations of the embodiments suitable for specific use considerations.

Claims

1. A text display device, characterized in that: include: monitor; A controller, in communication with the display, is configured to: Get the target text to be displayed; Splitting characters in the target text into multiple character strings whose widths are not greater than a preset width threshold; If the number of the character strings is greater than the preset number of text display lines, determining a first character string to be omitted and a second character string to be retained from the plurality of character strings; Deleting some characters in the first character string according to the width threshold and a preset ellipsis symbol to obtain reserved characters; The second character string, the ellipsis, and the reserved characters are displayed.

2. The text display device according to claim 1, characterized in that Determine a first character string to be omitted and a second character string to be retained from the plurality of character strings, and the controller is further configured to: Determine a first number that is one less than the number of text display lines as the number of character strings to be retained; Determine a second number remaining from the number of the plurality of character strings minus the first number as the number of character strings to be omitted; determining the second number of consecutive character strings among the plurality of character strings as the first character strings to be omitted; The other character strings among the plurality of character strings except the first character string are determined as the second character string to be retained.

3. The text display device according to claim 2, characterized in that: The controller is further configured to: determine the second number of consecutive character strings from the plurality of character strings as the first character strings to be omitted; Starting from the character string at the end of the target text, determining the second number of consecutive character strings as the first character string to be omitted; Alternatively, starting from the character string located at the head of the target text, the second number of consecutive character strings are determined as the first character string to be omitted; Alternatively, a middle character string excluding the head character string and the last character string among the plurality of character strings is determined, and the second number of consecutive first character strings is determined from the middle character string.

4. The text display device according to claim 1, characterized in that: Determine a first character string to be omitted and a second character string to be retained from the plurality of character strings, and the controller is further configured to: When there are multiple target texts to be displayed on the interface of the display, each of the target texts is used as the current target text one by one; Determining similarities between the character string of the current target text and the character strings of other target texts; Among the multiple character strings of the current target text, a first number of character strings with the lowest similarity are determined as second character strings to be retained, and other character strings except the second character strings are determined as first character strings to be omitted; wherein the first number is one less than the number of text display lines.

5. The text display device according to claim 1, characterized in that: Some characters in the first character string are deleted according to the width threshold and a preset ellipsis to obtain reserved characters, and the controller is further configured to: Determine a target width remaining after subtracting the width of the ellipsis from the width threshold; In the case where the first character string is located at the end of the target text, determining whether the target text is a file name including a file extension type; If not, retain the reserved characters that meet the target width starting from the last character of the first string, and delete the remaining characters; If yes, then starting from the character of the specified number of digits before the character representing the file extension type in the first character string, multiple characters are deleted in reverse order to obtain the reserved characters that meet the target width.

6. The text display device according to claim 1, characterized in that: Some characters in the first character string are deleted according to the width threshold and a preset ellipsis to obtain reserved characters, and the controller is further configured to: Determine a target width remaining after subtracting the ellipsis from the width threshold; In the case that the first character string is located at the head or the middle of the target text, the reserved characters that meet the target width are reserved starting from the first character of the first character string, and the remaining characters are deleted.

7. The text display device according to claim 1, characterized in that: The controller is further configured to display the second character string, the ellipsis and the reserved character. concatenating the ellipsis character and the reserved character into a third character string; According to the order of the first character string and the second character string in the target text, the second character string and the third character string are drawn and displayed line by line in the Textview control.

8. The text display device according to claim 1, characterized in that: Splitting characters in the target text into a plurality of character strings whose widths are not greater than a preset width threshold, the controller is further configured to: Determine that the drawable width of the Textview control is the width threshold; Traversing the characters in the target text in a preset order; Starting from the first character, when the character drawing width between the current character and the first character reaches the width threshold, intercept the character string between the first character and the current character; The next character of the current character is used as a new first character and the traversal is continued until all characters in the target text are traversed to obtain a plurality of the character strings.

9. The text display device according to claim 1, characterized in that: The controller is also configured to: Setting the font size of the target text; Detecting whether the width of the target text is greater than the width threshold; If yes, executing the step of splitting the characters in the target text into a plurality of character strings whose width is not greater than a preset width threshold; If not, the target text is drawn and displayed in the Textview control.

10. A text display method, characterized in that: Applied to a text display device, the method comprises: Get the target text to be displayed; Splitting characters in the target text into multiple character strings whose widths are not greater than a preset width threshold; If the number of the character strings is greater than the preset number of text display lines, determining a first character string to be omitted and a second character string to be retained from the plurality of character strings; Deleting some characters in the first character string according to the width threshold and a preset ellipsis symbol to obtain reserved characters; The second character string, the ellipsis, and the reserved characters are displayed.