A text display method and device, a terminal device, and a storage medium
Patent Information
- Application Number
- CN202310231618.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-10
- Publication Date
- 2026-10-30
- Estimated Expiration
- 2043-03-10
AI Technical Summary
[0003]但是,如果文档的标题过长,在页面中的展示效果通常是如图1所示,即文档的标题在终端设备中的展示宽度与文档的预览页面的宽度相同,展示效果较差
[0042]通过本公开的实施例,根据目标文本的文本宽度、终端设备的第一屏幕宽度、参考屏幕的第二屏幕宽度,确定目标文本在终端设备上的第一展示宽度,以根据第一展示宽度在终端设备上展示目标文本,可以使得目标文本在终端设备中的展示效果更加美观,而且,本实施例的文本展示方法可以适配不同终端设备的屏幕宽度和不同目标文本的文本宽度,适用范围更广。
Smart Images

Figure CN116304423B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of web page processing technology, and more specifically, to a text display method, a text display device, a terminal device, and a computer-readable storage medium. Background Technology
[0002] A document library typically refers to an online platform where users can share documents. As a core piece of information, the document title must be displayed prominently on the document preview page.
[0003] However, if the document title is too long, its display on the page is usually as follows: Figure 1 As shown, the document title is displayed with the same width as the document preview page on the terminal device, resulting in a poor display effect. Summary of the Invention
[0004] One objective of this disclosure is to provide a new technical solution for text display.
[0005] According to a first aspect of this disclosure, a text display method is provided, comprising:
[0006] Obtain the text width of the target text to be displayed, and the first screen width of the terminal device to display the target text;
[0007] The first display width of the target text on the terminal device is determined based on the second screen width of the preset reference screen, the text width, and the first screen width;
[0008] The target text is displayed on the terminal device according to the first display width.
[0009] Optionally, determining the first display width of the target text on the terminal device based on a preset second screen width of a reference screen, the text width, and the first screen width includes:
[0010] Based on the text width, determine the second display width of the target text on the reference screen;
[0011] The second display width is processed based on the first screen width and the second screen width to obtain the first display width.
[0012] Optionally, the step of processing the second display width based on the first screen width and the second screen width to obtain the first display width includes:
[0013] Based on the first screen width and the second screen width, the scaling factor of the terminal device relative to the reference screen is determined;
[0014] The first display width is obtained based on the second display width and the scaling factor.
[0015] Optionally, determining the second display width of the target text based on the text width includes:
[0016] Determine the preset width range to which the text width belongs, and use it as the target width range;
[0017] Determine the display width corresponding to the target width range, and use it as the second display width.
[0018] Optionally, determining the display width corresponding to the target width range as the second display width includes:
[0019] Obtain a table showing the correspondence between the preset reflection width range and the display width;
[0020] The reference table is consulted to determine the display width corresponding to the target width range, which is then used as the second display width.
[0021] Optionally, the text display method further includes:
[0022] The text width is compared with a preset first width threshold and a second width threshold; wherein the first width threshold is greater than the second width threshold;
[0023] If the text width is less than or equal to the first width threshold and greater than or equal to the second width threshold, the step of determining the first display width of the target text on the terminal device based on the preset second screen width, the text width, and the first screen width is executed.
[0024] Optionally, the text display method further includes:
[0025] If the text width is greater than the first width threshold, the target text is displayed on the terminal device according to the screen width.
[0026] Optionally, the text display method further includes:
[0027] If the text width is less than the second width threshold, the target text is displayed on the terminal device according to the text width.
[0028] Optionally, displaying the target text on the terminal device according to the first display width includes:
[0029] The target text is displayed centered on the terminal device according to the first display width.
[0030] Optionally, if the text width is greater than the first display width, displaying the target text on the terminal device according to the first display width includes:
[0031] The target text is wound according to the first display width;
[0032] The target text after line breaks is displayed on the terminal device.
[0033] Optionally, the target text is the document title.
[0034] According to a second aspect of this disclosure, a text display device is provided, comprising:
[0035] The width acquisition module is used to acquire the text width of the target text to be displayed and the first screen width of the terminal device to display the target text;
[0036] The width determination module is used to determine the first display width of the target text on the terminal device based on the second screen width of the preset reference screen, the text width, and the first screen width;
[0037] A text display module is used to display the target text on the terminal device according to the first display width.
[0038] According to a third aspect of this disclosure, a terminal device is provided, comprising:
[0039] The text display device according to the second aspect of this disclosure; or...
[0040] A processor and a memory, the memory being used to store instructions for controlling the processor to execute the text display method according to the first aspect of this disclosure.
[0041] According to a fourth aspect of this disclosure, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the text display method as described in the first aspect of this disclosure.
[0042] Through the embodiments of this disclosure, a first display width of the target text on the terminal device is determined based on the text width of the target text, the first screen width of the terminal device, and the second screen width of the reference screen. The target text is then displayed on the terminal device according to the first display width, which makes the display effect of the target text on the terminal device more aesthetically pleasing. Moreover, the text display method of this embodiment can adapt to the screen width of different terminal devices and the text width of different target texts, thus having a wider range of applications.
[0043] Other features and advantages of this disclosure will become clear from the following detailed description of exemplary embodiments with reference to the accompanying drawings. Attached Figure Description
[0044] The accompanying drawings, which are incorporated in and form a part of this specification, illustrate embodiments of the present disclosure and, together with their description, serve to explain the principles of the present disclosure.
[0045] Figure 1 This is a schematic diagram illustrating how document titles are displayed on terminal devices in existing technologies.
[0046] Figure 2 This is a block diagram illustrating an example of a hardware configuration for a terminal device that can be used to implement embodiments of the present disclosure.
[0047] Figure 3 A schematic diagram illustrating an example application scenario of the text display method according to an embodiment of the present disclosure is shown.
[0048] Figure 4 A flowchart illustrating a text display method according to an embodiment of the present disclosure is shown.
[0049] Figure 5 A flowchart illustrating an example of a text display method according to an embodiment of the present disclosure is shown.
[0050] Figure 6 A block diagram of a text display device according to an embodiment of the present disclosure is shown.
[0051] Figure 7 A block diagram illustrating an example of a terminal device according to an embodiment of the present disclosure is shown. Detailed Implementation
[0052] Various exemplary embodiments of the present disclosure will now be described in detail with reference to the accompanying drawings. It should be noted that, unless otherwise specifically stated, the relative arrangement, numerical expressions, and values of the components and steps set forth in these embodiments do not limit the scope of the present disclosure.
[0053] The following description of at least one exemplary embodiment is merely illustrative and is in no way intended to limit this disclosure or its application or use.
[0054] Techniques, methods, and equipment known to those skilled in the art may not be discussed in detail, but where appropriate, such techniques, methods, and equipment should be considered part of the specification.
[0055] In all the examples shown and discussed herein, any specific values should be interpreted as merely exemplary and not as limitations. Therefore, other examples of exemplary embodiments may have different values.
[0056] It should be noted that similar labels and letters in the following figures indicate similar items; therefore, once an item is defined in one figure, it does not need to be discussed further in subsequent figures.
[0057] <Hardware Configuration>
[0058] Figure 2 This is a block diagram illustrating the hardware configuration of a terminal device 1000 that can implement embodiments of the present disclosure.
[0059] Terminal device 1000 can be a laptop, desktop computer, mobile phone, tablet computer, speaker, headphones, etc. Figure 2 As shown, the terminal device 1000 may include a processor 1100, a memory 1200, an interface device 1300, a communication device 1400, a display device 1500, an input device 1600, a speaker 1700, a microphone 1800, etc. The processor 1100 may be a central processing unit (CPU), a microprocessor (MCU), etc. The memory 1200 may include, for example, ROM (Read-Only Memory), RAM (Random Access Memory), or non-volatile memory such as a hard disk. The interface device 1300 may include, for example, a USB interface, a headphone jack, etc. The communication device 1400 may be capable of wired or wireless communication, specifically including Wi-Fi communication, Bluetooth communication, 2G / 3G / 4G / 5G communication, etc. The display device 1500 may be, for example, an LCD screen, a touch screen, etc. The input device 1600 may include, for example, a touch screen, a keyboard, motion input, etc. Users can input / output voice information through the speaker 1700 and the microphone 1800.
[0060] Figure 2 The terminal devices shown are merely illustrative and in no way intended to limit this disclosure, its application, or use. In embodiments applied to this disclosure, the memory 1200 of the terminal device 1000 is used to store instructions for controlling the processor 1100 to operate and execute any of the text display methods provided in the embodiments of this disclosure. Those skilled in the art will understand that, although... Figure 2The present disclosure illustrates multiple devices for terminal device 1000; however, this disclosure may relate only to a portion of these devices. For example, terminal device 1000 may only relate to processor 1100 and storage device 1200. Those skilled in the art can design instructions based on the schemes disclosed herein. How the instructions control the processor to operate is well known in the art and will not be described in detail here.
[0061] <Application Scenarios>
[0062] Figure 3 This is a schematic diagram illustrating an application scenario of the text display method according to an embodiment of the present disclosure.
[0063] The text display method in this embodiment can be specifically applied to document display scenarios.
[0064] like Figure 3 As shown, the terminal device can display a document list, from which users can select the document they wish to view and perform a viewing operation. In response to the user's action of viewing the selected document, the terminal device obtains the target text of the selected document, i.e., the document title; obtains the text width of the document title and the first screen width of the terminal device; determines the scaling factor of the terminal device relative to the reference screen based on the second screen width of a preset reference plane and the first screen width d2 of the terminal device; obtains the first display width d1 of the document title on the terminal device based on the text width and the scaling factor; opens the details page of the document selected by the user, and displays the document title on the details page according to the first display width.
[0065] Furthermore, such as Figure 3 As shown, the target text is displayed in the center on the terminal device according to the first display width.
[0066] Furthermore, such as Figure 3 As shown, when the text width is greater than the first display width, the target text is displayed in the terminal device with line breaks based on the first display width.
[0067] The text display method of this embodiment determines the first display width of the document title on the terminal device based on the text width of the document title, the first screen width of the terminal device, and the second screen width of the reference screen. Displaying the document title on the terminal device according to the first display width makes the display effect of the document title on the terminal device more aesthetically pleasing.
[0068] <Method Implementation>
[0069] In this embodiment, a text display method is provided. This text display method can be implemented by a terminal device. The terminal device can be, for example,... Figure 4 The terminal device shown is 1000.
[0070] according to Figure 4 As shown, the text display method of this embodiment may include the following steps S1000 to S3000:
[0071] Step S1000: Obtain the text width of the target text to be displayed and the first screen width of the terminal device to display the target text.
[0072] In this embodiment, the text width of the target text can be the number of pixels occupied by all the characters in the target text. When the display format of the text in the target text is fixed, the text width of the target text can be determined by the number of characters in the target text. The display format can include font, font size, character spacing, etc.
[0073] The terminal device to display the target text can be an electronic device that has opened the target page, where the target page is a page containing the target text.
[0074] The first screen width can be the width of the terminal device's screen. Furthermore, the first planar width can be the width of the display area of the target page on the terminal device.
[0075] In one example, the target page is the document's details page, and the target text can be the document's title.
[0076] Step S2000: Determine the first display width of the target text on the terminal device based on the preset second screen width, text width and first screen width of the reference screen.
[0077] In this embodiment, the second screen width of the reference screen is the width of the area in the document where the target text is located, and it can be set in advance according to the application scenario or specific needs.
[0078] For example, the width of the second screen could be 375px (375 pixels).
[0079] The first display width obtained according to this embodiment is smaller than the first screen width.
[0080] In one embodiment of this disclosure, determining the first display width of the target text on the terminal device based on a preset second screen width, text width, and first screen width may include the following steps S2100 to S2200:
[0081] Step S2100: Determine the second display width of the target text on the reference screen based on the text width.
[0082] In one embodiment of this disclosure, determining the second display width of the target text based on the text width includes the following steps S2110 to S2120:
[0083] Step S2110: Determine the preset width range to which the text width belongs, as the target width range.
[0084] In this embodiment, multiple width ranges can be pre-defined according to the application scenario or specific requirements. For example, multiple width ranges can be [1px, 334px], [335px, 415px], [416px, 522px], [523px, 670px], [671px, ∝).
[0085] The width range to which the text width belongs is the width range that includes the text width. For example, if the text width is 55px, the target width range to which the text width belongs is [1px, 334px]; if the text width is 366px, the target width range to which the text width belongs is [335px, 415px]; if the text width is 444px, the target width range to which the text width belongs is [416px, 522px]; and if the text width is 555px, the target width range to which the text width belongs is [523px, 670px].
[0086] Step S2120: Determine the display width corresponding to the target width range, and use it as the second display width.
[0087] In one embodiment of this disclosure, determining the display width corresponding to the target width range as the second display width includes: obtaining a preset lookup table reflecting the correspondence between the width range and the display width; searching the lookup table to determine the display width corresponding to the target width range as the second display width.
[0088] In this embodiment, a lookup table can be pre-defined to correspond one-to-one with each width range. The lookup table is then consulted based on the target width range to obtain the corresponding display width, which is then used as the second display width.
[0089] In another embodiment of this disclosure, determining the second display width of the target text based on the text width of the target text may further include: obtaining preset mapping data that reflects the mapping relationship between the text width of the text and the second display width of the text on the reference screen; substituting the text width of the target text into the mapping data, the second display width of the target text on the reference screen can be obtained.
[0090] The mapping data can be a lookup table or a mapping function; there is no limitation on this.
[0091] Step S2200: Based on the first screen width and the second screen width, process the second display width to obtain the first display width.
[0092] In one embodiment of this disclosure, the second display width is processed based on the first screen width and the second screen width to obtain the first display width, including the following steps S2210 to S2220:
[0093] Step S2210: Determine the scaling factor of the terminal device relative to the reference screen based on the first screen width and the second screen width.
[0094] Specifically, the scaling factor can be the ratio between the width of the first screen and the width of the second screen, or it can be the ratio between the width of the second screen and the width of the first screen.
[0095] Step S2220: Obtain the first display width based on the second display width and the scaling factor.
[0096] In an embodiment where the scaling factor is the ratio between the first screen width and the second screen width, the first display width is obtained based on the second display width and the scaling factor. This can be achieved by determining the product of the second display width and the scaling factor as the first display width.
[0097] In an embodiment where the scaling factor is the ratio between the second screen width and the first screen width, the first display width is obtained based on the second display width and the scaling factor. This can be achieved by determining the quotient of the second display width divided by the scaling factor, which is then used as the second display width.
[0098] In another embodiment of this disclosure, determining the first display width of the target text on the terminal device based on the second screen width, text width, and first screen width of a preset reference screen may further include: determining the ratio of the first screen width to the second screen width; and determining the product of the first screen width and the text width as the first display width of the target text on the terminal device.
[0099] In one embodiment of this disclosure, the text display method may further include: comparing the text width of the target text with a preset first width threshold and a second width threshold; wherein the first width threshold is greater than the second width threshold; and when the text width of the target text is less than or equal to the first width threshold and greater than or equal to the second width threshold, performing step S2000 to determine the first display width of the target text on the terminal device based on the preset second screen width, text width and first screen width.
[0100] In this embodiment, the first width threshold and the second width threshold can be preset according to the application scenario or specific requirements. For example, the first width threshold can be 670px, and the second width threshold can be 335px.
[0101] Furthermore, the text display method also includes: if the text width of the target text is greater than a first width threshold, displaying the target text on the terminal device according to the screen width.
[0102] If the width of the target text is less than the second width threshold, the target text is relatively short and already looks good when displayed on the terminal device, so no further enhancement is needed.
[0103] Furthermore, the text display method also includes: displaying the target text on the terminal device according to the text width when the text width of the target text is less than a second width threshold.
[0104] If the width of the target text exceeds the first width threshold, the target text becomes extremely long. In this case, even if further enhancements are made, it will still look unattractive, so no special enhancements are performed.
[0105] Step S3000: Display the target text on the terminal device according to the first display width.
[0106] The target text is displayed on the terminal device according to the first display width, that is, the target text is displayed in an area on the terminal device with a width of the first display width.
[0107] The text display method of this embodiment determines the first display width of the target text on the terminal device based on the text width of the target text, the first screen width of the terminal device, and the second screen width of the reference screen. The target text is then displayed on the terminal device according to the first display width, which makes the display effect of the target text on the terminal device more aesthetically pleasing. Moreover, the text display method of this embodiment can adapt to the screen width of different terminal devices and the text width of different target texts, thus having a wider range of applications.
[0108] In one embodiment of this disclosure, displaying target text on a terminal device according to a first display width includes: centering the target text on the terminal device according to the first display width.
[0109] In this embodiment, the target text is displayed in the center on the terminal device according to the first display width, which means that the target text is displayed in the center on the terminal device, and the display width of the target text on the terminal device is the first display width.
[0110] According to the text display method of this embodiment, the target text is displayed in the center of the terminal device according to the first display width, which can improve the display effect of the target text in the terminal device.
[0111] When the text width is greater than the first display width, the target text is displayed on the terminal device according to the first display width, including: performing line wrapping on the target text according to the first display width; and displaying the line-wrapped target text on the terminal device.
[0112] In this embodiment, if the remainder when the text width is divided by the first display width is zero, the number of lines of the target text in the terminal device can be the quotient of the text width divided by the first display width; if the remainder when the text width is divided by the first display width is not zero, the number of lines of the target text in the terminal device can be the quotient of the text width divided by the first display width plus one.
[0113] For example, with a text width of 500px and an initial display width of 250px, the target text will have 2 lines on the terminal device. With a text width of 500px and an initial display width of 240px, the target text will have 3 lines on the terminal device.
[0114] According to the text display method of this embodiment, the target text is displayed by wrapping lines in the terminal device according to the first display width, which can improve the display effect of the target text in the terminal device.
[0115] <Example>
[0116] Figure 5 This is a flowchart illustrating a text display method as an example of this disclosure.
[0117] like Figure 5 As shown, the text display method may include, for example: Figure 5 Steps S5001 to S5006 are shown below:
[0118] Step S5001: Obtain the text width of the target text to be displayed, the first screen width of the terminal device to display the target text, and the second screen width of the preset reference screen.
[0119] Step S5002: Determine the preset width range to which the text width of the target text belongs, and use it as the target width range.
[0120] Step S5003: Based on the target width range, look up a lookup table that reflects the correspondence between the width range and the display width to obtain the corresponding display width, which is used as the second display width of the target text on the reference screen.
[0121] Step S5004: Determine the scaling factor of the terminal device relative to the reference screen based on the first screen width and the second screen width.
[0122] Step S5005: Based on the second display width and scaling factor, obtain the first display width of the target text on the terminal device.
[0123] Step S5006: Display the target text on the terminal device according to the first display width.
[0124] <Device Embodiment>
[0125] In this embodiment, a text display device 6000 is provided, such as... Figure 6 As shown, it includes a width acquisition module 6100, a width determination module 6200, and a text display module 6300.
[0126] The width acquisition module 6100 is used to acquire the text width of the target text to be displayed and the first screen width of the terminal device to display the target text.
[0127] The width determination module 6200 is used to determine the first display width of the target text on the terminal device based on the second screen width of the preset reference screen, the text width, and the first screen width.
[0128] The text display module 6300 is used to display the target text on the terminal device according to the first display width.
[0129] In one embodiment of this disclosure, determining the first display width of the target text on the terminal device based on a preset second screen width of a reference screen, the text width, and the first screen width includes:
[0130] Based on the text width, determine the second display width of the target text on the reference screen;
[0131] The second display width is processed based on the first screen width and the second screen width to obtain the first display width.
[0132] In one embodiment of this disclosure, the step of processing the second display width based on the first screen width and the second screen width to obtain the first display width includes:
[0133] Based on the first screen width and the second screen width, determine the scaling factor of the terminal device relative to the reference screen;
[0134] The first display width is obtained based on the second display width and the scaling factor.
[0135] In one embodiment of this disclosure, determining the second display width of the target text based on the text width includes:
[0136] Determine the preset width range to which the text width belongs, and use it as the target width range;
[0137] Determine the display width corresponding to the target width range, and use it as the second display width.
[0138] In one embodiment of this disclosure, determining the display width corresponding to the target width range as the second display width includes:
[0139] Obtain a table showing the correspondence between the preset reflection width range and the display width;
[0140] The reference table is consulted to determine the display width corresponding to the target width range, which is then used as the second display width.
[0141] In one embodiment of this disclosure, the text display device 6000 further includes:
[0142] A module for comparing the text width with a preset first width threshold and a second width threshold; wherein the first width threshold is greater than the second width threshold;
[0143] The text display module 6300 is specifically used to perform the step of determining the first display width of the target text on the terminal device based on the preset second screen width, the text width, and the first screen width when the text width is less than or equal to the first width threshold and greater than or equal to the second width threshold.
[0144] In one embodiment of this disclosure, the text display device 6000 further includes:
[0145] A module for displaying the target text on the terminal device according to the screen width when the text width is greater than the first width threshold.
[0146] In one embodiment of this disclosure, the text display device 6000 further includes:
[0147] A module for displaying the target text on the terminal device according to the text width when the text width is less than the second width threshold.
[0148] In one embodiment of this disclosure, displaying the target text on the terminal device according to the first display width includes:
[0149] The target text is displayed centered on the terminal device according to the first display width.
[0150] In one embodiment of this disclosure, when the text width is greater than the first display width, displaying the target text on the terminal device according to the first display width includes:
[0151] The target text is wound according to the first display width;
[0152] The target text after line breaks is displayed on the terminal device.
[0153] In one embodiment of this disclosure, the target text is a document title.
[0154] Those skilled in the art will understand that the text display device 6000 can be implemented in various ways. For example, the text display device 6000 can be implemented by configuring a processor with instructions. For example, instructions can be stored in ROM, and when the device is started, the instructions can be read from ROM into a programmable device to implement the text display device 6000. For example, the text display device 6000 can be embedded in a special-purpose device (e.g., an ASIC). The text display device 6000 can be divided into independent units, or they can be combined together. The text display device 6000 can be implemented by one of the various implementation methods described above, or by a combination of two or more of the various implementation methods described above.
[0155] In this embodiment, the text display device 6000 can have various implementation forms. For example, the text display device 6000 can be a functional module running in any software product or application that provides text display services, or a peripheral embedding, plug-in, patch, etc. of such software products or applications, or it can be the software products or applications themselves.
[0156] Terminal Equipment
[0157] In this embodiment, a terminal device 7000 is also provided. The terminal device 7000 may be... Figure 2 The terminal device shown is 1000.
[0158] In one aspect, the terminal device 7000 may include the aforementioned text display device 6000, used to implement the text display method of any embodiment of the present disclosure.
[0159] On the other hand, such as Figure 7 As shown, the terminal device 7000 may further include a processor 7100 and a memory 7200, the memory 7200 being used to store executable instructions; the processor 7100 being used to control the terminal device 7000 to execute the text display method according to any embodiment of this disclosure, as controlled by the instructions.
[0160] In this embodiment, the terminal device 7000 can be a mobile phone, tablet computer, PDA, desktop computer, laptop computer, or other similar device. For example, the terminal device 7000 can be an electronic product with text display functionality.
[0161] Computer-readable storage media
[0162] In this embodiment, a computer-readable storage medium is also provided, on which a computer program is stored, which, when executed by a processor, implements the text display method as described in any embodiment of this disclosure.
[0163] This disclosure can be a system, method, and / or computer program product. A computer program product may include a computer-readable storage medium having computer-readable program instructions loaded thereon for causing a processor to implement various aspects of this disclosure.
[0164] Computer-readable storage media can be tangible devices capable of holding and storing instructions for use by an instruction execution device. Computer-readable storage media can be, for example—but not limited to—electrical storage devices, magnetic storage devices, optical storage devices, electromagnetic storage devices, semiconductor storage devices, or any suitable combination of the foregoing. More specific examples (a non-exhaustive list) of computer-readable storage media include: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), static random access memory (SRAM), portable compact disc read-only memory (CD-ROM), digital multifunction disc (DVD), memory sticks, floppy disks, mechanical encoding devices, such as punch cards or recessed protrusions storing instructions thereon, and any suitable combination of the foregoing. The computer-readable storage media used herein are not to be construed as transient signals themselves, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through waveguides or other transmission media (e.g., light pulses through fiber optic cables), or electrical signals transmitted through wires.
[0165] The computer-readable program instructions described herein can be downloaded from computer-readable storage media to various computing / processing devices, or downloaded via a network, such as the Internet, local area network, wide area network, and / or wireless network, to an external computer or external storage device. The network may include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers, and / or edge servers. A network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards them to the computer-readable storage media in the respective computing / processing device.
[0166] Computer program instructions used to perform the operations of this disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, status setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages such as Smalltalk, C++, etc., and conventional procedural programming languages such as the "C" language or similar programming languages. The computer-readable program instructions may execute entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or may be connected to an external computer (e.g., via the Internet using an Internet service provider). In some embodiments, electronic circuitry, such as programmable logic circuitry, field-programmable gate arrays (FPGAs), or programmable logic arrays (PLAs), is personalized by utilizing the status information of the computer-readable program instructions to implement various aspects of this disclosure.
[0167] Various aspects of this disclosure are described herein with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this disclosure. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer-readable program instructions.
[0168] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that, when executed by the processor of the computer or other programmable data processing apparatus, they create means for implementing the functions / actions specified in one or more blocks of the flowchart and / or block diagram. These computer-readable program instructions can also be stored in a computer-readable storage medium that causes a computer, programmable data processing apparatus, and / or other device to operate in a particular manner; thus, the computer-readable medium storing the instructions comprises an article of manufacture that includes instructions for implementing aspects of the functions / actions specified in one or more blocks of the flowchart and / or block diagram.
[0169] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to perform the functions / actions specified in one or more boxes of a flowchart and / or block diagram.
[0170] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of an instruction containing one or more executable instructions for implementing a specified logical function. In some alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions. It will be known to those skilled in the art that implementation in hardware, implementation in software, and implementation in a combination of software and hardware are equivalent.
[0171] The various embodiments of this disclosure have been described above. These descriptions are exemplary and not exhaustive, and are not limited to the disclosed embodiments. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is chosen to best explain the principles, practical application, or technical improvements to the embodiments in the market, or to enable others skilled in the art to understand the embodiments disclosed herein. The scope of this disclosure is defined by the appended claims.
Claims
1. A text display method, comprising: Obtain the text width of the target text to be displayed, and the first screen width of the terminal device to display the target text; The first screen width is the width of the screen of the terminal device, or the width of the display area of the target page of the document containing the target text in the terminal device; The first display width of the target text on the terminal device is determined based on the second screen width of the preset reference screen, the text width, and the first screen width; The second screen width is the width of the area in the document containing the target text; The target text is displayed on the terminal device according to the first display width; Determining the first display width of the target text on the terminal device based on the second screen width of a preset reference screen, the text width, and the first screen width includes: Determine the preset width range to which the text width belongs, and use it as the target width range; Determine the display width corresponding to the target width range, and use it as the second display width of the target text on the reference screen; The second display width is processed based on the first screen width and the second screen width to obtain the first display width.
2. The text display method according to claim 1, wherein processing the second display width based on the first screen width and the second screen width to obtain the first display width includes: Based on the first screen width and the second screen width, the scaling factor of the terminal device relative to the reference screen is determined; The first display width is obtained based on the second display width and the scaling factor.
3. The text display method according to claim 1, wherein determining the display width corresponding to the target width range as the second display width includes: Obtain a table showing the correspondence between the preset reflection width range and the display width; The reference table is consulted to determine the display width corresponding to the target width range, which is then used as the second display width.
4. The text display method according to claim 1, further comprising: The text width is compared with a preset first width threshold and a second width threshold; wherein the first width threshold is greater than the second width threshold; If the text width is less than or equal to the first width threshold and greater than or equal to the second width threshold, the step of determining the first display width of the target text on the terminal device based on the preset second screen width, the text width, and the first screen width is executed.
5. The text display method according to claim 4, further comprising: If the text width is greater than the first width threshold, the target text is displayed on the terminal device according to the screen width.
6. The text display method according to claim 4, further comprising: If the text width is less than the second width threshold, the target text is displayed on the terminal device according to the text width.
7. The text display method according to claim 1, wherein displaying the target text on the terminal device according to the first display width includes: The target text is displayed centered on the terminal device according to the first display width.
8. The text display method according to any one of claims 1 to 7, wherein when the text width is greater than the first display width, the step of displaying the target text on the terminal device according to the first display width comprises: The target text is wound according to the first display width; The target text after line breaks is displayed on the terminal device.
9. The text display method according to any one of claims 1 to 7, wherein the target text is a document title.
10. A text display device, comprising: The width acquisition module is used to acquire the text width of the target text to be displayed and the first screen width of the terminal device to display the target text; The first screen width is the width of the screen of the terminal device, or the width of the display area of the target page of the document containing the target text in the terminal device; The width determination module is used to determine the first display width of the target text on the terminal device based on the second screen width of a preset reference screen, the text width, and the first screen width; the second screen width is the width of the area of the document in which the target text is located; A text display module is used to display the target text on the terminal device according to the first display width; Determining the first display width of the target text on the terminal device based on the second screen width of a preset reference screen, the text width, and the first screen width includes: Determine the preset width range to which the text width belongs, and use it as the target width range; Determine the display width corresponding to the target width range, and use it as the second display width of the target text on the reference screen; The second display width is processed based on the first screen width and the second screen width to obtain the first display width.
11. A terminal device, wherein, include: The text display device according to claim 10; or, A processor and a memory, the memory being used to store instructions for controlling the processor to execute the text display method according to any one of claims 1 to 9.
12. A computer-readable storage medium having a computer program stored thereon, the computer program implementing the text display method as described in any one of claims 1 to 9 when executed by a processor.
Citation Information
Patent Citations
Webpage reset method, webpage reset device and mobile terminal
CN104536949A
Picture display method and device and electronic equipment
CN110852946A