Text rendering method and device, electronic equipment and readable storage medium

By dividing the text to be rendered into multiple rendering tasks and processing it by the graphics processor and the central processor, the problem of low text display efficiency in electronic devices is solved, and text display is quickly displayed.

CN119987928APending Publication Date: 2025-05-13VIVO MOBILE COMM CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510146452.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-10
Publication Date
2025-05-13

AI Technical Summary

Technical Problem

When electronic devices display text, the central processor takes a long time to render, resulting in low text display efficiency.

Method used

The display text is generated by dividing the text to be rendered into multiple rendering tasks and processed by the graphics processor and the central processor separately.

Benefits of technology

By processing rendering tasks simultaneously by multiple units, the processing time is significantly reduced and the efficiency of text display is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119987928A_ABST
    Figure CN119987928A_ABST
Patent Text Reader

Abstract

The invention discloses a text rendering method and device, electronic equipment and a readable storage medium, and belongs to the technical field of display. The text rendering method provided by the embodiment of the invention comprises the following steps: the electronic equipment can divide a to-be-rendered text into a plurality of rendering tasks, wherein the plurality of rendering tasks comprise a first rendering task and a second rendering task; controlling a graphics processor and a central processor to respectively process the first rendering task and the second rendering task to obtain rendering results; and generating a display text according to the rendering result.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of display technology, and specifically relates to a text rendering method, device, electronic device and readable storage medium. Background Art

[0002] Typically, in a scenario where an electronic device displays text, the electronic device may first obtain each character in the text, render each character to obtain a rendering result, and control a central processing unit (CPU) to display the text based on the rendering result.

[0003] However, since there may be a large number of characters in the above text, the central processing unit may need a long time to render each character and obtain the rendering result. Therefore, the electronic device may need to wait for a long time before controlling the central processing unit to display the text based on the rendering result, thus resulting in low text display efficiency of the electronic device. Summary of the invention

[0004] The purpose of the embodiments of the present application is to provide a text rendering method, device, electronic device and readable storage medium, which can solve the problem of low text display efficiency of electronic devices.

[0005] In a first aspect, an embodiment of the present application provides a text rendering method, the method comprising: dividing the text to be rendered into multiple rendering tasks, the multiple rendering tasks including a first rendering task and a second rendering task; controlling a graphics processor and separately processing the first rendering task and the second rendering task to obtain rendering results; and generating display text according to the rendering results.

[0006] In a second aspect, an embodiment of the present application provides a text rendering device, which includes: a segmentation module, a control module, and a generation module. Among them, the segmentation module is used to segment the text to be rendered into multiple rendering tasks, and the multiple rendering tasks include a first rendering task and a second rendering task. The control module is used to control the graphics processor and the central processing unit to respectively process the first rendering task and the second rendering task among the multiple rendering tasks segmented by the segmentation module to obtain rendering results. The generation module is used to generate display text according to the rendering results.

[0007] In a third aspect, an embodiment of the present application provides an electronic device, which includes a processor and a memory, wherein the memory stores programs or instructions that can be executed on the processor, and when the programs or instructions are executed by the processor, the steps of the method of the first aspect are implemented.

[0008] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, the steps of the method of the first aspect are implemented.

[0009] In a fifth aspect, an embodiment of the present application provides a chip, the chip including a processor and a communication interface, the communication interface and the processor are coupled, and the processor is used to run programs or instructions to implement the steps of the method of the first aspect.

[0010] In a sixth aspect, an embodiment of the present application provides a computer program product, which is stored in a storage medium and is executed by at least one processor to implement the steps of the method of the first aspect.

[0011] In an embodiment of the present application, the electronic device can divide the text to be rendered into multiple rendering tasks, and control the graphics processor and the central processing unit to respectively process the first rendering task and the second rendering task in the multiple rendering tasks to obtain rendering results, so that the electronic device can generate display text according to the rendering results. Since the electronic device can first divide the rendering task of the text to be rendered into multiple rendering tasks, and respectively process the first rendering task and the second rendering task in the multiple rendering tasks through the graphics processor and the central processing unit, that is, the first rendering task and the second rendering task are processed by multiple units at the same time, instead of processing the first rendering task and the second rendering task by one unit (such as a central processing unit), the electronic device only needs a short time to complete the processing of the first rendering task and the second rendering task, obtain the rendering results, and generate display text according to the rendering results, so that the electronic device can quickly display the display text, thus improving the text display efficiency of the electronic device. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] Figure 1 This is one of the flowcharts of the text rendering method provided in the embodiment of the present application;

[0013] Figure 2 This is the second flowchart of the text rendering method provided in the embodiment of the present application;

[0014] Figure 3 This is the third flowchart of the text rendering method provided in the embodiment of the present application;

[0015] Figure 4 This is the fourth flowchart of the text rendering method provided in the embodiment of the present application;

[0016] Figure 5 This is the fifth flowchart of the text rendering method provided in the embodiment of the present application;

[0017] Figure 6is a structural schematic diagram of a text rendering device provided in an embodiment of the present application;

[0018] Figure 7 This is one of the hardware structure diagrams of the electronic device provided in the embodiment of the present application;

[0019] Figure 8 This is the second schematic diagram of the hardware structure of the electronic device provided in the embodiment of the present application. DETAILED DESCRIPTION

[0020] The following will be combined with the drawings in the embodiments of the present application to clearly describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the present application belong to the scope of protection of this application.

[0021] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.

[0022] The terms "at least one (item)", "at least one of" and the like in the specification and claims of the present application refer to any one, any two or a combination of more than two of the objects included therein. For example, at least one (item) of a, b, and c can be represented by: "a", "b", "c", "a and b", "a and c", "b and c" and "a, b and c", where a, b, and c can be single or multiple. Similarly, "at least two (items)" refers to two or more, and its meaning is similar to that of "at least one (item)".

[0023] The text rendering method, device, electronic device and readable storage medium provided in the embodiments of the present application are described in detail below with reference to the accompanying drawings through specific embodiments and their application scenarios.

[0024] In modern computing devices, text rendering is one of the core functions of graphical user interfaces and text display. Traditional text rendering usually relies on the central processing unit for calculation and processing. However, with the increase in graphics processing requirements, relying solely on the central processing unit for text rendering may lead to performance bottlenecks, especially when processing long text or complex vector text. The central processing unit may take a long time to render each character of the text. Therefore, the electronic device may need to wait for a long time before controlling the central processing unit to display the text, which results in low efficiency in displaying text in the electronic device.

[0025] However, in an embodiment of the present application, the electronic device can divide the text to be rendered into multiple rendering tasks, and control the graphics processing unit (GPU) and the central processing unit to respectively process the first rendering task and the second rendering task in the multiple rendering tasks to obtain rendering results, so that the electronic device can generate display text according to the rendering results. Since the electronic device can first divide the rendering task of the text to be rendered into multiple rendering tasks, and respectively process the first rendering task and the second rendering task in the multiple rendering tasks through the graphics processing unit and the central processing unit, that is, the first rendering task and the second rendering task are processed by multiple units at the same time, instead of processing the first rendering task and the second rendering task by one unit (such as the central processing unit), the electronic device only needs a short time to complete the processing of the first rendering task and the second rendering task, obtain the rendering results, and generate the display text according to the rendering results, so that the electronic device can quickly display the display text, thus improving the text display efficiency of the electronic device.

[0026] In the embodiment of the present application, the execution subject of the above text rendering method can be a text rendering device, or an electronic device, or a functional module in an electronic device. The text rendering method provided in the embodiment of the present application is described below using an electronic device as an example.

[0027] Figure 1 FIG. 1 is a flowchart of a text rendering method provided by an embodiment of the present application. Figure 1 As shown, the text rendering method provided in the embodiment of the present application may include the following steps 101 to 103.

[0028] Step 101: The electronic device divides the text to be rendered into multiple rendering tasks.

[0029] In some embodiments of the present application, the text to be rendered may include at least one of the following: text to be displayed in a page, and text input by a user.

[0030] In some embodiments of the present application, the above-mentioned text to be rendered includes at least two characters to be rendered, wherein each of the at least two characters to be rendered can be any of the following: Chinese characters, foreign characters, numeric characters, special characters, etc.

[0031] In some embodiments of the present application, the above-mentioned multiple rendering tasks may be tasks for rendering at least two characters to be rendered.

[0032] In some examples, some of the rendering tasks among the plurality of rendering tasks may be tasks for rendering different characters to be rendered among the at least two characters to be rendered.

[0033] For example, assuming that at least two characters to be rendered include character 1 to be rendered, character 2 to be rendered, character 3 to be rendered, and character 4 to be rendered, the multiple rendering tasks may include rendering task 1, rendering task 2, rendering task 3, and rendering task 4, then the rendering task 1 may be a task for rendering character 1 to be rendered, the rendering task 2 may be a task for rendering character 2 to be rendered, the rendering task 3 may be a task for rendering character 3 to be rendered, and the rendering task 4 may be a task for rendering character 4 to be rendered.

[0034] In some examples, some of the rendering tasks in the above-mentioned multiple rendering tasks may be tasks for rendering the same character to be rendered in at least two characters to be rendered with different task types. The task type may include at least one of the following: vector path filling type, anti-aliasing processing type, vector text parsing type, and path calculation type. Of course, the task type may also include other types, which are not limited in the embodiments of the present application.

[0035] For example, assuming that at least two characters to be rendered include character 1 to be rendered and character 2 to be rendered, the multiple rendering tasks may include rendering task 1 and rendering task 2, then rendering task 1 is a task of performing vector path filling type on character 1 to be rendered and character 2 to be rendered, and rendering task 2 is a task of performing vector text parsing type on character 1 to be rendered and character 2 to be rendered.

[0036] In the embodiment of the present application, the above-mentioned multiple rendering tasks include a first rendering task and a second rendering task.

[0037] It can be understood that the first rendering task and the second rendering task are at least part of the rendering tasks among the multiple rendering tasks.

[0038] In some embodiments of the present application, when an electronic device needs to display text, the central processor of the electronic device can obtain the text to be rendered corresponding to the text, so that the electronic device can divide the rendering task of the text to be rendered into multiple rendering tasks.

[0039] The following will take the example of an electronic device dividing a rendering task of a text to be rendered into a first rendering task and a second rendering task to illustrate a specific solution of the electronic device dividing the text to be rendered into multiple rendering tasks.

[0040] In some embodiments of the present application, Figure 1 ,like Figure 2 As shown, the above step 101 can be specifically implemented through the following steps 101a and 101b.

[0041] Step 101a: The electronic device determines a first part of characters to be rendered and a second part of characters to be rendered from characters to be rendered in the text to be rendered.

[0042] In some embodiments of the present application, the electronic device may determine the first part of characters to be rendered and the second part of characters to be rendered from the characters to be rendered in the text to be rendered according to a target factor, wherein the target factor may include at least one of the following: text length, rendering complexity, data reading time, task type, etc.

[0043] The following will take the target factor as an example to illustrate a specific solution for the electronic device to determine the first part of characters to be rendered and the second part of characters to be rendered from the characters to be rendered in the text to be rendered.

[0044] Example 1: The target factor includes text length.

[0045] In some embodiments of the present application, the above step 101a can be specifically implemented through the following step 101a1.

[0046] Step 101a1: The electronic device divides the characters to be rendered in the text to be rendered into a first part of characters to be rendered and a second part of characters to be rendered according to the first quantity.

[0047] In the embodiment of the present application, the first number is the number of characters to be rendered, or the number of rows of characters to be rendered.

[0048] In some embodiments of the present application, the first number may be a preset positive integer. For example, the first number may be 1. Of course, the first number may also be other preset positive integers, which are not limited in the embodiments of the present application.

[0049] In some embodiments of the present application, in the case where the first number is the number of characters to be rendered, assuming that the first number is L, the electronic device will render the first to the second characters to be rendered in the text to be rendered. The characters to be rendered are divided into the first part of characters to be rendered, and the The characters to be rendered from the first to the Lth are divided into the second part of characters to be rendered; L is a positive integer.

[0050] In the embodiment of the present application, since the rendering complexity of each character to be rendered may differ slightly, after the characters to be rendered in the text to be rendered are divided equally into a first part of characters to be rendered and a second part of characters to be rendered according to the number of characters to be rendered, the rendering complexity of the first part of characters to be rendered and the rendering complexity of the second part of characters to be rendered may also differ slightly. Therefore, it can be ensured that the time consumed by the graphics processor and the central processing unit to process the first part of characters to be rendered and the second part of characters to be rendered, respectively, differ slightly.

[0051] In some embodiments of the present application, in the case where the first number is the number of lines of characters to be rendered, assuming that the first number is T, the electronic device can store the characters to be rendered from the first line to the first line in the text to be rendered. The characters to be rendered in the line are divided into the first part of the characters to be rendered, and the The characters to be rendered in the row to the Tth row are divided into the second part of characters to be rendered; T is a positive integer.

[0052] In the embodiment of the present application, since there is a high probability that some identical characters to be rendered may exist in a line of characters to be rendered, the characters to be rendered in the text to be rendered can be divided equally into a first part of characters to be rendered and a second part of characters to be rendered according to the number of lines of characters to be rendered, so that the graphics processor and the central processing unit can quickly render the first part of characters to be rendered and the second part of characters to be rendered.

[0053] Thus, it can be known that, since the electronic device can divide the characters to be rendered in the text to be rendered into the first part of the characters to be rendered and the second part of the characters to be rendered according to the number of characters to be rendered, on the one hand, the complexity of dividing the characters to be rendered can be reduced, and therefore, the time consumption of dividing the characters to be rendered can be reduced; on the other hand, the rendering complexity of the first part of the characters to be rendered and the rendering complexity of the second part of the characters to be rendered can also be relatively small, so that it can be ensured that the time consumption of the graphics processor and the central processing unit to process the first part of the characters to be rendered and the second part of the characters to be rendered respectively is relatively small, so that the graphics processor and the central processing unit can complete the rendering in a relatively small time, thereby reducing the waiting time required to display the text. Alternatively, since the electronic device can divide the characters to be rendered in the text to be rendered into the first part of the characters to be rendered and the second part of the characters to be rendered according to the number of lines of characters to be rendered, on the one hand, the complexity of dividing the characters to be rendered can be reduced, and therefore, the time consumption of dividing the characters to be rendered can be reduced; on the other hand, the graphics processor and the central processing unit can quickly render the first part of the characters to be rendered and the second part of the characters to be rendered, thereby reducing the waiting time required to render the characters to be rendered. In this way, the text display efficiency of the electronic device can be improved.

[0054] Example 2: The target factor includes at least one of the following: rendering complexity, and time consumption of reading data required for the rendering task.

[0055] In some embodiments of the present application, the above step 101a can be specifically implemented through the following steps 101a2 to 101a4.

[0056] Step 101a2: The electronic device determines processing parameters corresponding to each character to be rendered.

[0057] In the embodiment of the present application, each processing parameter is used to indicate at least one of the following: the amount of calculation required to render the corresponding character to be rendered, and the time required to read the vector path data of the corresponding character to be rendered from the font library.

[0058] In some embodiments of the present application, when each processing parameter is used to indicate the amount of calculation for rendering the corresponding character to be rendered, the electronic device may first read the vector path data of each character to be rendered from the character library, and then use a preset correspondence relationship to determine each processing parameter corresponding to the vector path data of each character to be rendered. The preset correspondence relationship is a correspondence relationship between the path data and the processing parameter.

[0059] Wherein, the format of the above-mentioned font library can be Freetype, and the above-mentioned vector path data can include at least one of the following: the number of move to, the number of line to, the number of conic to, and the number of cubic to. Wherein, the move to is used to indicate the operation of moving the pen to a certain place when drawing a character, the line to is used to indicate the operation of writing the pen to a certain place when drawing a character, the conic to is used to indicate the operation of drawing a quadratic Bezier curve, and the cubic to is used to indicate the operation of drawing a cubic Bezier curve. The calculation amount of the cubic to>the calculation amount of the conic to>the calculation amount of the line to>=the calculation amount of the move to. Of course, the format of the font library can also be other formats, for example, the format of the font library can be TrueTyep or vector font, etc., and the vector path data can also be other data, for example, the vector path data can include font outline description information, character displacement information, character measurement information, etc., and the embodiments of the present application are not limited to this.

[0060] In some embodiments of the present application, the calculation amount of each operation in the above-mentioned move to, line to, conic to and cubic to can be pre-calculated, and a corresponding relationship between each operation and the calculation amount of each operation can be established to obtain a preset corresponding relationship, so that the electronic device can determine each corresponding processing parameter according to the vector path data of each character to be rendered.

[0061] For example, assuming that the above-mentioned characters to be rendered include a character A to be rendered, the electronic device can read the vector path data of the character A to be rendered from the font library, for example, the number of move to is 1, the number of line to is 2, the number of conic to is 10, and the number of cubic to is 0. Then the electronic device can obtain the preset corresponding relationship, and determine according to the preset corresponding relationship that the calculation amount for rendering the character A to be rendered corresponding to the number of move to being 1 is 2 processing units, according to the preset corresponding relationship, the calculation amount for rendering the character A to be rendered corresponding to the number of line to being 2 is 5 processing units, according to the preset corresponding relationship, the calculation amount for rendering the character A to be rendered corresponding to the number of conic to being 10 is 40 processing units, and the electronic device can determine that the processing parameter corresponding to the character A to be rendered is 47, and the 47 is used to indicate that the calculation amount for rendering the character A to be rendered is 47 processing units.

[0062] In the embodiment of the present application, the vector path data of the above-mentioned character to be rendered is: data required to execute the rendering task corresponding to the character to be rendered.

[0063] It can be understood that the longer it takes to read the quantitative path data of a character to be rendered from the font library, the longer the waiting time before executing the rendering task corresponding to the character to be rendered, and the longer the total time to complete the rendering task corresponding to the character to be rendered.

[0064] In some embodiments of the present application, when each processing parameter is used to indicate the time consumed to read the corresponding vector path data of the character to be rendered from the font library, the electronic device can directly count the time consumed to read the vector path data of each character to be rendered from the font library to obtain each processing parameter.

[0065] For example, assuming that the above characters to be rendered include a character B to be rendered, so that the electronic device can read the vector path data of the character B to be rendered from the font library, for example, the number of move to is 2, the number of line to is 1, the number of conic to is 5, and the number of cubic to is 0. Then the electronic device can count that the time consumed to read the number of move to from the font library is 2 time units, the time consumed to read the number of line to from the font library is 1 time unit, and the time consumed to read the number of conic to from the font library is 4 time units, so that the processing parameter corresponding to the character B to be rendered can be obtained as 7, and the 7 is used to indicate that the time consumed to read the vector path data of the character B to be rendered is 7 time units.

[0066] Step 101a3: The electronic device determines the characters to be rendered that do not meet the first condition as the first part of characters to be rendered.

[0067] In the embodiment of the present application, the first condition is that the parameter value of the processing parameter is less than the parameter value threshold.

[0068] It can be understood that the electronic device can determine the characters to be rendered whose parameter values ​​of the processing parameters are greater than or equal to the parameter value threshold as the first part of the characters to be rendered, that is, the electronic device can determine the characters to be rendered whose parameter values ​​of the processing parameters are greater than or equal to the parameter value threshold as the characters to be rendered by the first rendering task (i.e., the characters processed by the graphics processor).

[0069] In some embodiments of the present application, the parameter value threshold may be a preset positive integer. For example, the parameter value threshold may be 40. Of course, the parameter value threshold may also be other positive integers, which is not limited in the embodiments of the present application.

[0070] Step 101a4: The electronic device determines the characters to be rendered that meet the first condition as the second part of characters to be rendered.

[0071] It can be understood that the electronic device can determine the characters to be rendered whose parameter values ​​of the processing parameters are less than the parameter value threshold as the second part of the characters to be rendered. That is, the electronic device can determine the characters to be rendered whose parameter values ​​of the processing parameters are less than the parameter value threshold as the characters to be rendered by the second rendering task (i.e., the characters processed by the central processing unit).

[0072] It can be seen that since the rendering computing capabilities of the graphics processor and the central processing unit are different, for example, the rendering computing capability of the graphics processor may be greater than the rendering computing capability of the central processing unit, the electronic device can determine the processing parameters corresponding to each character to be rendered to determine the computing amount for rendering each character to be rendered, and based on the size relationship between the parameter value of the processing parameter and the parameter value threshold, a class of characters to be rendered with a larger rendering computing amount is divided into a first part of characters to be rendered, and a class of characters to be rendered with a smaller rendering computing amount is divided into a second part of characters to be rendered. In this way, in subsequent steps, the graphics processor can process the rendering task of the class of characters to be rendered with a larger rendering computing amount, and the central processing unit can process the rendering task of the class of characters to be rendered with a smaller rendering computing amount. Therefore, The graphics processor and the central processing unit can complete the rendering tasks at a similar time; and / or, the electronic device can determine the processing parameters corresponding to each character to be rendered to determine the time consumed to read the vector path data of each character to be rendered, and based on the size relationship between the parameter value of the processing parameter and the parameter value threshold, divide a type of characters to be rendered that consumes more time into a first part of characters to be rendered, and divide a type of characters to be rendered that consumes less time into a second part of characters to be rendered. In this way, in subsequent steps, the graphics processor can process the first rendering task later, and the central processing unit can process the second rendering task earlier. Therefore, the graphics processor and the central processing unit can complete the rendering tasks at a similar time; thereby reducing the waiting time required to display text, and thus improving the text display efficiency of the electronic device.

[0073] Example 3: Target factors include task type.

[0074] In some embodiments of the present application, the above step 101a can be specifically implemented through the following steps 101a5 to 101a7.

[0075] Step 101a5: The electronic device determines the task type of each sub-rendering task of each character to be rendered.

[0076] In some embodiments of the present application, the electronic device may obtain, through a central processor, the task type of each sub-rendering task of each character to be rendered.

[0077] The task types of the sub-rendering tasks of different characters to be rendered may be different.

[0078] Step 101a6: The electronic device determines the characters to be rendered corresponding to the sub-rendering tasks whose task types match the first preset type as the first part of the characters to be rendered.

[0079] In the embodiment of the present application, the first preset type includes at least one of the following: a vector path filling type and an anti-aliasing processing type.

[0080] In an embodiment of the present application, since the graphics processor is more efficient in processing sub-rendering tasks of vector path filling type and anti-aliasing processing type, the electronic device can determine the characters to be rendered whose task type matches the first preset type (i.e., at least one of the vector path filling type and the anti-aliasing processing type) as the first part of the characters to be rendered.

[0081] Step 101a7: The electronic device determines the characters to be rendered corresponding to the sub-rendering tasks whose task types match the second preset type as the second part of characters to be rendered.

[0082] In the embodiment of the present application, the second preset type includes at least one of the following: a vector text parsing type and a path calculation type.

[0083] In some embodiments of the present application, at least some of the characters in the second part of characters to be rendered and the first part of characters to be rendered may be the same, or the characters in the second part of characters to be rendered and the first part of characters to be rendered may be completely different.

[0084] In an embodiment of the present application, since the central processing unit is more efficient in processing sub-rendering tasks of vector text parsing type and path calculation type, the electronic device can determine the characters to be rendered whose task type matches the second preset type (i.e., at least one of the vector text parsing type and the path calculation type) as the second part of the characters to be rendered.

[0085] It can be seen that since the graphics processor is more efficient in processing sub-rendering tasks of vector path filling type and anti-aliasing processing type, and the central processing unit is more efficient in processing sub-rendering tasks of vector text parsing type and path calculation type, the electronic device can determine the characters to be rendered corresponding to the sub-rendering tasks of processing at least one of the vector path filling type and anti-aliasing processing type as the first part of the characters to be rendered, so that in subsequent steps, the graphics processor can quickly process the sub-rendering task; and the electronic device can determine the characters to be rendered corresponding to the sub-rendering tasks of at least one of the vector text parsing type and path calculation type as the second part of the characters to be rendered, so that in subsequent steps, the central processing unit can quickly process the sub-rendering task; in this way, the efficiency of the graphics processor and the central processing unit in processing rendering tasks can be improved to improve the text display efficiency of the electronic device.

[0086] It should be noted that the above three examples can be combined according to the specific content included in the target factors. For example, when the target factors include text length, rendering complexity, rendering time, and task type, the electronic device can respectively execute the steps in Example 1, Example 2, and Example 3 to divide at least two characters to be rendered into a first part of characters to be rendered and a second part of characters to be rendered. For example, the electronic device can first execute the steps in Example 1 to divide at least two characters to be rendered into a first part of characters to be rendered and a second part of characters to be rendered, and then respectively execute the steps in Example 2 and Example 3 to adjust the characters included in the first part of characters to be rendered and the second part of characters to be rendered. The embodiments of the present application will not be repeated here.

[0087] Step 101b: The electronic device determines the first part of the characters to be rendered as the characters to be rendered by the first rendering task, and determines the second part of the characters to be rendered as the characters to be rendered by the second rendering task.

[0088] It can be seen that since the electronic device divides the characters to be rendered in the text to be rendered into a first part of characters to be rendered and a second part of characters to be rendered, and determines the first part of characters to be rendered as the characters to be rendered by the first rendering task, and determines the second part of characters to be rendered as the characters to be rendered by the second rendering task, in the subsequent steps, the graphics processor and the central processing unit can accurately process the first rendering task and the second rendering task, thereby reducing the situation where the graphics processor and the central processing unit are unable to render the characters to be rendered.

[0089] Of course, when the first part of characters to be rendered and the second part of characters to be rendered are determined, the electronic device may also adjust the characters included in the first part of characters to be rendered and the second part of characters to be rendered according to requirements, which will be described below with examples.

[0090] In some embodiments of the present application, Figure 2 ,like Figure 3 As shown, before the above step 101b, the text rendering method provided by the embodiment of the present application may further include the following steps 201 and 202.

[0091] Step 201: The electronic device determines a first time and a second time.

[0092] In the embodiment of the present application, the first time mentioned above is the time required for the graphics processor to process the first rendering task, and the second time mentioned above is the time required for the central processing unit to process the second rendering task.

[0093] In some embodiments of the present application, a plurality of predetermined correspondences are stored in an electronic device, the plurality of predetermined correspondences including a first predetermined correspondence and a second predetermined correspondence, the first predetermined correspondence being a correspondence between a graphics processor and the time required for the graphics processor to complete a rendering operation of a rendering task, the second predetermined correspondence being a correspondence between a central processing unit and the time required for the central processing unit to complete a rendering operation of a rendering task, so that the electronic device can read the number of each rendering operation for rendering the first part of the characters to be rendered from the character library, and use the first predetermined correspondence to determine the time required for the graphics processor to process the first rendering task, and can read the number of each rendering operation for rendering the second part of the characters to be rendered from the character library, and use the second predetermined correspondence to determine the time required for the graphics processor to process the second rendering task.

[0094] For example, during product development, the rendering computing capabilities of the graphics processor and the central processing unit can be tested in advance to obtain a first predetermined corresponding relationship (e.g., predetermined corresponding relationship 1) and a second predetermined corresponding relationship (e.g., predetermined corresponding relationship 2). The predetermined corresponding relationship 1 includes: cubic to corresponds to 7 time units (which can be understood as the graphics processor needs 7 time units to execute cubic to), conic to corresponds to 5 time units (which can be understood as the graphics processor needs 5 time units to execute conic to), line to corresponds to 3 time units (which can be understood as the graphics processor needs 3 time units to execute lineto), and move to corresponds to 3 time units (which can be understood as the graphics processor needs 3 time units to execute move to). The predetermined corresponding relationship 2 includes: cubic to corresponds to 15 time units (which can be understood as the central processing unit needs 15 time units to execute cubic to), conic to corresponds to 13 time units (which can be understood as the central processing unit needs 13 time units to execute conic to), line to corresponds to 5 time units (which can be understood as the central processing unit needs 5 time units to execute line to), move to requires 4 time units (it can be understood that the CPU needs 4 time units to execute moveto).

[0095] Then, when the electronic device renders the text to be rendered "I am a person from country A, and I love to eat rice", the character to be rendered "I am a person from country A" can be determined as the first part of the characters to be rendered, and the character to be rendered ", I love to eat rice." can be determined as the second part of the characters to be rendered. Then, the electronic device can read the number of each rendering operation (such as move to, line to, conic to, and cubic to) for rendering each character to be rendered from the character library. The number of each rendering operation for rendering each character to be rendered is shown in Table 1.

[0096] Table 1

[0097] Characters to be rendered moveto quantity lineto quantity cubicto quantity Number of conicto I 2 31 0 32 yes 4 29 0 8 one 1 4 0 0 indivual 2 7 0 7 A 3 24 0 0 country 4 40 0 0 people 1 4 0 11 , 1 2 0 10 like 4 35 0 24 eat 2 24 0 20 rice 3 18 0 13 meal 1 24 0 27 。 2 0 0 20

[0098] Among them, the number of move tos for rendering the first character to be rendered is 2, the number of line tos is 31, the number of cubic tos is 0, and the number of conic tos is 32. The number of move tos for rendering the second character to be rendered is 4, the number of line tos is 29, the number of cubic tos is 0, and the number of conic tos is 8. The number of move tos for rendering the third character to be rendered is 1, the number of line tos is 4, the number of cubic tos is 0, and the number of conic tos is 0. The number of move tos for rendering the fourth character to be rendered is 2, the number of line tos is 7, the number of cubic tos is 0, and the number of conic tos is 7. The number of move tos for rendering the fifth character to be rendered is 3, the number of line tos is 24, the number of cubic tos is 0, and the number of conic tos is 0. The number of move tos for rendering the sixth character to be rendered is 4, the number of line tos is 40, the number of cubic tos is 0, and the number of conic tos is 0. The number of move tos for rendering the seventh character to be rendered is 1, the number of line tos is 4, and the number of cubic tos is 0. The number of move tos for rendering the eighth character to be rendered is 1, the number of line tos is 2, the number of cubic tos is 0, and the number of conic tos is 10. The number of move tos for rendering the ninth character to be rendered is 4, the number of line tos is 35, the number of cubic tos is 0, and the number of conic tos is 24. The number of move tos for rendering the tenth character to be rendered is 2, the number of line tos is 24, the number of cubic tos is 0, and the number of conic tos is 20. The number of move tos for rendering the eleventh character to be rendered is 3, the number of line tos is 18, the number of cubic tos is 0, and the number of conic tos is 13. The number of move tos for rendering the twelfth character to be rendered is 1, the number of line tos is 24, the number of cubic tos is 0, and the number of conic tos is 27. The number of move tos for rendering the thirteenth character to be rendered is 2, the number of line tos is 0, the number of cubic tos is 0, and the number of conic tos is 20.

[0099] In this way, the electronic device can calculate the first time (i.e., 17×3 time units + 139×3 time units + 0×7 time units + 58×5 time units = 758 time units) based on the total number of move tos (i.e., 17), the total number of line tos (i.e., 139), the total number of cubic tos (i.e., 0), and the total number of conic tos (i.e., 58) of the characters to be rendered “I am a person from country A” and the above-mentioned predetermined correspondence 1.

[0100] And the electronic device can calculate the second time (i.e., 13×4 time units+103×5 time units+0×15 time units+114×13 time units=2049 time units) according to the total number of move tos (i.e., 13), the total number of linetos (i.e., 103), the total number of cubic tos (i.e., 0), and the total number of conic tos (i.e., 114) of the character to be rendered ", love to eat rice." and the predetermined correspondence 2.

[0101] Step 202: The electronic device adjusts the characters to be rendered included in the first part of the characters to be rendered and the second part of the characters to be rendered respectively based on the first time and the second time.

[0102] In the embodiment of the present application, after adjustment, the time required by the graphics processor to process the first rendering task matches the time required by the central processing unit to process the second rendering task.

[0103] It can be understood that after adjustment, the time required for the graphics processor to process the first rendering task is the same as the time required for the central processor to process the second rendering task, or the difference between the two is less than or equal to the preset time.

[0104] In some embodiments of the present application, the electronic device may first determine the larger time between the first time and the second time, and then adjust the character to be rendered that takes the longest time to process among the part of characters to be rendered corresponding to the one time to the part of characters to be rendered corresponding to the other time, and execute the above steps 201 and 202 again, and so on, until the calculated first time and the second time match.

[0105] For example, assuming that the second time (e.g., 2049 time units) is greater than the first time (e.g., 758 time units), the electronic device can adjust the character to be rendered that takes the longest time to process in the second part of the characters to be rendered corresponding to the second time (e.g., the character "love") to the first part of the characters to be rendered corresponding to the first time, and calculate the first time and the second time again, and so on.

[0106] Thus, it can be known that since the electronic device can determine the first time and the second time to know the time required for the graphics processor and the central processing unit to respectively complete the first rendering task and the second rendering task (i.e., the first time and the second time), the electronic device can accurately adjust the characters to be rendered included in the first part of the characters to be rendered and the second part of the characters to be rendered based on the first time and the second time, so that the time required for the graphics processor and the central processing unit to respectively complete the first rendering task and the second rendering task matches, thereby reducing the situation in which a long waiting time is required to obtain the rendering result due to a long time required for the graphics processor or the central processing unit to complete the rendering task, thereby reducing the time consumed in displaying text.

[0107] Of course, the electronic device may also adjust the characters to be rendered included in the first part of characters to be rendered and the second part of characters to be rendered according to the processing conditions of the graphics processor and the central processor, as will be described below with examples.

[0108] In some embodiments of the present application, after the above step 202, the text rendering method provided by the embodiment of the present application may further include the following steps 203 and 204.

[0109] Step 203: The electronic device obtains the first information and the second information.

[0110] In some embodiments of the present application, the electronic device may obtain the first information and the second information during the process in which the graphics processor and the central processor respectively process the first rendering task and the second rendering task.

[0111] In the embodiment of the present application, the first information is used to indicate at least one of the following: the processing capability of the graphics processor and the load condition of the graphics processor, and the second information is used to indicate at least one of the following: the processing capability of the central processing unit and the load condition of the central processing unit.

[0112] In some embodiments of the present application, when the first information indicates the processing capability of a graphics processor, the first information may include at least one of the following: model information of the graphics processor, operating frequency of the graphics processor, etc. When the second information indicates the processing capability of a central processing unit, the second information may include at least one of the following: model information of the central processing unit, operating frequency of the central processing unit, etc.

[0113] In some embodiments of the present application, when the first information indicates the load condition of the graphics processor, the first information may include at least one of the following: the usage rate of the graphics processor; the number of tasks processed by the graphics processor, etc. When the second information indicates the load condition of the central processing unit, the second information may include at least one of the following: the usage rate of the central processing unit; the number of tasks processed by the central processing unit, etc.

[0114] Step 204: The electronic device adjusts the characters to be rendered included in the first part of characters to be rendered and the second part of characters to be rendered according to the first information and the second information respectively.

[0115] In some embodiments of the present application, the electronic device may first determine the larger one of the first information and the second information, and then adjust the character to be rendered that takes the longest time to process among the partial characters to be rendered corresponding to the one information to the partial characters to be rendered corresponding to the other information.

[0116] Thus, it can be known that, after the electronic device determines the characters to be rendered by the first rendering task and the second rendering task, the electronic device can also flexibly adjust the characters to be rendered included in the first part of the characters to be rendered and the second part of the characters to be rendered according to at least one of the processing capabilities of the graphics processor and the central processing unit and the load conditions of the graphics processor and the central processing unit. Therefore, it is possible to reduce the situation where the graphics processor (or central processing unit) is unable to complete the rendering task in time due to insufficient processing capabilities and / or high load of the graphics processor (or central processing unit), thereby reducing the situation where the graphics processor (or central processing unit) takes a long time to process the rendering task, resulting in a long waiting time for obtaining the rendering result, thereby reducing the time taken to display text.

[0117] In some embodiments of the present application, after the above step 202, the text rendering method provided by the embodiment of the present application may further include the following step 205.

[0118] Step 205: The electronic device determines the adjusted first part of characters to be rendered as characters to be rendered by the first rendering task, and determines the adjusted second part of characters to be rendered as characters to be rendered by the second rendering task.

[0119] As can be seen, since the electronic device can also determine the adjusted first part of characters to be rendered and the second part of characters to be rendered as characters to be rendered by the first rendering task and the second rendering task respectively, the flexibility of the electronic device rendering can be improved.

[0120] Step 102: The electronic device controls the graphics processor and the central processor to process the first rendering task and the second rendering task respectively to obtain rendering results.

[0121] In some embodiments of the present application, the above rendering result may be a vector text image.

[0122] In some embodiments of the present application, the electronic device may control the graphics processor to process the first rendering task, and control the central processing unit to process the second rendering task. Alternatively, the electronic device may control the graphics processor to process a portion of the sub-rendering tasks in the first rendering task and the second rendering task, and control the central processing unit to process another portion of the sub-rendering tasks in the first rendering task and the second rendering task.

[0123] In some embodiments of the present application, Figure 1 ,like Figure 4 As shown, the above step 102 can be specifically implemented through the following steps 102a and 102b.

[0124] Step 102a: The electronic device controls the graphics processor and the central processor to process the first rendering task and the second rendering task respectively to obtain a first bitmap and a second bitmap.

[0125] In some embodiments of the present application, the electronic device may control the graphics processor to process the first rendering task to obtain the first bitmap, and control the central processing unit to process the second rendering task to obtain the second bitmap. Alternatively, the electronic device may control the graphics processor to process a portion of the sub-rendering tasks in the first rendering task and the second rendering task to obtain the first bitmap, and control the central processing unit to process another portion of the sub-rendering tasks in the first rendering task and the second rendering task to obtain the second bitmap.

[0126] In some embodiments of the present application, the above step 102a can be specifically implemented through the following steps 102a1 and 102a2.

[0127] Step 102a1: the electronic device controls the central processor to determine the first vector path of the character to be rendered based on the first vector path data of the character to be rendered by the first rendering task or the second rendering task, and stores the first vector path in the first memory.

[0128] In the embodiment of the present application, the first memory is a shared memory of the graphics processor and the central processing unit.

[0129] In some embodiments of the present application, the electronic device may first control the central processor to read the vector path data of the characters to be rendered by the first rendering task or the second rendering task from the font library to obtain first vector path data; and then perform operations such as vector text parsing and path calculation based on the first vector path data to obtain a first vector path, and store the first vector path in a first memory.

[0130] Step 102a2: The electronic device controls the graphics processor to read the first vector path from the first memory, and draws the character to be rendered based on the first vector path to obtain the first bitmap or the second bitmap.

[0131] It can be understood that after the central processor determines the first vector path of the character to be rendered based on the first vector path data of the character to be rendered by the first rendering task, and stores the first vector path in the first memory, the electronic device can control the graphics processor to read the first vector path from the first memory, and draw the character to be rendered based on the first vector path to obtain the first bitmap. After the central processor determines the first vector path of the character to be rendered based on the first vector path data of the character to be rendered by the second rendering task, and stores the first vector path in the first memory, the electronic device can control the graphics processor to read the second vector path from the first memory, and draw the character to be rendered based on the second vector path to obtain the second bitmap.

[0132] In some embodiments of the present application, the electronic device can control the graphics processor to perform operations such as filling and anti-aliasing processing of the vector path according to the first vector path and the first typesetting information to draw the first part of the characters to be rendered or the second part of the characters to be rendered to obtain the first bitmap or the second bitmap.

[0133] In an embodiment of the present application, since the efficiency of the graphics processor and the central processing unit in performing different operations in the process of processing characters to be rendered is different, the electronic device can control the graphics processor and the central processing unit to respectively perform operations with higher efficiency, that is, control the central processing unit to determine the first vector path of the character to be rendered based on the first vector path data of the character to be rendered by the first rendering task or the second rendering task, and control the graphics processor to draw the first part of the characters to be rendered or the second part of the characters to be rendered based on the first vector path, thereby improving the efficiency of the electronic device in drawing the characters to be rendered.

[0134] Thus, it can be known that, on the one hand, since the electronic device can control the central processor to determine the first vector path based on the first vector path data, that is, control the central processor to perform operations with higher efficiency in the rendering process of the characters to be rendered, and control the graphics processor to draw the characters to be rendered based on the first vector path, that is, control the graphics processor to perform operations with higher efficiency in the rendering process of the characters to be rendered, the time consumed in rendering to obtain the first bitmap or the second bitmap can be reduced, thereby improving the efficiency of rendering to obtain the rendering result. On the other hand, since the central processor can store the processed first vector path in the first memory, that is, in the shared memory of the graphics processor and the central processor, the graphics processor can quickly read the first vector path from the first memory, therefore, the time consumed in the graphics processor to obtain the first vector path can be reduced, thereby reducing the time consumed in rendering to obtain the first bitmap or the second bitmap. In this way, the efficiency of electronic devices in displaying text can be improved.

[0135] Step 102b: The electronic device generates a rendering result based on the first bitmap and the second bitmap.

[0136] It can be seen that since the electronic device can control the graphics processor and the central processing unit to process the first rendering task and the second rendering task respectively, obtain the first bitmap and the second bitmap, and accurately generate the rendering result based on the first bitmap and the second bitmap, it can reduce the situation where the electronic device cannot obtain the rendering result, thereby reducing the probability of failing to generate display text.

[0137] In some embodiments of the present application, Figure 4 ,like Figure 5 As shown, the above step 102b can be specifically implemented through the following step 102b1.

[0138] Step 102b1: The electronic device performs a first operation on the first bitmap and the second bitmap to generate a rendering result.

[0139] In the embodiment of the present application, the above-mentioned first operation includes at least one of the following: a splicing operation and a color mixing operation.

[0140] In some embodiments of the present application, when the first operation includes a splicing operation, the electronic device may first obtain sorting information of the first part of characters to be rendered and the second part of characters to be rendered in the at least two characters to be rendered, and then perform a splicing operation on the first bitmap and the second bitmap according to the sorting information.

[0141] For example, assuming that the first part of the characters to be rendered are the first row of characters to be rendered among the at least two characters to be rendered, and the second part of the characters to be rendered are the second row of characters to be rendered among the at least two characters to be rendered, the electronic device can first obtain sorting information 1 of the first part of the characters to be rendered in the at least two characters to be rendered, such as the first row, and obtain sorting information 2 of the second part of the characters to be rendered in the at least two characters to be rendered, such as the second row, and according to the sorting information 1 and the sorting information 2, perform a splicing operation on the first bitmap and the second bitmap, such as splicing the second bitmap below the first bitmap, to obtain a rendering result.

[0142] As can be seen, the electronic device can directly perform a splicing operation and / or a color mixing operation on the first bitmap and the second bitmap to accurately obtain a rendering result.

[0143] Step 103: The electronic device generates display text according to the rendering result.

[0144] In some embodiments of the present application, after the electronic device generates the display text, the electronic device may control the graphics processor to display the display text.

[0145] An embodiment of the present application provides a text rendering method, in which an electronic device can divide the text to be rendered into multiple rendering tasks, and control the graphics processor and the central processing unit to respectively process the first rendering task and the second rendering task among the multiple rendering tasks to obtain rendering results, so that the electronic device can generate display text according to the rendering results. Since the electronic device can first divide the rendering task of the text to be rendered into multiple rendering tasks, and respectively process the first rendering task and the second rendering task among the multiple rendering tasks through the graphics processor and the central processing unit, that is, the first rendering task and the second rendering task are processed by multiple units at the same time, instead of processing the first rendering task and the second rendering task by one unit (such as the central processing unit), the electronic device only needs a short time to complete the processing of the first rendering task and the second rendering task, obtain the rendering results, and generate the display text according to the rendering results, so that the electronic device can quickly display the display text, thus improving the text display efficiency of the electronic device.

[0146] Furthermore, the text rendering method provided in the embodiment of the present application can make full use of the computing resources of the graphics processor and the central processing unit, thereby improving the overall performance of the system; and for some electronic devices with lower chip performance, it can greatly improve the text display speed, thereby improving the user experience.

[0147] The text rendering method provided in the embodiment of the present application can be executed by a text rendering device. In the embodiment of the present application, a text rendering device executing the text rendering method is taken as an example to illustrate the text rendering device provided in the embodiment of the present application.

[0148] Figure 6 FIG. 1 shows a schematic diagram of the structure of a text rendering device provided in an embodiment of the present application. Figure 6 As shown, the text rendering device 30 provided in the embodiment of the present application may include: a segmentation module 31, a control module 32 and a generation module 33. The segmentation module 31 is used to segment the text to be rendered into multiple rendering tasks, and the multiple rendering tasks include a first rendering task and a second rendering task. The control module 32 is used to control the graphics processor and the central processing unit to respectively process the first rendering task and the second rendering task in the multiple rendering tasks segmented by the segmentation module 31 to obtain rendering results. The generation module 33 is used to generate display text according to the rendering results.

[0149] An embodiment of the present application provides a text rendering device. Since the text rendering device can first divide the rendering task of the text to be rendered into multiple rendering tasks, and respectively process the first rendering task and the second rendering task among the multiple rendering tasks through the graphics processor and the central processing unit, that is, the first rendering task and the second rendering task are processed by multiple units at the same time, instead of processing the first rendering task and the second rendering task by one unit (such as the central processing unit), the text rendering device only needs a short time to complete the processing of the first rendering task and the second rendering task, obtain the rendering result, and generate a display text according to the rendering result, so that the text rendering device can quickly display the display text, thereby improving the text display efficiency of the text rendering device.

[0150] In a possible implementation, the segmentation module 31 includes: a first sub-determination module. The first sub-determination module is used to determine a first part of characters to be rendered and a second part of characters to be rendered from the characters to be rendered in the text to be rendered; and determine the first part of characters to be rendered as characters to be rendered by the first rendering task, and determine the second part of characters to be rendered as characters to be rendered by the second rendering task.

[0151] In a possible implementation, the above-mentioned first sub-determination module is specifically used to divide the characters to be rendered in the text to be rendered into a first part of characters to be rendered and a second part of characters to be rendered according to a first quantity; wherein the first quantity is the number of characters to be rendered, or the number of rows of characters to be rendered.

[0152] In a possible implementation, the first sub-determination module is specifically used to determine the processing parameters corresponding to each character to be rendered, and each processing parameter is used to indicate at least one of the following: the amount of calculation required to render the corresponding character to be rendered, and the time consumed in reading the vector path data of the corresponding character to be rendered from the font library; and determining the characters to be rendered that do not meet the first condition as the first part of the characters to be rendered; and determining the characters to be rendered that meet the first condition as the second part of the characters to be rendered; wherein the first condition is that the parameter value of the processing parameter is less than the parameter value threshold.

[0153] In a possible implementation, the above-mentioned first sub-determination module is specifically used to determine the task type of each sub-rendering task of each character to be rendered; and determine the characters to be rendered corresponding to the sub-rendering tasks whose task types match the first preset type as the first part of the characters to be rendered; and determine the characters to be rendered corresponding to the sub-rendering tasks whose task types match the second preset type as the second part of the characters to be rendered; wherein the first preset type includes at least one of the following: a vector path filling type and an anti-aliasing processing type; and the second preset type includes at least one of the following: a vector text parsing type and a path calculation type.

[0154] In a possible implementation, the first sub-determination module is also used to determine a first time and a second time before determining the first part of the characters to be rendered as the characters to be rendered by the first rendering task and determining the second part of the characters to be rendered as the characters to be rendered by the second rendering task, wherein the first time is the time required for the graphics processor to process the first rendering task, and the second time is the time required for the central processing unit to process the second rendering task. The segmentation module also includes: a first sub-adjustment module. The first sub-adjustment module is used to adjust the characters to be rendered included in the first part of the characters to be rendered and the second part of the characters to be rendered, respectively, based on the first time and the second time determined by the first sub-determination module; wherein after the adjustment, the time required for the graphics processor to process the first rendering task matches the time required for the central processing unit to process the second rendering task.

[0155] In a possible implementation, the above-mentioned first sub-determination module is also used to, after adjusting the characters to be rendered included in the first part of the characters to be rendered and the second part of the characters to be rendered based on the first time and the second time, respectively, determine the adjusted first part of the characters to be rendered as the characters to be rendered by the first rendering task, and determine the adjusted second part of the characters to be rendered as the characters to be rendered by the second rendering task.

[0156] In a possible implementation, the first sub-adjustment module is further used to obtain first information and second information after respectively adjusting the characters to be rendered included in the first part of the characters to be rendered and the second part of the characters to be rendered based on the first time and the second time, wherein the first information is used to indicate at least one of the following: the processing capability of the graphics processor and the load condition of the graphics processor, and the second information is used to indicate at least one of the following: the processing capability of the central processing unit and the load condition of the central processing unit; and respectively adjust the characters to be rendered included in the first part of the characters to be rendered and the second part of the characters to be rendered based on the first information and the second information.

[0157] In a possible implementation, the control module 32 is specifically used to control the graphics processor and the central processing unit to process the first rendering task and the second rendering task respectively to obtain the first bitmap and the second bitmap. The generation module 33 is also used to generate a rendering result based on the first bitmap and the second bitmap.

[0158] In a possible implementation, the control module 32 is specifically used to control the central processing unit to determine the first vector path of the character to be rendered based on the first vector path data of the character to be rendered by the first rendering task or the second rendering task, and store the first vector path in the first memory; and control the graphics processor to read the first vector path from the first memory, and draw the character to be rendered based on the first vector path to obtain the first bitmap or the second bitmap; wherein the first memory is a shared memory of the graphics processor and the central processing unit.

[0159] In a possible implementation, the generation module 33 is specifically configured to perform a first operation on the first bitmap and the second bitmap to generate a rendering result; wherein the first operation includes at least one of the following: a splicing operation and a color mixing operation.

[0160] The text rendering device in the embodiment of the present application can be an electronic device, or a component in the electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal, or it can be other devices other than a terminal. Exemplarily, the electronic device can be a mobile phone, a tablet computer, a laptop computer, a PDA, a vehicle-mounted electronic device, a mobile internet device (mobile internet device, MID), an augmented reality (augmentedreality, AR) / virtual reality (virtualreality, VR) device, a robot, a wearable device, an ultra-mobile personal computer (ultra-mobile personal computer, UMPC), a netbook or a personal digital assistant (personal digital assistant, PDA), etc. It can also be a server, a network attached storage (network attached storage, NAS), a personal computer (personal computer, PC), a television (television, TV), a teller machine or a self-service machine, etc., which is not specifically limited in the embodiment of the present application.

[0161] The text rendering device in the embodiment of the present application may be a device having an operating system. The operating system may be an Android operating system, an iOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.

[0162] The text rendering device provided in the embodiment of the present application can achieve Figures 1 to 5 To avoid repetition, the various processes implemented by the method embodiment are not described here.

[0163] In some embodiments of the present application, Figure 7As shown, an embodiment of the present application further provides an electronic device 40, including a processor 41 and a memory 42, wherein the memory 42 stores programs or instructions that can be executed on the processor 41, and when the program or instructions are executed by the processor 41, the various process steps of the above-mentioned text rendering method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, they are not described here.

[0164] It should be noted that the electronic devices in the embodiments of the present application include the above-mentioned mobile electronic devices and non-mobile electronic devices.

[0165] Figure 8 A schematic diagram of the hardware structure of an electronic device to implement an embodiment of the present application.

[0166] The electronic device 100 includes but is not limited to components such as a radio frequency unit 101, a network module 102, an audio output unit 103, an input unit 104, a sensor 105, a display unit 106, a user input unit 107, an interface unit 108, a memory 109, and a processor 110.

[0167] Those skilled in the art will appreciate that the electronic device 100 may also include a power source (such as a battery) for supplying power to various components, and the power source may be logically connected to the processor 110 through a power management system, thereby implementing functions such as managing charging, discharging, and power consumption management through the power management system. Figure 8 The electronic device structure shown in the figure does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently, which will not be described in detail here.

[0168] Among them, the processor 110 is used to divide the text to be rendered into multiple rendering tasks, which include a first rendering task and a second rendering task; and control the graphics processor and the central processing unit to process the first rendering task and the second rendering task respectively to obtain rendering results; and generate display text according to the rendering results.

[0169] An embodiment of the present application provides an electronic device. Since the electronic device can first divide the rendering task of the text to be rendered into multiple rendering tasks, and respectively process the first rendering task and the second rendering task among the multiple rendering tasks through the graphics processor and the central processing unit, that is, the first rendering task and the second rendering task are processed by multiple units at the same time, instead of processing the first rendering task and the second rendering task by one unit (such as the central processing unit), the electronic device only needs a short time to complete the processing of the first rendering task and the second rendering task, obtain the rendering result, and generate a display text according to the rendering result, so that the electronic device can quickly display the display text. In this way, the text display efficiency of the electronic device can be improved.

[0170] In some embodiments of the present application, the processor 110 is specifically used to determine a first part of characters to be rendered and a second part of characters to be rendered from the characters to be rendered in the text to be rendered; and determine the first part of characters to be rendered as characters to be rendered by the first rendering task, and determine the second part of characters to be rendered as characters to be rendered by the second rendering task.

[0171] In some embodiments of the present application, the processor 110 is specifically used to divide the characters to be rendered in the text to be rendered into a first part of characters to be rendered and a second part of characters to be rendered according to a first quantity; wherein the first quantity is the number of characters to be rendered, or the number of rows of characters to be rendered.

[0172] In some embodiments of the present application, the processor 110 is specifically used to determine a processing parameter corresponding to each character to be rendered, each processing parameter is used to indicate at least one of the following: the amount of computation required to render the corresponding character to be rendered, the time taken to read the vector path data of the corresponding character to be rendered from the font library; and determining the characters to be rendered that do not meet the first condition as the first part of the characters to be rendered; and determining the characters to be rendered that meet the first condition as the second part of the characters to be rendered; wherein the first condition is that the parameter value of the processing parameter is less than the parameter value threshold.

[0173] In some embodiments of the present application, the processor 110 is specifically used to determine the task type of each sub-rendering task of each character to be rendered; and determine the characters to be rendered corresponding to the sub-rendering tasks whose task types match the first preset type as the first part of the characters to be rendered; and determine the characters to be rendered corresponding to the sub-rendering tasks whose task types match the second preset type as the second part of the characters to be rendered; wherein the first preset type includes at least one of the following: a vector path filling type and an anti-aliasing processing type; and the second preset type includes at least one of the following: a vector text parsing type and a path calculation type.

[0174] In some embodiments of the present application, the processor 110 is further used to determine a first time and a second time before determining the first part of the characters to be rendered as the characters to be rendered by the first rendering task and determining the second part of the characters to be rendered as the characters to be rendered by the second rendering task, the first time being the time required for the graphics processor to process the first rendering task, and the second time being the time required for the central processing unit to process the second rendering task; and based on the first time and the second time, respectively adjust the characters to be rendered included in the first part of the characters to be rendered and the second part of the characters to be rendered; wherein, after the adjustment, the time required for the graphics processor to process the first rendering task matches the time required for the central processing unit to process the second rendering task.

[0175] In some embodiments of the present application, the processor 110 is further used to, after adjusting the characters to be rendered included in the first part of the characters to be rendered and the second part of the characters to be rendered based on the first time and the second time, respectively, determine the adjusted first part of the characters to be rendered as the characters to be rendered by the first rendering task, and determine the adjusted second part of the characters to be rendered as the characters to be rendered by the second rendering task.

[0176] In some embodiments of the present application, the processor 110 is further used to obtain first information and second information after adjusting the characters to be rendered included in the first part of the characters to be rendered and the second part of the characters to be rendered based on the first time and the second time, respectively, wherein the first information is used to indicate at least one of the following: the processing capability of the graphics processor and the load condition of the graphics processor, and the second information is used to indicate at least one of the following: the processing capability of the central processing unit and the load condition of the central processing unit; and according to the first information and the second information, respectively adjust the characters to be rendered included in the first part of the characters to be rendered and the second part of the characters to be rendered.

[0177] In some embodiments of the present application, the processor 110 is specifically used to control the graphics processor and the central processing unit to process the first rendering task and the second rendering task respectively, obtain the first bitmap and the second bitmap; and generate a rendering result based on the first bitmap and the second bitmap.

[0178] In some embodiments of the present application, the processor 110 is specifically used to control the central processing unit to determine the first vector path of the character to be rendered based on the first vector path data of the character to be rendered by the first rendering task or the second rendering task, and store the first vector path in the first memory; and control the graphics processor to read the first vector path from the first memory, and draw the character to be rendered based on the first vector path to obtain the first bitmap or the second bitmap; wherein the first memory is a shared memory of the graphics processor and the central processing unit.

[0179] In some embodiments of the present application, the processor 110 is specifically configured to perform a first operation on the first bitmap and the second bitmap to generate a rendering result; wherein the first operation includes at least one of the following: a splicing operation and a color mixing operation.

[0180] It should be understood that in the embodiment of the present application, the input unit 104 may include a graphics processor (Graphics Processing Unit, GPU) 1041 and a microphone 1042, and the graphics processor 1041 processes the image data of a static picture or video obtained by an image capture device (such as a camera) in a video capture mode or an image capture mode. The display unit 106 may include a display panel 1061, and the display panel 1061 may be configured in the form of a liquid crystal display, an organic light emitting diode, etc. The user input unit 107 includes a touch panel 1071 and at least one of other input devices 1072. The touch panel 1071 is also called a touch screen. The touch panel 1071 may include two parts: a touch detection device and a touch controller. Other input devices 1072 may include, but are not limited to, a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, and a joystick, which will not be repeated here.

[0181] The memory 109 can be used to store software programs and various data. The memory 109 may mainly include a first storage area for storing programs or instructions and a second storage area for storing data, wherein the first storage area may store an operating system, an application program or instructions required for at least one function (such as a sound playback function, an image playback function, etc.), etc. In addition, the memory 109 may include a volatile memory or a non-volatile memory, or the memory 109 may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), a static random access memory (SRAM), a dynamic random access memory (DRAM), a synchronous dynamic random access memory (SDRAM), a double data rate synchronous dynamic random access memory (DDRSDRAM), an enhanced synchronous dynamic random access memory (ESDRAM), a synchronous link dynamic random access memory (SLDRAM) and a direct memory bus random access memory (DRRAM). The memory 109 in the embodiment of the present application includes but is not limited to these and any other suitable types of memory.

[0182] The processor 110 may include one or more processing units; optionally, the processor 110 integrates an application processor and a modem processor, wherein the application processor mainly processes operations related to an operating system, a user interface, and application programs, and the modem processor mainly processes wireless communication signals, such as a baseband processor. It is understandable that the modem processor may not be integrated into the processor 110.

[0183] An embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, each process of the above-mentioned text rendering method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0184] The processor is the processor in the electronic device in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory ROM, a random access memory RAM, a magnetic disk or an optical disk.

[0185] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface and the processor are coupled, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned text rendering method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0186] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.

[0187] An embodiment of the present application provides a computer program product, which is stored in a storage medium. The program product is executed by at least one processor to implement the various processes of the above-mentioned text rendering method embodiment and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0188] It should be noted that, in this article, the terms "comprise", "include" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise one..." do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.

[0189] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods in each embodiment of the present application.

[0190] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.

Claims

1. A text rendering method, characterized in that: include: Splitting the text to be rendered into a plurality of rendering tasks, wherein the plurality of rendering tasks include a first rendering task and a second rendering task; Controlling the graphics processor and the central processor to process the first rendering task and the second rendering task respectively to obtain rendering results; Generate display text according to the rendering result.

2. The method according to claim 1, characterized in that The step of dividing the text to be rendered into multiple rendering tasks includes: Determine a first part of characters to be rendered and a second part of characters to be rendered from the characters to be rendered in the text to be rendered; The first part of characters to be rendered is determined as characters to be rendered by the first rendering task, and the second part of characters to be rendered is determined as characters to be rendered by the second rendering task.

3. The method according to claim 2, characterized in that The step of determining a first part of characters to be rendered and a second part of characters to be rendered from the characters to be rendered in the text to be rendered comprises: According to the first quantity, the characters to be rendered in the text to be rendered are equally divided into the first part of characters to be rendered and the second part of characters to be rendered; The first number is the number of characters to be rendered, or the number of rows of characters to be rendered.

4. The method according to claim 2, characterized in that: The step of determining a first part of characters to be rendered and a second part of characters to be rendered from the characters to be rendered in the text to be rendered comprises: Determine a processing parameter corresponding to each of the characters to be rendered, each of the processing parameters being used to indicate at least one of the following: a computational amount for rendering the corresponding character to be rendered, and a time consumption for reading vector path data of the corresponding character to be rendered from a font library; Determine the characters to be rendered that do not meet the first condition as the first part of characters to be rendered; Determine the characters to be rendered that meet the first condition as the second part of characters to be rendered; The first condition is that the parameter value of the processing parameter is less than a parameter value threshold.

5. The method according to claim 2, characterized in that: The step of determining a first part of characters to be rendered and a second part of characters to be rendered from the characters to be rendered in the text to be rendered comprises: Determine the task type of each sub-rendering task of each of the characters to be rendered; Determine the characters to be rendered corresponding to the sub-rendering tasks whose task types match the first preset type as the first part of characters to be rendered; Determine the characters to be rendered corresponding to the sub-rendering tasks whose task types match the second preset type as the second part of characters to be rendered; Among them, the first preset type includes at least one of the following: a vector path filling type and an anti-aliasing processing type; the second preset type includes at least one of the following: a vector text parsing type and a path calculation type.

6. The method according to any one of claims 2 to 5, characterized in that Before determining the first part of characters to be rendered as characters to be rendered by the first rendering task and determining the second part of characters to be rendered as characters to be rendered by the second rendering task, the method further includes: Determine a first time and a second time, the first time being the time required for the graphics processor to process the first rendering task, and the second time being the time required for the central processing unit to process the second rendering task; Based on the first time and the second time, respectively adjust the characters to be rendered included in the first part of characters to be rendered and the second part of characters to be rendered; After adjustment, the time required by the graphics processor to process the first rendering task matches the time required by the central processing unit to process the second rendering task.

7. The method according to claim 6, characterized in that After respectively adjusting the characters to be rendered included in the first part of characters to be rendered and the second part of characters to be rendered based on the first time and the second time, the method further includes: The adjusted first part of characters to be rendered is determined as the characters to be rendered by the first rendering task, and the adjusted second part of characters to be rendered is determined as the characters to be rendered by the second rendering task.

8. The method according to claim 6, characterized in that After respectively adjusting the characters to be rendered included in the first part of characters to be rendered and the second part of characters to be rendered based on the first time and the second time, the method further includes: Acquire first information and second information, wherein the first information is used to indicate at least one of the following: the processing capability of the graphics processor and the load condition of the graphics processor, and the second information is used to indicate at least one of the following: the processing capability of the central processing unit and the load condition of the central processing unit; The characters to be rendered included in the first part of characters to be rendered and the second part of characters to be rendered are adjusted according to the first information and the second information respectively.

9. The method according to claim 1, characterized in that: The controlling the graphics processor and the central processor to process the first rendering task and the second rendering task respectively to obtain rendering results includes: Controlling the graphics processor and the central processing unit to process the first rendering task and the second rendering task respectively to obtain a first bitmap and a second bitmap; The rendering result is generated based on the first bitmap and the second bitmap.

10. The method according to claim 9, characterized in that The controlling the graphics processor and the central processor to process the first rendering task and the second rendering task respectively to obtain a first bitmap and a second bitmap includes: Controlling the central processor to determine a first vector path of the character to be rendered based on first vector path data of the character to be rendered by the first rendering task or the second rendering task, and storing the first vector path in a first memory; Controlling the graphics processor to read the first vector path from the first memory, and drawing the to-be-rendered character based on the first vector path to obtain the first bitmap or the second bitmap; The first memory is a shared memory of the graphics processor and the central processing unit.

11. The method according to claim 9, characterized in that The generating the rendering result based on the first bitmap and the second bitmap includes: Performing a first operation on the first bitmap and the second bitmap to generate the rendering result; The first operation includes at least one of the following: a splicing operation and a color mixing operation.

12. A text rendering device, characterized in that: The text rendering device comprises: a segmentation module, a control module and a generation module; The segmentation module is used to segment the text to be rendered into a plurality of rendering tasks, wherein the plurality of rendering tasks include a first rendering task and a second rendering task; The control module is used to control the graphics processor and the central processing unit to respectively process the first rendering task and the second rendering task among the plurality of rendering tasks obtained by segmentation by the segmentation module to obtain rendering results; The generating module is used to generate display text according to the rendering result.

13. The device according to claim 12, characterized in that The segmentation module includes: a first sub-determination module; The first sub-determination module is used to determine a first part of characters to be rendered and a second part of characters to be rendered from the characters to be rendered in the text to be rendered; and determine the first part of characters to be rendered as the characters to be rendered by the first rendering task, and determine the second part of characters to be rendered as the characters to be rendered by the second rendering task.

14. The device according to claim 13, characterized in that The first sub-determining module is specifically configured to divide the characters to be rendered in the text to be rendered into the first part of characters to be rendered and the second part of characters to be rendered according to the first quantity; The first number is the number of characters to be rendered, or the number of rows of characters to be rendered.

15. The device according to claim 13, characterized in that The first sub-determining module is specifically used to determine a processing parameter corresponding to each of the characters to be rendered, each of the processing parameters being used to indicate at least one of the following: a computational amount for rendering the corresponding character to be rendered, and a time consumption for reading vector path data of the corresponding character to be rendered from a font library; and determining the characters to be rendered that do not satisfy the first condition as the first part of characters to be rendered; and determining the characters to be rendered that satisfy the first condition as the second part of characters to be rendered; The first condition is that the parameter value of the processing parameter is less than a parameter value threshold.

16. The device according to claim 13, characterized in that The first sub-determining module is specifically configured to determine a task type of each sub-rendering task of each of the characters to be rendered; and determine the characters to be rendered corresponding to the sub-rendering tasks whose task types match the first preset type as the first part of the characters to be rendered; and determine the characters to be rendered corresponding to the sub-rendering tasks whose task types match the second preset type as the second part of the characters to be rendered; Among them, the first preset type includes at least one of the following: a vector path filling type and an anti-aliasing processing type; the second preset type includes at least one of the following: a vector text parsing type and a path calculation type.

17. The device according to any one of claims 13 to 16, characterized in that The first sub-determining module is further used to determine a first time and a second time before determining the first part of characters to be rendered as characters to be rendered by the first rendering task and determining the second part of characters to be rendered as characters to be rendered by the second rendering task, wherein the first time is the time required for the graphics processor to process the first rendering task and the second time is the time required for the central processing unit to process the second rendering task; The segmentation module further includes: a first sub-adjustment module; The first sub-adjusting module is used to adjust the characters to be rendered included in the first part of characters to be rendered and the second part of characters to be rendered respectively based on the first time and the second time determined by the first sub-determining module; After adjustment, the time required by the graphics processor to process the first rendering task matches the time required by the central processing unit to process the second rendering task.

18. The method according to claim 17, characterized in that The first sub-determination module is further used to, after adjusting the characters to be rendered included in the first part of the characters to be rendered and the second part of the characters to be rendered based on the first time and the second time, respectively, determine the adjusted first part of the characters to be rendered as the characters to be rendered by the first rendering task, and determine the adjusted second part of the characters to be rendered as the characters to be rendered by the second rendering task.

19. The method according to claim 17, characterized in that The first sub-adjustment module is further used to obtain first information and second information after adjusting the characters to be rendered included in the first part of the characters to be rendered and the second part of the characters to be rendered based on the first time and the second time, respectively, wherein the first information is used to indicate at least one of the following: the processing capability of the graphics processor and the load condition of the graphics processor, and the second information is used to indicate at least one of the following: the processing capability of the central processing unit and the load condition of the central processing unit; and according to the first information and the second information, respectively adjust the characters to be rendered included in the first part of the characters to be rendered and the second part of the characters to be rendered.

20. The device according to claim 12, characterized in that The control module is specifically used to control the graphics processor and the central processing unit to process the first rendering task and the second rendering task respectively, so as to obtain a first bitmap and a second bitmap; The generating module is further configured to generate the rendering result based on the first bitmap and the second bitmap.

21. The device according to claim 20, characterized in that The control module is specifically used to control the central processor to determine the first vector path of the character to be rendered based on the first vector path data of the character to be rendered by the first rendering task or the second rendering task, and store the first vector path in the first memory; and controlling the graphics processor to read the first vector path from the first memory, and to draw the character to be rendered based on the first vector path to obtain the first bitmap or the second bitmap; The first memory is a shared memory of the graphics processor and the central processing unit.

22. The device according to claim 20, characterized in that The generating module is specifically configured to perform a first operation on the first bitmap and the second bitmap to generate the rendering result; The first operation includes at least one of the following: a splicing operation and a color mixing operation.

23. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores a program or instruction that can be run on the processor, and when the program or instruction is executed by the processor, the steps of the text rendering method according to any one of claims 1 to 11 are implemented.

24. A readable storage medium, characterized in that: The readable storage medium stores a program or an instruction, and when the program or the instruction is executed by a processor, the steps of the text rendering method according to any one of claims 1 to 11 are implemented.