Text display processing method, device, computer and readable storage medium

By establishing the mapping relationship between text characters and cached fonts and optimizing font matching, the problem of long time obtaining text characters fonts in the prior art is solved, and the efficiency and fluency of text display are improved.

CN113946650BActive Publication Date: 2025-08-19TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202010691183.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-07-17
Publication Date
2025-08-19
Estimated Expiration
2040-07-17

AI Technical Summary

Technical Problem

When displaying a large amount of text data, it takes a long time to obtain the font corresponding to the text characters, resulting in low efficiency in displaying text data, and the problem of blank pages or inability to respond in time.

Method used

By establishing a font cache library, record the mapping relationship between text characters and cached fonts, first look for the font of the target text characters in the cache library. If it is not found, the supported default fonts are obtained from the default font library, and the font matching process is optimized using font priority and mapping relationship.

Benefits of technology

It reduces the time to obtain text character fonts, improves the efficiency and fluency of text display processing, and ensures timely display of text data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113946650B_ABST
    Figure CN113946650B_ABST
Patent Text Reader

Abstract

The embodiment of the present application discloses a text display processing method, device, computer and readable storage medium, the method comprising: obtaining long text data to be displayed, obtaining target text characters from the long text data, and obtaining a font cache library; the font cache library includes a mapping relationship between cache fonts and text characters; traversing the font cache library according to the target text characters and the mapping relationship; if the target cache font corresponding to the target text character is traversed in the font cache library, the target cache font is used as the target display font of the target text character; if the target cache font corresponding to the target text character is not traversed in the font cache library, the target default font corresponding to the target text character is obtained from the default font library, and the target default font is used as the target display font of the target text character. By adopting the present application, the time spent on obtaining the font corresponding to the text character can be reduced, and the text display efficiency can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] With the development of the internet, more and more users are communicating online, and a growing amount of data is available online, including text data, voice data, and video data. When typeset and displaying text data, an application system typically first sets text character attributes such as color, background color, and bold, then sets the font for each character to be displayed. Then, based on the set text character attributes and font, each character in the text data is rendered sequentially, in the order of lines and writing directions. In other words, the text data typeset and display process can be divided into three steps: setting text character attributes, setting the font for each character, and rendering the text data. Each time an application renders text data, the application system must execute the first and second steps, and any application in the application system may trigger the third step multiple times during use. Because obtaining the font corresponding to a text character takes a long time, the time spent displaying text data increases as the number of fonts in the application system increases. Therefore, if the text data to be displayed includes a large number of characters, a blank page may appear or the text data may not be displayed, resulting in poor text data display. Summary of the Invention

[0003] The embodiments of the present application provide a text display processing method, device, computer and readable storage medium, which can reduce the time spent on obtaining the font corresponding to the text characters, thereby improving the efficiency of text display processing and the smoothness of text data display.

[0004] On the one hand, an embodiment of the present application provides a text display processing method, the method comprising:

[0005] Obtaining long text data to be displayed, obtaining target text characters from the long text data, and obtaining a font cache library; the font cache library includes a mapping relationship between cached fonts and text characters, the mapping relationship being established through a relationship between text characters in historical long text data and cached fonts, the cached font being a display font used when displaying the text characters;

[0006] Traverse the font cache library according to the target text characters and mapping relationships;

[0007] If the target cache font corresponding to the target text character is found in the font cache library, the target cache font is used as the target display font for rendering the target text character;

[0008] If the target cache font corresponding to the target text character is not traversed in the font cache library, the default font library is obtained, and the font support relationship between the default font in the default font library and the target text character is detected. According to the font support relationship, the target default font corresponding to the target text character is obtained in the default font library, and the target default font is used as the target display font for rendering the target text character; the font support relationship includes a support display relationship and a matching failure relationship. The support display relationship is used to represent that the default font supports the display of the target text character, and the matching failure relationship is used to represent that the default font does not support the display of the target text character.

[0009] The default font library includes a first default font library; the first default font library is a font library that has an initial association relationship with the application system;

[0010] Detecting the font support relationship between the default font in the default font library and the target text characters, and obtaining the target default font corresponding to the target text characters in the default font library according to the font support relationship, including:

[0011] Obtain at least two first default fonts in the first default font library, and obtain the font priority of each first default font;

[0012] Based on the font priority, the font support relationship between the target text character and at least two first default fonts is detected in sequence, and the first default font whose font support relationship with the target text character is a support display relationship is determined as the target default font corresponding to the target text character.

[0013] Obtaining the font priority of each first default font includes:

[0014] Get the character type of the target text character and the priority set corresponding to the character type;

[0015] A font priority for each first default font is determined according to the priority set.

[0016] Obtaining the font priority of each first default font includes:

[0017] The number of text characters supported by each first default font is obtained, at least two first default fonts are sorted based on the number of text characters supported by each first default font, and the font priority of each first default font is determined according to the sorting result.

[0018] The method of sequentially detecting font support relationships between target text characters and at least two first default fonts based on font priorities includes:

[0019] Get the font matching component, and based on the font priority, combine the target text character with the i-th first default font in at least two first default fonts to form a to-be-matched element pair A. i ; i is a positive integer, i is less than or equal to the number of at least two first default fonts;

[0020] The element to be matched is A i Input font matching component, get font matching component for the element to be matched A i The matching results;

[0021] If the matching result is a successful matching result, the display support relationship is determined as the font support relationship between the target text character and the i-th first default font;

[0022] If the matching result is a matching failure result, the matching failure relationship is determined as the font support relationship between the target text character and the i-th first default font.

[0023] The default font library includes a second default font library and a third default font library; the second default font library includes all fonts in the application system; the third default font library includes a character mapping table; the character mapping table includes a mapping relationship between character types and the third default font;

[0024] Detecting the font support relationship between the default font in the default font library and the target text characters, and obtaining the target default font corresponding to the target text characters in the default font library according to the font support relationship, including:

[0025] Get the character type of the target text character;

[0026] If the character type to which the target text character belongs belongs to the first character type, obtaining a second default font library, and based on the font arrangement order in the second default font library, sequentially detecting the font support relationship between the target text character and a second default font in the second default font library, determining the second default font whose font support relationship with the target text character is a supported display relationship as the target default font corresponding to the target text character;

[0027] If the character type to which the target text character belongs belongs to the second character type, then obtain the character mapping table in the third default font library. If there is a mapping relationship associated with the character type to which the target text character belongs in the character mapping table, then the third default font that has a mapping relationship with the character type to which the target text character belongs is used as the target default font corresponding to the target text character; the second character type is the character type among all character types except the first character type.

[0028] The method further includes:

[0029] If there is no mapping relationship associated with the character type to which the target text character belongs in the character mapping table, a second default font library is obtained, and based on the font arrangement order in the second default font library, the font support relationship between the target text character and the second default font in the second default font library is detected in turn, and the second default font whose font support relationship with the target text character is a supporting display relationship is determined as the target default font corresponding to the target text character.

[0030] The method further includes:

[0031] Obtaining a historical display frequency of the character type, and if the historical display frequency is greater than a display frequency threshold, determining the character type as the first character type;

[0032] If the historical display frequency is less than or equal to the display frequency threshold, the character type is determined to be the second character type.

[0033] The method further includes:

[0034] At least two second default fonts included in the second default font library are obtained, a historical usage count of each second default font is obtained, the at least two second default fonts are sorted based on the historical usage count, and a font arrangement order in the second default font library is determined.

[0035] The method further includes:

[0036] A target mapping relationship between a target default font and target text characters is established, and the target mapping relationship is added to a font cache library.

[0037] The method further includes:

[0038] Acquire historical long text data, traverse the historical long text data, and acquire text characters included in the historical long text data and display fonts used to display the text characters;

[0039] The usage frequency of display fonts is counted, the display font with the highest usage frequency is used as the cache font of text characters, a mapping relationship between text characters and cache fonts is established, and the mapping relationship is stored in the font cache library.

[0040] The process of obtaining the long text data to be displayed and obtaining the target text characters from the long text data includes:

[0041] Obtain the long text data to be displayed, and obtain the size information of the display area and the text display format; the size information includes the display width and display height of the display area, and the text display format includes the display line spacing, the first character display format of the paragraph, and the display margin;

[0042] Determine the number of display lines in the display area based on the display height, display margins, and display line spacing;

[0043] Determine the number of characters displayed in each line of the display area according to the display width, display margin and the display format of the first character of the paragraph;

[0044] Based on the number of display lines and the number of characters displayed in each line, the text to be displayed is obtained from the long text data, and the text characters in the text to be displayed are sequentially used as target text characters.

[0045] The method further includes:

[0046] The first character display position is obtained in the display area, and the target text character is rendered in the display area according to the first character display position and the target display font; the first character display position is determined based on the size information, the display margin and the first character display format of the paragraph.

[0047] Rendering the target text characters in the display area according to the first character display position and the target display font includes:

[0048] Obtaining the text position of the target text character in the text to be displayed, and determining the target character display position of the target text character in the display area according to the first character display position and the text position;

[0049] At the target character display position, the target text character is rendered based on the target display font.

[0050] In one aspect, an embodiment of the present application provides a text display processing device, the device comprising:

[0051] An element acquisition module is used to obtain long text data to be displayed, obtain target text characters from the long text data, and obtain a font cache library; the font cache library includes a mapping relationship between cached fonts and text characters, and the mapping relationship is created by the relationship between text characters in the historical long text data and cached fonts. The cached font refers to the display font used when displaying text characters;

[0052] The font traversal module is used to traverse the font cache library according to the target text characters and mapping relationships;

[0053] a font determination module configured to use the target cache font as a target display font for rendering the target text character if a target cache font corresponding to the target text character is found in the font cache library;

[0054] A font matching module is used to obtain a default font library if the target cache font corresponding to the target text character is not traversed in the font cache library, detect the font support relationship between the default font in the default font library and the target text character, obtain the target default font corresponding to the target text character in the default font library according to the font support relationship, and use the target default font as the target display font for rendering the target text character; the font support relationship includes a support display relationship and a matching failure relationship, the support display relationship is used to indicate that the default font supports the target text character for display, and the matching failure relationship is used to indicate that the default font does not support the target text character for display.

[0055] The default font library includes a first default font library; the first default font library is a font library that has an initial association relationship with the application system;

[0056] In terms of detecting the font support relationship between the default font in the default font library and the target text characters, and obtaining the target default font corresponding to the target text characters in the default font library according to the font support relationship, the font matching module includes:

[0057] a priority determination unit, configured to obtain at least two first default fonts in a first default font library, and obtain a font priority of each first default font;

[0058] The matching detection unit is used to detect the font support relationship between the target text character and at least two first default fonts in sequence based on the font priority, and determine the first default font whose font support relationship with the target text character is a support display relationship as the target default font corresponding to the target text character.

[0059] In terms of obtaining the font priority of each first default font, the priority determination unit includes:

[0060] The set acquisition subunit is used to obtain the character type to which the target text character belongs and obtain the priority set corresponding to the character type;

[0061] The priority determination subunit is configured to determine the font priority of each first default font according to the priority set.

[0062] In terms of obtaining the font priority of each first default font, the priority determination unit includes:

[0063] The font sorting subunit is used to obtain the number of text characters supported by each first default font, sort at least two first default fonts based on the number of text characters supported by each first default font, and determine the font priority of each first default font according to the sorting result.

[0064] In terms of sequentially detecting font support relationships between target text characters and at least two first default fonts based on font priorities, the matching detection unit includes:

[0065] The component acquisition subunit is used to acquire the font matching component, and based on the font priority, the target text character and the i-th first default font in at least two first default fonts form a to-be-matched element pair A. i ; i is a positive integer, i is less than or equal to the number of at least two first default fonts;

[0066] The component processing subunit is used to match the element to be matched to A i Input font matching component, get font matching component for the element to be matched A i The matching results;

[0067] a result acquisition subunit, configured to determine the display support relationship as a font support relationship between the target text character and the i-th first default font if the matching result is a successful matching result;

[0068] The result acquisition subunit is further configured to determine the matching failure relationship as a font support relationship between the target text character and the i-th first default font if the matching result is a matching failure result.

[0069] The default font library includes a second default font library and a third default font library; the second default font library includes all fonts in the application system; the third default font library includes a character mapping table; the character mapping table includes a mapping relationship between character types and the third default font;

[0070] In terms of detecting the font support relationship between the default font in the default font library and the target text characters, and obtaining the target default font corresponding to the target text characters in the default font library according to the font support relationship, the font matching module includes:

[0071] A type acquisition unit, used to acquire the character type to which the target text character belongs;

[0072] a first detection unit configured to, if the character type to which the target text character belongs is the first character type, obtain a second default font library, sequentially detect font support relationships between the target text character and second default fonts in the second default font library based on an arrangement order of fonts in the second default font library, and determine the second default font, whose font support relationship with the target text character is a display-supporting relationship, as the target default font corresponding to the target text character;

[0073] The second detection unit is used to obtain a character mapping table in a third default font library if the character type to which the target text character belongs belongs to a second character type; if there is a mapping relationship associated with the character type to which the target text character belongs in the character mapping table, the third default font that has a mapping relationship with the character type to which the target text character belongs is used as the target default font corresponding to the target text character; the second character type is the character type among all character types except the first character type.

[0074] The font matching module further includes:

[0075] The third detection unit is used to obtain a second default font library if there is no mapping relationship associated with the character type to which the target text character belongs in the character mapping table, and based on the font arrangement order in the second default font library, sequentially detect the font support relationship between the target text character and the second default font in the second default font library, and determine the second default font whose font support relationship with the target text character is a support display relationship as the target default font corresponding to the target text character.

[0076] The device further comprises:

[0077] a frequency comparison module, configured to obtain a historical display frequency of a character type, and determine the character type as a first character type if the historical display frequency is greater than a display frequency threshold;

[0078] The frequency comparison module is further configured to determine the character type as the second character type if the historical display frequency is less than or equal to the display frequency threshold.

[0079] The device further comprises:

[0080] The order determination module is used to obtain at least two second default fonts included in the second default font library, obtain the historical usage count of each second default font, sort the at least two second default fonts based on the historical usage count, and determine the font arrangement order in the second default font library.

[0081] The device further comprises:

[0082] The mapping cache module is used to establish a target mapping relationship between a target default font and a target text character, and add the target mapping relationship to a font cache library.

[0083] The device further comprises:

[0084] A historical data acquisition module is used to acquire historical long text data, traverse the historical long text data, and acquire text characters included in the historical long text data and display fonts used to display the text characters;

[0085] The font cache generation module is used to count the usage frequencies of display fonts, use the most frequently used display font as the cache font for text characters, establish a mapping relationship between text characters and cache fonts, and store the mapping relationship in the font cache library.

[0086] In terms of obtaining the long text data to be displayed and obtaining target text characters from the long text data, the element acquisition module includes:

[0087] a format acquisition unit, configured to acquire long text data to be displayed, and acquire the size information of the display area and the text display format; the size information includes the display width and display height of the display area, and the text display format includes the display line spacing, the first character display format of a paragraph, and the display margin;

[0088] a row number determination unit, configured to determine the number of display rows in the display area according to the display height, the display margin, and the display row spacing;

[0089] A character counting unit is used to determine the number of characters displayed in each line of the display area according to the display width, display margin and the display format of the first character of the paragraph;

[0090] The character determination unit is used to obtain the text to be displayed from the long text data based on the number of display lines and the number of characters displayed in each line, and use the text characters in the text to be displayed as target text characters in sequence.

[0091] The device further comprises:

[0092] The character rendering module is used to obtain the first character display position in the display area and render the target text characters in the display area according to the first character display position and the target display font; the first character display position is determined based on the size information, display margins and the first character display format of the paragraph.

[0093] In terms of rendering the target text characters in the display area according to the first character display position and the target display font, the character rendering module includes:

[0094] a position determination unit, configured to obtain a text position of a target text character in the text to be displayed, and determine a target character display position of the target text character in the display area according to the first character display position and the text position;

[0095] The character display unit is used to render a target text character based on a target display font at a target character display position.

[0096] On the one hand, an embodiment of the present application provides a computer device, including a processor, a memory, and an input and output interface;

[0097] The processor is connected to the memory and the input and output interface respectively, wherein the input and output interface is used to receive and output data, the memory is used to store program code, and the processor is used to call the program code to execute the text display processing method in one aspect of an embodiment of the present application.

[0098] On one hand, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. The computer program includes program instructions. When the program instructions are executed by a processor, the text display processing method in one aspect of the embodiment of the present application is executed.

[0099] In one aspect, an embodiment of the present application provides a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the method provided in various optional embodiments of the embodiment of the present application.

[0100] Implementing the embodiments of this application will have the following beneficial effects:

[0101] The embodiment of the present application obtains long text data to be displayed, obtains the target text character in the long text data, obtains a font cache library, the font cache library includes a mapping relationship between cache fonts and text characters, the mapping relationship is determined according to the display of cache fonts and text characters in historical long text data; traverses the font cache library according to the target text character and the mapping relationship; if the target cache font corresponding to the target text character is traversed in the font cache library, the target cache font is used as the target display font for rendering the target text character; if the target cache font corresponding to the target text character is not traversed in the font cache library, then obtains a default font library, detects the font support relationship between the default font in the default font library and the target text character, obtains the target default font corresponding to the target text character in the default font library according to the font support relationship, and uses the target default font as the target display font for rendering the target text character. Through the above process, the font corresponding to the target text character is obtained, wherein the time required to obtain the font corresponding to the target text character through the font cache library is less, so that when the text data is displayed through the present application, the time spent on obtaining the font corresponding to the text character can be reduced, thereby improving the efficiency of text display processing. At the same time, the time required for text display processing is reduced, thereby improving the smoothness of text data display. BRIEF DESCRIPTION OF THE DRAWINGS

[0102] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0103] Figure 1 This is a network architecture diagram of a text display processing provided by an embodiment of the present application;

[0104] Figure 2 This is a schematic diagram of a text display processing scenario provided by an embodiment of the present application;

[0105] Figure 3 This is a flow chart of a text display processing method provided by an embodiment of the present application;

[0106] Figure 4 This is a schematic diagram of a font acquisition scenario provided by an embodiment of the present application;

[0107] Figure 5 This is a schematic diagram of a scenario of a font acquisition example provided in an embodiment of the present application;

[0108] Figure 6 This is a schematic diagram of a character font matching process provided by an embodiment of the present application;

[0109] Figure 7 This is a schematic diagram of a text display processing device provided by an embodiment of the present application;

[0110] Figure 8 It is a structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0111] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0112] When the text data processed by the embodiments of the present application is large (i.e., the text data includes a large number of text characters), data transmission and other technologies in the field of big data can be used to interact with data between the local terminal and the server, that is, to obtain text data from the server, and perform text display processing on each text character included in the text data, so as to improve the efficiency of text display processing. Among them, the font cache library and default font library mentioned in the embodiments of the present application can be stored based on cloud storage technology in cloud technology to save storage space of the local terminal, etc.

[0113] Among them, cloud technology refers to a hosting technology that unifies hardware, software, network and other resources within a wide area network or local area network to achieve data calculation, storage, processing and sharing.

[0114] Cloud technology is a general term for network technologies, information technologies, integration technologies, management platform technologies, and application technologies based on the cloud computing business model. It can form a resource pool that can be used flexibly and conveniently on demand. Cloud computing technology will become a crucial support. Backend services for technical network systems, such as video websites, image websites, and more portals, require extensive computing and storage resources. With the rapid development and application of the internet industry, every item will likely have its own unique identifier, requiring transmission to backend systems for logical processing. Different levels of data will be processed separately, and data from various industries will require a strong system backend, which can only be achieved through cloud computing.

[0115] Among them, cloud storage is a new concept extended and developed from the concept of cloud computing. A distributed cloud storage system (hereinafter referred to as storage system) refers to a storage system that uses cluster applications, grid technology, and distributed storage file systems to bring together a large number of different types of storage devices (storage devices are also called storage nodes) in the network through application software or application interfaces to work together and provide external data storage and business access functions.

[0116] Currently, storage systems utilize a method for creating logical volumes. When creating a logical volume, physical storage space is allocated for each logical volume. This physical storage space may consist of disks on a specific storage device or several storage devices. When a client stores data on a logical volume, it stores the data on a file system. The file system divides the data into multiple parts, each of which is an object. An object contains not only the data but also additional information such as the data identifier (ID) of the data entity. The file system writes each object to the physical storage space of the logical volume and records the storage location information of each object. Therefore, when a client requests access to data, the file system can provide access to the data based on the storage location information of each object.

[0117] The storage system allocates physical storage space to logical volumes by pre-dividing the physical storage space into stripes based on the estimated capacity of the objects to be stored in the logical volume (this estimate often has a large margin relative to the actual capacity of the objects to be stored) and the Redundant Array of Independent Disks (RAID) groupings. A logical volume can be understood as a stripe, thereby allocating physical storage space to the logical volume.

[0118] Furthermore, big data refers to data sets that cannot be captured, managed, and processed within a specific timeframe using conventional software tools. These are massive, rapidly growing, and diverse information assets that require new processing models to enhance decision-making, insight discovery, and process optimization. With the advent of the cloud era, big data has attracted increasing attention. Big data requires specialized technologies to efficiently process large amounts of time-sensitive data. Technologies suitable for big data include massively parallel processing databases, data mining, distributed file systems, distributed databases, cloud computing platforms, the internet, and scalable storage systems.

[0119] Optional, see Figure 1 , Figure 1 This is a network architecture diagram for text display processing provided by an embodiment of the present application. This embodiment of the present application can be implemented by a computer device, wherein the computer device can be composed of a server and a terminal device; the computer device can also be a server or a terminal device, without limitation. This embodiment of the present application is applicable to any application that can display text data. The computer device can obtain text data from a server.

[0120] When running an application, the local terminal 101 can obtain text data from the server corresponding to the application, use the text characters in the text data as target text characters, determine the target display fonts for the target text characters, and display the text data based on the target display fonts for the target text characters. The local terminal 101 is a computer device. For example, the applications in the local terminal 101 include application 1, application 2, and application 3, wherein application 1 corresponds to server 102a, application 2 corresponds to server 102b, and application 3 corresponds to server 102c. Each server can store data generated by the corresponding application.

[0121] For example, when the local terminal 101 runs application 1 and needs to display text data in application 1, the local terminal 101 obtains the text data to be displayed from the server 102a corresponding to application 1, takes the text characters in the text data as target text characters in turn, and searches for the target cache font corresponding to the target text characters from the font cache library. If the target cache font corresponding to the target text characters is found, the target cache font can be used as the target display font of the target text characters; if the target cache font corresponding to the target text characters does not exist in the font cache library, the font corresponding to the target text characters is obtained from the default font library. Since searching for the font corresponding to the target text characters in the font cache library only takes a short time, the font corresponding to the target text characters will be searched from the default font library only when the font corresponding to the target text characters cannot be found in the font cache library. This will reduce the time required to obtain the font corresponding to the text characters, thereby improving the efficiency of text display processing and the smoothness of text data display.

[0122] It is understood that the computer devices mentioned in the embodiments of the present application include but are not limited to terminal devices or servers. In other words, the computer device can be a server or a terminal device, or a system consisting of a server and a terminal device. Among them, the terminal device mentioned above can be an electronic device, including but not limited to a mobile phone, a tablet computer, a desktop computer, a laptop computer, a PDA, an augmented reality / virtual reality (AR / VR) device, a helmet display, a wearable device, a smart speaker, and other mobile internet devices (MID) with network access capabilities.

[0123] Further, see Figure 2 , Figure 2 This is a schematic diagram of a text display processing scenario provided by an embodiment of the present application. Figure 2As shown, the local terminal obtains text data 201, determines the text to be displayed in the text data 201, and uses the text characters in the text to be displayed as target text characters in sequence, and obtains a font cache library 202. It detects whether there is a font corresponding to the target text character in the font cache library 202. If there is a font corresponding to the target text character in the font cache library 202, the font is recorded as the target cache font corresponding to the target text character, and the target cache font is determined as the target display font of the target text character, and the target display font is used to render the target text character; if there is no font corresponding to the target text character in the font cache library 202, the default font library 203 is obtained, and the target default font corresponding to the target text character is obtained from the default font library 203, and the target default font is determined as the target display font of the target text character to render the target text character. Similarly, the display font of each text character in the text to be displayed is obtained, and the corresponding text character is displayed according to each display font. Through the above process, the display of text data is realized. In the process of displaying text data, the font corresponding to each text character is first searched in the font cache library. When the font corresponding to the text character does not exist in the font cache library, the font corresponding to the text character will be obtained from the default font library, thereby reducing the time spent on obtaining the font corresponding to the text character and improving the efficiency of text display processing.

[0124] Among them, the font cache library and default font library mentioned in the embodiments of the present application can be stored in the storage space of the local terminal itself, or stored in the server corresponding to the application running on the local terminal, or the font cache library and default font library can also be stored through cloud storage technology, which is not limited here.

[0125] Further, see Figure 3 , Figure 3 This is a flow chart of a text display processing method provided by an embodiment of the present application. Figure 3 As shown, the text display processing process includes the following steps:

[0126] Step S301 : obtaining long text data to be displayed, obtaining target text characters from the long text data, and obtaining a font cache library.

[0127] In this embodiment, the local terminal obtains the target text character and the font cache library, and the font cache library includes a mapping relationship between the cache font and the text character. Among them, the target text character is the text character to be rendered currently, the local terminal obtains the target text character, and obtains the font cache library for searching for the font corresponding to the target text character. Optionally, there can be at least two font cache libraries, wherein at least two font cache libraries correspond to one application respectively. For example, if 5 applications (including application 1 to application 5) are installed in the local terminal, then each application corresponds to a font cache library, that is, there are 5 font cache libraries. When the local terminal is running application 1, the local terminal needs to display text data in application 1, obtain the font cache library corresponding to application 1, and use each text character in the text data to be displayed by the local terminal as the target text character in turn. Different applications correspond to different font cache libraries, so that the same text data can have different display effects for different applications, thereby improving the character display effect. diversity, so that different applications can have different display styles, thereby improving the personalization of different applications; optionally, there can also be a font cache library. When the local terminal needs to display text data, each text character in the text data is used as the target text character in turn to obtain the font cache library. When multiple applications share a font cache library, the storage space used by the font cache library can be reduced, resources are saved, and there is no need to search for the corresponding font cache library according to the application, thereby improving the efficiency of text display processing. Furthermore, when the font cache library is stored in the local terminal, the storage space used by the font cache library is reduced, thereby improving the operating efficiency of the local terminal.

[0128] Among them, the mapping relationship between the cache fonts and text characters included in the font cache library is created through the relationship between the text characters in the historical long text data and the cache fonts. The cache font refers to the display font used when the text character is displayed in the historical long text data. Furthermore, the historical long text data can be obtained, and the historical long text data can be traversed to obtain the text characters included in the historical long text data and the display fonts for displaying the text characters; the usage frequency of the display fonts is counted, and the display font with the highest usage frequency is used as the cache font of the text character, and a mapping relationship between the text character and the cache font is established, and the mapping relationship is stored in the font cache library. Among them, when the display font includes a font, the display font can be directly used as the cache font of the text character. Optionally, an artificially preset mapping relationship can also be obtained, and the preset mapping relationship can be added to the font cache library. Among them, the mapping relationship contained in the font cache library represents that the cache font corresponding to the mapping relationship supports the display of the text character. Therefore, when a target cache font that has a mapping relationship with the target text character is found in the font cache library, it can be considered that the target cache font can support the display of the target text character without detecting the font support relationship between the target text character and the target cache font, thereby reducing the time spent on obtaining the font corresponding to the text character and improving text display efficiency.

[0129] The method includes obtaining the size information and text display format of the display area, wherein the size information includes the display width and display height of the display area, and the text display format includes the display line spacing, the first character display format of a paragraph, and the display margins. The method determines the number of display lines in the display area based on the display height, display margins, and display line spacing; determines the number of characters displayed in each line of the display area based on the display width, display margins, and the first character display format of a paragraph; and obtains the text to be displayed from the long text data to be displayed based on the number of display lines and the number of characters displayed in each line, and sequentially uses the text characters in the text to be displayed as target text characters.

[0130] Optionally, the text display format may also include character size, etc. The display line spacing refers to the spacing between lines when the local terminal displays text data, including but not limited to single line spacing, 1.15 line spacing, 1.5 line spacing, and fixed line spacing; the first character display format of a paragraph is used to indicate the format of the first character of each paragraph when the local terminal displays text data, such as first line indent fixed character, hanging indent fixed character, or no indent; and the display margin is used to indicate the distance between the text data and the area boundary of the display area when the local terminal displays text data.

[0131] Optionally, the local terminal can determine the character display range of the text data display based on the obtained text display format. For example, the character display height can be obtained through the display height and display margins, and the number of display lines in the display area can be determined based on the character display height and the display line spacing. Optionally, the number of display lines can be the ratio of the character display height to the display line spacing. Furthermore, when the display line spacing is single line spacing or multiple line spacing such as 1.15 times line spacing, the local terminal can determine the line height based on the multiple line spacing and character size, and determine the number of display lines in the display area based on the character display height and line height. Similarly, the character display width can be determined based on the display width and display margins, and the number of characters displayed in each line in the display area can be determined based on the character display width, the display format of the first character of the paragraph, and the character size. The local terminal can determine the number of text characters to be displayed based on the obtained number of display lines and the number of characters displayed per line, and based on the number of text characters, obtain the text to be displayed from the text data, and use the text characters in the text to be displayed as target text characters in sequence to obtain the font cache library.

[0132] Optionally, when obtaining the text to be displayed from the text data based on the number of text characters, when the text data is in an undisplayed state, starting from the first text character of the text data, the text characters are obtained in sequence to determine the text to be displayed, wherein the number of text characters included in the text to be displayed is equal to the number of text characters. When the text data is in a semi-displayed state, starting from the character starting rendering position of the text data, the text characters are obtained in sequence to determine the text to be displayed; wherein the character starting rendering position is used to represent the position where the rendering was stopped when the text data was rendered last time. For example, when the text data was rendered last time, the rendering was stopped at the 10th text character of the second paragraph, then the 10th text character of the second paragraph is determined as the character starting rendering position. When rendering the text data this time, starting from the 10th text character of the second paragraph, the text characters are obtained in sequence to determine the text to be displayed.

[0133] Optional, see Figure 4 , Figure 4 This is a schematic diagram of a font acquisition scenario provided by an embodiment of the present application. Figure 4As shown, local terminal 402 obtains text data sent by server 401, displays the text data on text data display page 403, obtains display area 4031 on text data display page 403, obtains size information of display area 4031, including display height 3a and display width 3b of display area 4031, and obtains text display format. The text display format includes display line spacing 3e, the first character display format of a paragraph, and display margins, which include display height margin 3c and display width margin 3d. The local terminal can obtain character display height 3f based on display height margin 3c and display height 3a, and determine the number of display lines in display area 4031 based on character display height 3f and display line spacing 3e. Similarly, the local terminal can determine character display width 3g based on display width 3b and display width margin 3d. Based on character display width 3g, the first character display format of a paragraph, and character size, the local terminal determines the number of characters to be displayed for each line in display area 4031. Based on the number of display lines and the number of characters to be displayed per line, the local terminal determines the number of text characters to be displayed. The character starting rendering position is obtained, and based on the character starting rendering position, text characters are sequentially obtained from the text data 404 to determine the text to be displayed 405, and the text characters in the text to be displayed 405 are sequentially used as target text characters 406, and the font cache library 407 is obtained.

[0134] Step S302: traverse the font cache library according to the mapping relationship between the target text characters and the font cache library.

[0135] Optionally, a mapping relationship in the font cache library is obtained, which is a mapping relationship between a cached font and a text character. Based on the mapping relationship, the font cache library is traversed to find a target mapping relationship associated with the target text character. If a target mapping relationship associated with the target text character exists in the font cache library, it is determined that the target cache font corresponding to the target text character is traversed in the font cache library, and step S303 is executed, wherein the target cache font refers to the cache font indicated by the target mapping relationship; if there is no target mapping relationship associated with the target text character in the font cache library, it is determined that the target cache font corresponding to the target text character is not traversed in the font cache library, and step S304 is executed.

[0136] For example, see Figure 4The local terminal traverses the font cache library 407 to search for a cache font that has a mapping relationship with the target text character 406. If the target cache font corresponding to the target text character is traversed in the font cache library 407, step S303 is executed to use the target cache font as the target display font for rendering the target text character; if the target cache font corresponding to the target text character is not traversed in the font cache library 407, step S304 is executed to obtain the default font library 408, obtain the target default font corresponding to the target text character from the default font library 408, and use the target default font as the target display font for rendering the target text character.

[0137] Further, see Figure 5 , Figure 5 This is a scene diagram of a font acquisition example provided by an embodiment of the present application. Figure 5 As shown, font cache library 501 includes mapping relationships 502 between cached fonts and text characters. Assume that mapping relationships 502 in font cache library 501 include mapping relationship 1 between text character 1 and cached font 1, mapping relationship 2 between text character 2 and cached font 2, mapping relationship 3 between text character 3 and cached font 3, and mapping relationship n between text character n and cached font n, etc., where n is a positive integer. The local terminal traverses font cache library 501. If a target mapping relationship associated with a target text character is obtained from font cache library 501, step S303 is executed. If a target mapping relationship associated with a target text character is not obtained from font cache library 501, step S304 is executed.

[0138] Optionally, assuming that the target text character is text character 3, the local terminal traverses the font cache library 501, obtains mapping relationship 1 between text character 1 and cache font 1, and determines that mapping relationship 1 is not associated with the target text character; obtains mapping relationship 2 between text character 2 and cache font 2, and determines that mapping relationship 2 is not associated with the target text character; obtains mapping relationship 3 between text character 3 and cache font 3, determines that mapping relationship 3 is associated with the target text character, determines mapping relationship 3 as the target mapping relationship 503, and executes step S303. Alternatively, assuming that mapping relationship 1 between text character 1 and cached font 1 is obtained, it is determined that mapping relationship 1 is not associated with the target text character; mapping relationship 2 between text character 2 and cached font 2 is obtained, and it is determined that mapping relationship 2 is not associated with the target text character; mapping relationship 3 between text character 3 and cached font 3 is obtained, and it is determined that mapping relationship 3 is not associated with the target text character; ...; mapping relationship n between text character n and cached font n is obtained, and it is determined that mapping relationship n is not associated with the target text character, then it is determined that the target cache font corresponding to the target text character is not traversed in the font cache library, and step S304 is executed to obtain a default font library 504, obtain a target default font corresponding to the target text character from the default font library 504, and use the target default font as the target display font for rendering the target text character (see Figure 5 The process is shown by the dotted line).

[0139] Step S303: If the target cache font corresponding to the target text character is found in the font cache library, the target cache font is used as the target display font for rendering the target text character.

[0140] Optionally, if the target cache font corresponding to the target text character is found in the font cache library, the target cache font is used as the target display font of the target text character, and the target display font is used to render the target text character. For example, see Figure 5 ,by Figure 5 Taking the target mapping relationship 503 associated with the target text character in the font cache library 501 as an example, the target mapping relationship 503 is a mapping relationship between text character 3 and cache font 3. The local terminal determines the cache font 3 in the target mapping relationship 503 as the target display font of the target text character.

[0141] Step S304: If the target cache font corresponding to the target text character is not traversed in the font cache library, the default font library is obtained, and the font support relationship between the default font in the default font library and the target text character is detected. According to the font support relationship, the target default font corresponding to the target text character is obtained in the default font library, and the target default font is used as the target display font for rendering the target text character.

[0142] Optionally, the font support relationship includes a support display relationship and a matching failure relationship, wherein the support display relationship is used to characterize that the default font can support the display of text characters whose font support relationship with the default font is a support display relationship. For example, if the font support relationship between default font 1 and text character 1 is a support display relationship, then default font 1 can support text character 1 for display; the matching failure relationship is used to characterize that a text character will be displayed as a failure when displayed by the default font whose font support relationship with the text character is a matching failure relationship, that is, the matching failure relationship is used to characterize that the default font does not support the display of the target text character. For example, if the font support relationship between default font 2 and text character 2 is a matching failure relationship, if text character 2 is displayed with default font 2, text character 2 cannot be displayed normally.

[0143] Furthermore, the default font library includes a first default font library; the first default font library is a font library that has an initial association relationship with the application system, and the initial association relationship is the font library that comes with the application system when the local terminal installs the application system. Optionally, when the local terminal detects the font support relationship between the default font in the default font library and the target text character, and obtains the target default font corresponding to the target text character in the default font library based on the font support relationship, it obtains at least two first default fonts in the first default font library and obtains the font priority of each first default font; based on the font priority, the font support relationship between the target text character and the at least two first default fonts is detected in turn, and the first default font whose font support relationship with the target text character is a support display relationship is determined as the target default font corresponding to the target text character. Optionally, the local terminal obtains the font priority of each first default font in the first default font library, sorts each first default font based on the font priority, and detects the font support relationship between the target text character and at least two first default fonts in turn based on the sorted first default fonts, until a first default font whose font support relationship with the target text character is a support display relationship is obtained, and the first default font is determined as the target default font corresponding to the target text character.

[0144] Among them, the local terminal can obtain the character type to which the target text character belongs, obtain the priority set corresponding to the character type, and determine the font priority of each first default font based on the priority set. The character type can be a language type, such as Chinese type, English type, Korean type, and Japanese type. Optionally, different character types correspond to different priority sets. Optionally, there can be a priority set, and the local terminal can obtain the priority set, and determine the font priority of each first default font based on the priority set. Optionally, the historical usage count of each first default font can be counted, and the local terminal can sort each first default font based on the historical usage count obtained by counting, and determine the font priority of each first default font according to the sorting result.

[0145] Optionally, when generating a default font, the text characters supported by the default font are determined. The local terminal may obtain the number of text characters supported by each first default font, sort the at least two first default fonts based on the number of text characters supported by each first default font, and determine the font priority of each first default font based on the sorting result.

[0146] Furthermore, the local terminal may obtain a font matching component, and based on the font priority, combine the target text character with the i-th first default font of at least two first default fonts to form a to-be-matched element pair A. i ; i is a positive integer, i is less than or equal to the number of at least two first default fonts. i Input font matching component, get font matching component for the element to be matched A i The matching result of . If the matching result is a successful matching result, the support display relationship is determined as the font support relationship between the target text character and the i-th first default font; if the matching result is a failed matching result, the failed matching relationship is determined as the font support relationship between the target text character and the i-th first default font. The output result of the font matching component can be Boolean data, for example, the output result of the font matching component is 0 or 1, where 0 indicates a failed matching result and 1 indicates a successful matching result; the local terminal will match the element to be matched to A i Input font matching component, obtain the font matching component for the element to be matched A i If the output result is 1, the element pair A to be matched is determined. i The matching result is a successful matching result, and the support display relationship is determined as the font support relationship between the target text character and the i-th first default font; if the output result is 0, the element to be matched is determined to be A iIf the matching result is a matching failure result, the matching failure relationship is determined as the font support relationship between the target text character and the i-th first default font.

[0147] Furthermore, the default font library includes a second default font library and a third default font library; the second default font library includes all fonts in the application system; the third default font library includes a character mapping table; the character mapping table includes a mapping relationship between a character type and a third default font; wherein the number of second default fonts included in the second default font library is greater than the number of first default fonts included in the first default font library. Optionally, when the local terminal detects the font support relationship between the default font in the default font library and the target text character, and obtains the target default font corresponding to the target text character in the default font library based on the font support relationship, the local terminal obtains the character type to which the target text character belongs. If the character type to which the target text character belongs belongs to the first character type, the second default font library is obtained, and based on the font arrangement order in the second default font library, the font support relationship between the target text character and the second default font in the second default font library is detected in sequence, and the second default font whose font support relationship with the target text character is a support display relationship is determined as the target default font corresponding to the target text character. If the character type to which the target text character belongs belongs to the second character type, then obtain the character mapping table in the third default font library. If there is a mapping relationship associated with the character type to which the target text character belongs in the character mapping table, then the third default font that has a mapping relationship with the character type to which the target text character belongs is used as the target default font corresponding to the target text character; the second character type is the character type among all character types except the first character type.

[0148] Among them, if there is no mapping relationship associated with the character type to which the target text character belongs in the character mapping table in the third default font library, the second default font library is obtained, and based on the font arrangement order in the second default font library, the font support relationship between the target text character and the second default font in the second default font library is detected in turn, and the second default font whose font support relationship with the target text character is a support display relationship is determined as the target default font corresponding to the target text character.

[0149] The local terminal may further obtain a historical display frequency of the character type. If the historical display frequency is greater than a display frequency threshold, the character type is determined to be a first character type; if the historical display frequency is less than or equal to the display frequency threshold, the character type is determined to be a second character type. For example, if the character type obtained is Chinese, and the historical display frequency of the Chinese type is greater than the display frequency threshold, the Chinese type is determined to be the first character type.

[0150] The local terminal obtains at least two second default fonts included in the second default font library, obtains the historical usage count of each second default font, sorts the at least two second default fonts based on the historical usage count, and determines the font arrangement order in the second default font library.

[0151] Furthermore, the local terminal can obtain a first default font library, and sequentially detect the font support relationship between the target text character and at least two first default fonts. If a first default font whose font support relationship with the target text character is a display support relationship is obtained, the first default font is determined as the target default font corresponding to the target text character; if the font support relationship between the target text character and at least two first default fonts is a matching failure relationship, the character type to which the target text character belongs is obtained. If the character type to which the target text character belongs is the first character type, the target default font corresponding to the target text character is obtained from the second default font library. If the character type to which the target text character belongs is the second character type, the third default font corresponding to the target text character is searched from the third default font library. If the third default font corresponding to the target text character exists in the third default font library, the third default font is used as the target default font corresponding to the target text character; if the third default font corresponding to the target text character does not exist in the third default font library, the target default font corresponding to the target text character is obtained from the second default font library.

[0152] Optional, see Figure 6 , Figure 6 This is a flow chart of a character font matching process provided by an embodiment of the present application. Figure 6 As shown, the process includes the following steps:

[0153] Step S602 , detecting whether a target cache font corresponding to the target text character is found in the font cache library.

[0154] Optionally, the local terminal obtains the target text character, obtains the font cache library 601, traverses the font cache library 601, and detects whether the target cache font corresponding to the target text character is found in the font cache library 601. Figure 3 If the target cache font corresponding to the target text character is found in the font cache library 601, the target cache font is determined as the target display font of the target text character. Figure 3 As described in step S303; if the target cache font corresponding to the target text character is not traversed in the font cache library 601, the first default font library 603 is obtained and step S604 is executed.

[0155] Step S604 : detecting whether there is a first default font in the first default font library whose font support relationship is a display support relationship.

[0156] Optionally, the local terminal detects at least two first default fonts in the first default font library, and sequentially detects the font support relationship between the target text character and the at least two first default fonts. If there is a first default font in the first default font library whose font support relationship is a support display relationship, the first default font is determined as the target default font corresponding to the target text character, and the target default font is used as the target display font of the target text character; if the font support relationship between at least two first default fonts and the target text character in the first default font library is a matching failure relationship, step S605 is executed. This step can be referred to in Figure 3 The specific description of step S304 is omitted here.

[0157] Step S605: Obtain the character type of the target text character.

[0158] Optionally, the local terminal may obtain the character type to which the target text character belongs. If the character type belongs to the first character type, a second default font library 606 is obtained. From the second default font library 606, a second default font whose font support relationship with the target text character is a display-supported relationship is obtained as the target default font corresponding to the target text character. The target default font is used as the target display font for the target text character. If the character type belongs to the second character type, a third default font library 607 is obtained, and step S608 is executed.

[0159] Step S608: Check whether there is a mapping relationship associated with the character type to which the target text character belongs in the third default font library.

[0160] Optionally, if it is detected that there is a mapping relationship associated with the character type to which the target text character belongs in the third default font library 607, the third default font in the mapping relationship associated with the character type to which the target text character belongs is used as the target default font for the target text character, and the target default font is determined as the target display font for the target text character; if it is detected that there is no mapping relationship associated with the character type to which the target text character belongs in the third default font library 607, the target default font corresponding to the target text character is obtained from the second default font library 606, and the target default font is determined as the target display font for the target text character. The second default font library includes all fonts in the application system, so a font that supports the target text character can be found through the second default font library.

[0161] Furthermore, a target mapping relationship between a target default font and target text characters can be established, and the target mapping relationship can be added to the font cache library. Since the text data to be displayed by the local terminal includes a relatively small number of text characters, storing the mapping relationship between previously displayed text characters and the fonts used for the text characters in the font cache library will occupy less memory space.

[0162] Furthermore, the local terminal can render the target text characters based on the target display font. Optionally, the first character display position is obtained in the display area, and the target text characters are rendered in the display area according to the first character display position and the target display font; the first character display position is determined based on the size information, display margins, and the first character display format of the paragraph. Optionally, when rendering the target text characters in the display area according to the first character display position and the target display font, the local terminal obtains the text position of the target text character in the text to be displayed, and determines the target character display position of the target text character in the display area according to the first character display position and the text position; at the target character display position, the target text characters are rendered based on the target display font.

[0163] Optionally, when the local terminal is displaying text data and needs to update the currently displayed text data, the local terminal can obtain the rendered text and text update area displayed in the display area, and determine the first character display position based on the text update area and the rendered text, wherein the text update area is determined based on the text update request obtained by the local terminal. Wherein, when the text update request is used to indicate viewing rendered text, the local terminal directly obtains the text data requested by the user in the rendered text according to the text update request, and displays the text data requested by the user in the display area. When the text update request is used to indicate viewing unrendered text, the local terminal can determine the text update area according to the text update request, determine the first character display position based on the text update area, and determine the character starting rendering position based on the rendered text; starting from the character starting rendering position in the text data, obtain text characters in sequence as target text characters, execute the step of obtaining the target display font of the target text character in this application, determine the target character display position of the target text character according to the first character display position, and render the target text character based on the target display font at the target character display position in the display area.

[0164] The embodiment of the present application obtains long text data to be displayed, obtains the target text character in the long text data, obtains a font cache library, and the font cache library includes a mapping relationship between cache fonts and text characters; traverses the font cache library according to the target text character and the mapping relationship; if the target cache font corresponding to the target text character is traversed in the font cache library, the target cache font is used as the target display font for rendering the target text character; if the target cache font corresponding to the target text character is not traversed in the font cache library, the default font library is obtained, the font support relationship between the default font in the default font library and the target text character is detected, and the target default font corresponding to the target text character is obtained in the default font library according to the font support relationship, and the target default font is used as the target display font for rendering the target text character. Through the above process, the font corresponding to the target text character is obtained, wherein the time required to obtain the font corresponding to the target text character through the font cache library is less, so that when the text data is displayed through the present application, the time spent on obtaining the font corresponding to the text character can be reduced, thereby improving the efficiency of the text display processing. At the same time, since the time required for the text display processing is reduced, the smoothness of the text data display is improved. Moreover, the font corresponding to the target text character is searched from each default font library in turn. The fonts contained in different default font libraries are not exactly the same. The efficiency of text display processing can be improved by matching different default font libraries in sequence.

[0165] Further, see Figure 7 , Figure 7 Schematic diagram of a text display processing device provided in an embodiment of the present application. The text display processing device can be a computer program (including program code) running on a computer device, for example, the text display processing device is an application software; the device can be used to execute the corresponding steps of the method provided in an embodiment of the present application. Figure 7 As shown, the text display processing device 700 can be used to Figure 3 The computer device in the corresponding embodiment may specifically include: an element acquisition module 11 , a font traversal module 12 , a font determination module 13 and a font matching module 14 .

[0166] An element acquisition module 11 is configured to acquire long text data to be displayed, obtain target text characters from the long text data, and acquire a font cache library; the font cache library includes a mapping relationship between cached fonts and text characters, the mapping relationship being created by the relationship between text characters in the historical long text data and cached fonts, the cached font being the display font used when displaying the text characters;

[0167] The font traversal module 12 is used to traverse the font cache library according to the target text characters and the mapping relationship;

[0168] The font determination module 13 is configured to use the target cache font as the target display font for rendering the target text character if a target cache font corresponding to the target text character is found in the font cache library;

[0169] The font matching module 14 is used to obtain a default font library if the target cache font corresponding to the target text character is not traversed in the font cache library, detect the font support relationship between the default font in the default font library and the target text character, obtain the target default font corresponding to the target text character in the default font library according to the font support relationship, and use the target default font as the target display font for rendering the target text character; the font support relationship includes a support display relationship and a matching failure relationship, the support display relationship is used to indicate that the default font supports the display of the target text character, and the matching failure relationship is used to indicate that the default font does not support the display of the target text character.

[0170] The default font library includes a first default font library; the first default font library is a font library that has an initial association relationship with the application system;

[0171] In terms of detecting the font support relationship between the default font in the default font library and the target text character, and obtaining the target default font corresponding to the target text character in the default font library according to the font support relationship, the font matching module 14 includes:

[0172] The priority determination unit 141 is configured to obtain at least two first default fonts in the first default font library and obtain a font priority of each first default font;

[0173] The matching detection unit 142 is used to detect the font support relationship between the target text character and at least two first default fonts in sequence based on the font priority, and determine the first default font whose font support relationship with the target text character is a support display relationship as the target default font corresponding to the target text character.

[0174] In terms of obtaining the font priority of each first default font, the priority determination unit 141 includes:

[0175] The set acquisition subunit 1411 is used to acquire the character type to which the target text character belongs and acquire the priority set corresponding to the character type;

[0176] The priority determination subunit 1412 is configured to determine the font priority of each first default font according to the priority set.

[0177] In terms of obtaining the font priority of each first default font, the priority determination unit 141 includes:

[0178] The font sorting subunit 1413 is configured to obtain the number of text characters supported by each first default font, sort at least two first default fonts based on the number of text characters supported by each first default font, and determine the font priority of each first default font according to the sorting result.

[0179] In terms of sequentially detecting font support relationships between target text characters and at least two first default fonts based on font priorities, the matching detection unit 142 includes:

[0180] The component acquisition subunit 1421 is used to acquire a font matching component, and based on the font priority, the target text character and the i-th first default font in at least two first default fonts form a to-be-matched element pair A. i ; i is a positive integer, i is less than or equal to the number of at least two first default fonts;

[0181] The component processing subunit 1422 is used to match the element pair A to be matched i Input font matching component, get font matching component for the element to be matched A i The matching results;

[0182] The result acquisition subunit 1423 is configured to determine the display support relationship as the font support relationship between the target text character and the i-th first default font if the matching result is a successful matching result;

[0183] The result acquisition subunit 1423 is further configured to determine the matching failure relationship as a font support relationship between the target text character and the i-th first default font if the matching result is a matching failure result.

[0184] The default font library includes a second default font library and a third default font library; the second default font library includes all fonts in the application system; the third default font library includes a character mapping table; the character mapping table includes a mapping relationship between character types and the third default font;

[0185] In terms of detecting the font support relationship between the default font in the default font library and the target text character, and obtaining the target default font corresponding to the target text character in the default font library according to the font support relationship, the font matching module 14 includes:

[0186] A type obtaining unit 143 is used to obtain the character type to which the target text character belongs;

[0187] A first detection unit 144 is configured to, if the character type to which the target text character belongs is the first character type, obtain a second default font library, and based on the font arrangement order of the second default font library, sequentially detect font support relationships between the target text character and second default fonts in the second default font library, and determine the second default font whose font support relationship with the target text character is a display-supporting relationship as the target default font corresponding to the target text character;

[0188] The second detection unit 145 is used to obtain a character mapping table in a third default font library if the character type to which the target text character belongs belongs to the second character type; if there is a mapping relationship associated with the character type to which the target text character belongs in the character mapping table, the third default font that has a mapping relationship with the character type to which the target text character belongs is used as the target default font corresponding to the target text character; the second character type is the character type among all character types except the first character type.

[0189] The font matching module 14 further includes:

[0190] The third detection unit 146 is used to obtain a second default font library if there is no mapping relationship associated with the character type to which the target text character belongs in the character mapping table, and based on the font arrangement order in the second default font library, sequentially detect the font support relationship between the target text character and the second default font in the second default font library, and determine the second default font whose font support relationship with the target text character is a support display relationship as the target default font corresponding to the target text character.

[0191] The device 700 further includes:

[0192] A frequency comparison module 15 is configured to obtain a historical display frequency of a character type, and if the historical display frequency is greater than a display frequency threshold, determine the character type as a first character type;

[0193] The frequency comparison module 15 is further configured to determine the character type as the second character type if the historical display frequency is less than or equal to the display frequency threshold.

[0194] The device 700 further includes:

[0195] The order determination module 16 is configured to obtain at least two second default fonts included in the second default font library, obtain a historical usage count of each second default font, sort the at least two second default fonts based on the historical usage count, and determine an arrangement order of the fonts in the second default font library.

[0196] The device 700 further includes:

[0197] The mapping cache module 17 is used to establish a target mapping relationship between a target default font and a target text character, and add the target mapping relationship to a font cache library.

[0198] In terms of obtaining the long text data to be displayed and obtaining target text characters from the long text data, the element obtaining module 11 includes:

[0199] The format acquisition unit 111 is used to acquire the long text data to be displayed, and acquire the size information of the display area and the text display format; the size information includes the display width and display height of the display area, and the text display format includes the display line spacing, the first character display format of the paragraph, and the display margin;

[0200] a row number determination unit 112 for determining the number of display rows in the display area according to the display height, the display margin, and the display row spacing;

[0201] The character counting unit 113 is used to determine the number of characters displayed in each line of the display area according to the display width, the display margin and the display format of the first character of the paragraph;

[0202] The character determination unit 114 is configured to obtain the to-be-displayed text from the long text data based on the number of display lines and the number of characters displayed in each line, and sequentially use the text characters in the to-be-displayed text as target text characters.

[0203] The device 700 further includes:

[0204] The character rendering module 18 is used to obtain the first character display position in the display area and render the target text character in the display area according to the first character display position and the target display font; the first character display position is determined based on the size information, display margins and the first character display format of the paragraph.

[0205] In terms of rendering the target text characters in the display area according to the first character display position and the target display font, the character rendering module 18 includes:

[0206] A position determination unit 181 is configured to obtain a text position of a target text character in the text to be displayed, and determine a target character display position of the target text character in the display area according to the first character display position and the text position;

[0207] The character display unit 182 is configured to render a target text character at a target character display position based on a target display font.

[0208] The device 700 further includes:

[0209] The historical data acquisition module 19 is used to acquire historical long text data, traverse the historical long text data, and acquire the text characters included in the historical long text data and the display fonts of the displayed text characters;

[0210] The font cache generation module 20 is used to count the usage frequencies of display fonts, use the most frequently used display font as the cache font for text characters, establish a mapping relationship between text characters and cache fonts, and store the mapping relationship in the font cache library.

[0211] The embodiment of the present application provides a text display processing device, which obtains long text data to be displayed, obtains target text characters from the long text data, obtains a font cache library, and the font cache library includes a mapping relationship between cache fonts and text characters; traverses the font cache library according to the target text characters and the mapping relationship; if the target cache font corresponding to the target text character is traversed in the font cache library, the target cache font is used as the target display font for rendering the target text character; if the target cache font corresponding to the target text character is not traversed in the font cache library, a default font library is obtained, the font support relationship between the default font in the default font library and the target text character is detected, and the target default font corresponding to the target text character is obtained in the default font library according to the font support relationship, and the target default font is used as the target display font for rendering the target text character. Through the above process, the font corresponding to the target text character is obtained, wherein the time required to obtain the font corresponding to the target text character through the font cache library is less, so that when the text data is displayed through the present application, the time spent on obtaining the font corresponding to the text character can be reduced, thereby improving the efficiency of text display processing. At the same time, since the time required for text display processing is reduced, the smoothness of text data display is improved. Moreover, the long text data includes a large number of text characters. Since the rendering speed of each text character is improved, the rendering efficiency of the long text data is improved.

[0212] See also Figure 8 , Figure 8 This is a schematic diagram of the structure of a computer device provided in an embodiment of the present application. Figure 8 As shown, the computer device in the embodiment of the present application may include: one or more processors 801, memory 802, and input / output interface 803. The processor 801, memory 802, and input / output interface 803 are connected via a bus 804. The memory 802 is used to store computer programs, which include program instructions. The input / output interface 803 is used to receive and output data, and implement data exchange between the font library and the computer device. The processor 801 is used to execute the program instructions stored in the memory 802 to perform the following operations:

[0213] Obtaining long text data to be displayed, obtaining target text characters from the long text data, and obtaining a font cache library; the font cache library includes a mapping relationship between cached fonts and text characters, the mapping relationship being established through a relationship between text characters in historical long text data and cached fonts, the cached font being a display font used when displaying the text characters;

[0214] Traverse the font cache library according to the target text characters and mapping relationships;

[0215] If the target cache font corresponding to the target text character is found in the font cache library, the target cache font is used as the target display font for rendering the target text character;

[0216] If the target cache font corresponding to the target text character is not traversed in the font cache library, the default font library is obtained, and the font support relationship between the default font in the default font library and the target text character is detected. According to the font support relationship, the target default font corresponding to the target text character is obtained in the default font library, and the target default font is used as the target display font for rendering the target text character; the font support relationship includes a support display relationship and a matching failure relationship. The support display relationship is used to represent that the default font supports the display of the target text character, and the matching failure relationship is used to represent that the default font does not support the display of the target text character.

[0217] In some feasible implementations, the processor 801 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor, or the processor may be any conventional processor, etc.

[0218] The memory 802 may include a read-only memory and a random access memory, and provides instructions and data to the processor 801 and the input / output interface 803. A portion of the memory 802 may also include a non-volatile random access memory. For example, the memory 802 may also store device type information.

[0219] In a specific implementation, the computer device can execute the following operations through its built-in functional modules: Figure 3 For details on the implementation methods provided in each step, please refer to the Figure 3 The implementation methods provided in each step are not repeated here.

[0220] The embodiment of the present application provides a computer device, including: a processor, an input and output interface, and a memory, wherein the processor obtains computer instructions in the memory and executes the computer instructions. Figure 3 The various steps of the method shown in the text display processing operation are performed. The embodiment of the present application realizes obtaining the target text character and the font cache library, and the font cache library includes the mapping relationship between the cache font and the text character; according to the target text character and the mapping relationship, the font cache library is traversed; if the target cache font corresponding to the target text character is traversed in the font cache library, the target cache font is used as the target display font for rendering the target text character; if the target cache font corresponding to the target text character is not traversed in the font cache library, the default font library is obtained, the font support relationship between the default font in the default font library and the target text character is detected, and the target default font corresponding to the target text character is obtained in the default font library according to the font support relationship, and the target default font is used as the target display font for rendering the target text character. Through the above process, the font corresponding to the target text character is obtained, wherein the time required to obtain the font corresponding to the target text character through the font cache library is less, so that when the text data is displayed through the present application, the time spent on obtaining the font corresponding to the text character can be reduced, thereby improving the efficiency of the text display processing. At the same time, since the time required for text display processing is reduced, the smoothness of the text data display is improved.

[0221] The embodiment of the present application further provides a computer-readable storage medium, which stores a computer program, which includes program instructions. When the program instructions are executed by the processor, Figure 3 For details on the text display processing methods provided in each step, please refer to the Figure 3 The implementation methods provided in each step will not be repeated here. In addition, the description of the beneficial effects of adopting the same method will not be repeated. For technical details not disclosed in the computer-readable storage medium embodiment involved in this application, please refer to the description of the method embodiment of this application. As an example, the program instructions can be deployed to be executed on one computer device, or on multiple computer devices located in one location, or on multiple computer devices distributed in multiple locations and interconnected by a communication network.

[0222] The computer-readable storage medium may be the text display processing device provided in any of the aforementioned embodiments or the internal storage unit of the computer device, such as the hard disk or memory of the computer device. The computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the computer device. Furthermore, the computer-readable storage medium may also include both the internal storage unit of the computer device and an external storage device. The computer-readable storage medium is used to store the computer program and other programs and data required by the computer device. The computer-readable storage medium may also be used to temporarily store data that has been output or is to be output.

[0223] The present application also provides a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs Figure 3 The method provided in the various optional methods realizes the determination of the target display font corresponding to the target text character, first searches the font corresponding to the target text character through the font cache library, reduces the time used for font acquisition, and improves the efficiency of text display processing.

[0224] The term "comprising" and any variations thereof in the description, claims, and drawings of the embodiments of this application are intended to cover non-exclusive inclusions. For example, a process, method, apparatus, product, or device comprising a series of steps or modules is not limited to the listed steps or modules, but may optionally include steps or modules not listed, or may optionally include other steps and modules inherent to the process, method, apparatus, product, or device.

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

[0226] The methods and related devices provided by the embodiments of the present application are described with reference to the method flow charts and / or structural diagrams provided by the embodiments of the present application. Specifically, each process and / or block in the method flow charts and / or structural diagrams, as well as the combination of processes and / or blocks in the flow charts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the steps in the process. Figure 1 Schematic diagram of one or more processes and / or structures Figure 1 These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing device to work in a specific way, so that the instructions stored in the computer-readable memory produce a product including the instruction device, which implements the function specified in the process. Figure 1 Schematic diagram of one or more processes and / or structures Figure 1 These computer program instructions can also be loaded onto a computer or other programmable data processing device, so that a series of operation steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the process. Figure 1 The flow or flows and / or structures illustrate the steps of the functions specified in one block or multiple blocks.

[0227] The above disclosure is only a preferred embodiment of the present application, and certainly cannot be used to limit the scope of rights of the present application. Therefore, equivalent changes made according to the claims of the present application are still within the scope covered by the present application.

Claims

1. A text display processing method, characterized in that: The method comprises: Obtaining long text data to be displayed, obtaining target text characters from the long text data, and obtaining a font cache library; the font cache library includes a mapping relationship between cached fonts and text characters, the mapping relationship being established based on the relationship between text characters in historical long text data and the cached fonts, the cached font being a display font used when displaying the text characters; Traversing the font cache library according to the target text characters and the mapping relationship; If a target cache font corresponding to the target text character is found in the font cache library, the target cache font is used as a target display font for rendering the target text character; If the target cache font corresponding to the target text character is not found in the font cache library, obtaining the character type to which the target text character belongs; If the character type to which the target text character belongs belongs to the first character type, a second default font library is obtained, and based on the font arrangement order in the second default font library, the font support relationship between the target text character and the second default font in the second default font library is detected in sequence, and the second default font whose font support relationship with the target text character is a support display relationship is determined as the target default font corresponding to the target text character, and the target default font is used as the target display font for rendering the target text character; the second default font library includes all fonts in the application system; If the character type to which the target text character belongs belongs to the second character type, a character mapping table in a third default font library is obtained; if there is a mapping relationship associated with the character type to which the target text character belongs in the character mapping table, the third default font that has a mapping relationship with the character type to which the target text character belongs is used as the target default font corresponding to the target text character, and the target default font is used as the target display font for rendering the target text character; the second character type is a character type among all character types except the first character type; the supported display relationship is used to characterize that the corresponding default font supports the display of the target text character; the character mapping table includes a mapping relationship between character types and the third default font.

2. The method according to claim 1, wherein The method further comprises: Obtain at least two first default fonts in a first default font library, and obtain the font priority of each first default font; the first default font library is a font library that has an initial association relationship with the application system; Based on the font priority, sequentially detecting font support relationships between the target text character and the at least two first default fonts; If a first default font whose font support relationship is the display support relationship exists in the first default font library, determining the first default font as the target default font corresponding to the target text character; If in the first default font library, the font support relationships between the at least two first default fonts and the target text character are all matching failure relationships, the process of obtaining the character type to which the target text character belongs is executed; the matching failure relationship is used to indicate that the corresponding default font does not support the display of the target text character.

3. The method according to claim 2, wherein The obtaining of the font priority of each first default font includes: The number of text characters supported by each first default font is obtained, the at least two first default fonts are sorted based on the number of text characters supported by each first default font, and the font priority of each first default font is determined according to the sorting result.

4. The method according to claim 2, wherein The detecting, based on the font priority, the font support relationship between the target text character and the at least two first default fonts in sequence includes: Obtain a font matching component, and based on the font priority, combine the target text character with the i-th first default font of the at least two first default fonts to form a to-be-matched element pair A. i ; i is a positive integer, i is less than or equal to the number of the at least two first default fonts; The element to be matched A i Input the font matching component, obtain the font matching component for the element to be matched A i The matching results; If the matching result is a successful matching result, the support display relationship is determined as a font support relationship between the target text character and the i-th first default font; If the matching result is a matching failure result, the matching failure relationship is determined as a font support relationship between the target text character and the i-th first default font.

5. The method according to claim 1, wherein The method further comprises: If there is no mapping relationship associated with the character type to which the target text character belongs in the character mapping table, the second default font library is obtained, and based on the font arrangement order in the second default font library, the font support relationship between the target text character and the second default font in the second default font library is detected in sequence, and the second default font whose font support relationship with the target text character is the support display relationship is determined as the target default font corresponding to the target text character.

6. The method according to claim 1, wherein The method further comprises: Acquire a historical display frequency of the character type, and if the historical display frequency is greater than a display frequency threshold, determine the character type as the first character type; If the historical display frequency is less than or equal to the display frequency threshold, the character type is determined to be the second character type.

7. The method according to claim 1, wherein The method further comprises: At least two second default fonts included in the second default font library are obtained, a historical usage count of each second default font is obtained, the at least two second default fonts are sorted based on the historical usage counts, and an arrangement order of the fonts in the second default font library is determined.

8. The method according to claim 1, wherein The method further comprises: A target mapping relationship between the target default font and the target text character is established, and the target mapping relationship is added to the font cache library.

9. The method according to claim 1, wherein The method further comprises: Acquire the historical long text data, traverse the historical long text data, and acquire the text characters included in the historical long text data and a display font for displaying the text characters; The usage frequencies of the display fonts are counted, the display font with the highest usage frequency is used as the cache font of the text character, a mapping relationship between the text character and the cache font is established, and the mapping relationship is stored in the font cache library.

10. The method according to claim 1, wherein The step of obtaining long text data to be displayed and obtaining target text characters from the long text data includes: Acquire long text data to be displayed, and acquire size information of a display area and a text display format; the size information includes a display width and a display height of the display area, and the text display format includes a display line spacing, a display format for the first character of a paragraph, and a display margin; determining the number of display rows in the display area according to the display height, the display margin, and the display row spacing; Determining the number of characters displayed in each line of the display area according to the display width, the display margin, and the first character display format of the paragraph; Based on the number of display lines and the number of characters displayed in each line, a text to be displayed is obtained from the long text data, and text characters in the text to be displayed are sequentially used as the target text characters.

11. The method according to claim 10, wherein The method further comprises: The first character display position is obtained in the display area, and the target text character is rendered in the display area according to the first character display position and the target display font; the first character display position is determined based on the size information, the display margin and the first character display format of the paragraph.

12. The method according to claim 11, wherein Rendering the target text character in the display area according to the first character display position and the target display font includes: Obtaining a text position of the target text character in the text to be displayed, and determining a target character display position of the target text character in the display area according to the first character display position and the text position; The target text character is rendered based on the target display font at the target character display position.

13. A text display processing device, characterized in that: The device comprises: an element acquisition module, configured to acquire long text data to be displayed, obtain target text characters from the long text data, and acquire a font cache library; the font cache library includes a mapping relationship between cached fonts and text characters, the mapping relationship being established by the relationship between text characters in the historical long text data and the cached fonts, the cached font being a display font used when displaying the text characters; A font traversal module, configured to traverse the font cache library according to the target text characters and the mapping relationship; a font determination module configured to, if a target cache font corresponding to the target text character is found in the font cache library, use the target cache font as a target display font for rendering the target text character; a font matching module, configured to obtain the character type of the target text character if the target cache font corresponding to the target text character is not found in the font cache library; The font matching module is further configured to, if the character type to which the target text character belongs is the first character type, obtain a second default font library, sequentially detect font support relationships between the target text character and second default fonts in the second default font library based on an arrangement order of fonts in the second default font library, determine the second default font having a font support relationship with the target text character as a display-supporting relationship as a target default font corresponding to the target text character, and use the target default font as a target display font for rendering the target text character; the second default font library includes all fonts in the application system; The font matching module is also used to obtain a character mapping table in a third default font library if the character type to which the target text character belongs belongs to a second character type; if there is a mapping relationship associated with the character type to which the target text character belongs in the character mapping table, then the third default font that has a mapping relationship with the character type to which the target text character belongs is used as the target default font corresponding to the target text character, and the target default font is used as the target display font for rendering the target text character; the second character type is a character type among all character types except the first character type; the support display relationship is used to represent that the corresponding default font supports the display of the target text character; the character mapping table includes a mapping relationship between character types and third default fonts.

14. A computer device, characterized in that: Includes processor, memory, input and output interfaces; The processor is connected to the memory and the input / output interface respectively, wherein the input / output interface is used to receive and output data, the memory is used to store program code, and the processor is used to call the program code to execute the method according to any one of claims 1 to 12.

15. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, wherein the computer program includes program instructions. When the program instructions are executed by a processor, the method according to any one of claims 1 to 12 is executed.

16. A computer program product, comprising computer instructions, wherein when the computer instructions are executed by a processor, the method according to any one of claims 1 to 12 is implemented.

Citation Information

Patent Citations

  • Image forming apparatus

    CN104284046A

  • Page display method and device for application program (APP), equipment and storage medium

    CN107704299A

  • Character-level font linking

    US20080079730A1