Character display method and device, electronic equipment, storage medium and program product
By merging and optimizing the vector information of CJK characters, identifying and merging similar vector information, and reducing the number of rendering operations, the problem of low display efficiency of CJK characters is solved, thereby improving the performance of electronic devices and the user experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-15
- Publication Date
- 2026-04-07
AI Technical Summary
The low display efficiency of CJK characters causes stuttering and increased power consumption when electronic devices draw vector paths.
By acquiring N vector information of the character to be displayed, identifying M groups of matching vector information, performing a drawing operation on only one vector information in each group to generate M first bit images, and performing a drawing operation on each of the remaining vector information to generate at least one second bit image, and finally displaying the character based on these bit images.
It reduces the system resource consumption and rendering time of electronic devices in the process of displaying characters, thus improving the efficiency of text display.
Smart Images

Figure CN121807423A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of display technology, specifically relating to a text display method, device, electronic device, storage medium, and program product. Background Technology
[0002] With the development of technology, the text display function of electronic devices is becoming increasingly important, and the demand for displaying complex characters such as Chinese, Japanese, and Korean (CJK) continues to grow. When displaying CJK characters, electronic devices can first extract the vector path information of the characters from the font file, and then draw the font vector path through the processing unit to achieve the display of CJK characters.
[0003] However, because CJK characters have complex structures and numerous strokes, the computational load for drawing font vector paths is enormous, which can easily lead to problems such as lag and increased power consumption. As a result, the text display efficiency of electronic devices is relatively low. Summary of the Invention
[0004] The purpose of this application is to provide a text display method, apparatus, electronic device, storage medium, and program product that can improve text display efficiency.
[0005] In a first aspect, embodiments of this application provide a text display method, which includes: acquiring N vector information corresponding to a character to be displayed, where N is a positive integer; performing a drawing operation once based on one vector information in each of M groups of vector information to obtain M first bit images, where each group of vector information includes at least two matching vector information from the N vector information, where M is a positive integer; performing a drawing operation once based on each vector information other than the M groups of vector information in the N vector information to obtain at least one second bit image; and displaying the character to be displayed based on the M first bit images and at least one second bit image.
[0006] Secondly, embodiments of this application provide a text display device, comprising: an acquisition module, an execution module, and a display module. The acquisition module acquires N vector information corresponding to a character to be displayed, where N is a positive integer. The execution module performs a drawing operation once based on one vector information from each of M groups of vector information to obtain M first-bit images. Each group of vector information includes at least two matching vector information from the N vector information acquired by the acquisition module, where M is a positive integer. The execution module also performs a drawing operation once based on each vector information other than the M groups of vector information acquired by the acquisition module to obtain at least one second-bit image. The display module displays the character to be displayed based on the M first-bit images obtained by the execution module and the at least one second-bit image obtained by the execution module.
[0007] Thirdly, embodiments of this application provide an electronic device including a processor and a memory, wherein the memory stores programs or instructions executable on the processor, and the programs or instructions, when executed by the processor, implement the steps of the method described in the first aspect.
[0008] Fourthly, embodiments of this application provide a readable storage medium on which a program or instructions are stored, which, when executed by a processor, implement the steps of the method described in the first aspect.
[0009] Fifthly, embodiments of this application provide a chip, the chip including a processor and a communication interface, the communication interface being coupled to the processor, the processor being used to run programs or instructions to implement the method as described in the first aspect.
[0010] In a sixth aspect, embodiments of this application provide a computer program product stored in a storage medium, which is executed by at least one processor to implement the method described in the first aspect.
[0011] In this embodiment, the electronic device can acquire N vector information corresponding to the character to be displayed, and perform a drawing operation once based on one vector information from each of the M groups of vector information to obtain M first-bit images. Each group of vector information includes at least two matching vector information from the N vector information groups. Then, a drawing operation is performed once based on each vector information from the N vector information groups excluding the M groups of vector information to obtain at least one second-bit image. Finally, the character to be displayed is displayed based on the M first-bit images and at least one second-bit image. In this solution, since the electronic device can generate M first-bit images by performing a drawing operation once on only one vector information from each of the M groups of vector information when it acquires the N vector information corresponding to the character to be displayed, without needing to perform drawing operations on the other vector information from each group except for that one vector information, the number of drawing operations performed by the electronic device can be reduced. Therefore, the system resource consumption and bitmap drawing time of the electronic device during the display of the character to be displayed can be reduced. Thus, the text display efficiency is improved. Attached Figure Description
[0012] Figure 1 This is one of the flowcharts of the text display method provided in the embodiments of this application;
[0013] Figure 2 This is one of the schematic diagrams of the vector design method provided in the embodiments of this application;
[0014] Figure 3 This is a second schematic diagram of the vector design method provided in the embodiments of this application;
[0015] Figure 4 This is the third schematic diagram of the vector design method provided in the embodiments of this application;
[0016] Figure 5 This is the fourth schematic diagram of the vector design method provided in the embodiments of this application;
[0017] Figure 6 This is the fifth schematic diagram of the vector design method provided in the embodiments of this application;
[0018] Figure 7 This is the sixth schematic diagram of the vector design method provided in the embodiments of this application;
[0019] Figure 8 This is a schematic diagram illustrating the differences in vector information provided in the embodiments of this application;
[0020] Figure 9 This is the second flowchart of the text display method provided in the embodiments of this application;
[0021] Figure 10 This is the third flowchart of the text display method provided in the embodiments of this application;
[0022] Figure 11 This is the fourth flowchart of the text display method provided in the embodiments of this application;
[0023] Figure 12 This is the fifth flowchart of the text display method provided in the embodiments of this application;
[0024] Figure 13 This is a schematic diagram illustrating the execution process of the text display method provided in the embodiments of this application;
[0025] Figure 14 This is a schematic diagram of the text display device provided in the embodiments of this application;
[0026] Figure 15 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application;
[0027] Figure 16 This is a schematic diagram of the hardware structure of the electronic device provided in the embodiments of this application. Detailed Implementation
[0028] The technical solutions of the embodiments of this application will be clearly described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application are within the scope of protection of this application.
[0029] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such use of data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and the number of objects is not limited; for example, a first object can be one or more. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.
[0030] The terms "at least one," "at least one," etc., in this application refer to any one, any two, or a combination of two or more of the included objects. For example, at least one of a, b, and c can mean: "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" refers to two or more, and its meaning is similar to that of "at least one."
[0031] The text display method, apparatus, electronic device, storage medium, and program product provided in this application will be described in detail below with reference to the accompanying drawings and through specific embodiments and application scenarios.
[0032] The embodiments of this application can be applied to scenarios that require displaying CJK characters.
[0033] The following uses some specific scenarios from the embodiments of this application as examples to illustrate the text display method provided in the embodiments of this application.
[0034] Scenario 1: When turning pages, the e-book reader needs to load the entire page of Japanese content at once. The e-book reader needs to complete the text display in real time and ensure smooth page-turning animation.
[0035] Scenario 2: Smartwatches need to frequently refresh Chinese text in the watch face, notifications, or health data interface. Due to the small battery capacity of smartwatches, it is necessary to reduce the power consumption of each text display to improve battery life.
[0036] Scenario 3: When the in-vehicle tablet computer starts up or switches interfaces, it needs to quickly render navigation menus, song lists and prompts containing rich Chinese characters to reduce interface response time and improve the driving experience.
[0037] It should be noted that scenarios 1 to 3 above are merely exemplary examples of some scenarios that may be applied to the embodiments of this application. In actual implementation, the embodiments of this application can also be applied to more scenarios where text display is required, and the embodiments of this application are not limited here.
[0038] In modern electronic devices, text display is a fundamental and crucial function, especially in embedded devices such as smartwatches. With the increasing diversity of displayed content, displaying multiple characters typically requires efficient graphics processing capabilities, such as when displaying a large number of Chinese, Japanese, and Korean characters. These characters have complex structures, containing numerous strokes and components. Currently, devices typically obtain the vector path information of the characters from font files before handing it over to the relevant processing units for rendering. However, due to the complexity of the vector paths in CJK characters, each character may contain a large number of nodes and line segments, resulting in a huge workload for rendering and consuming significant system resources. This is especially problematic in resource-constrained environments such as mobile devices, impacting device performance and causing issues like display stuttering and increased power consumption.
[0039] For example, in some embedded devices, when loading documents containing a large amount of Chinese content, the text redrawing speed is slow during page turning, affecting the user experience; in the interface display of mobile applications, menus and prompts containing Japanese or Korean characters cause interface response delays due to display efficiency issues.
[0040] Currently, some technologies improve performance by caching the vector information of entire characters and retrieving the cached information when the same character needs to be displayed. However, due to the large number of Chinese, Japanese, and Korean characters, the number of characters that can be cached is insufficient. Therefore, in scenarios where the text changes frequently, caching offers limited performance improvement for displaying Chinese, Japanese, and Korean characters. Furthermore, it cannot fundamentally solve the problem of excessive vector path drawing when dealing with the massive character set and complex structure of CJK characters.
[0041] This application provides a text display method, apparatus, electronic device, storage medium, and program product. Since the electronic device, upon acquiring N vector information corresponding to the character to be displayed, can generate M bitmaps by performing a drawing operation only once on one vector information from each of the M groups of vector information, without needing to perform drawing operations on the other vector information in each group, the number of drawing operations performed by the electronic device can be reduced. Therefore, the system resource consumption and bitmap drawing time of the electronic device during the display of the character can be reduced. This improves the text display efficiency.
[0042] The text display method provided in this application can be implemented by a text display device, which can be an electronic device, or a functional module or functional entity within an electronic device. The following description uses an electronic device as an example to illustrate the technical solution provided in this application.
[0043] Figure 1 A flowchart of a text display method provided in an embodiment of this application is shown, such as... Figure 1 As shown, the text display method provided in this application embodiment may include the following steps 201 to 204.
[0044] Step 201: The electronic device acquires N vector information corresponding to the character to be displayed.
[0045] In some embodiments of this application, the aforementioned characters to be displayed refer to the text content to be displayed on the screen of an electronic device. These characters may be CJK or other languages.
[0046] In some embodiments of this application, the aforementioned vector information is a mathematical expression used to describe the outline of text characters, consisting of a series of vector paths, each defined by geometric elements such as points, line segments, and Bézier curves. Vector information is typically stored in font files, such as Freetype, OpenType, and TrueType font files. This information does not lose quality when enlarged or reduced, maintaining the clarity of the text.
[0047] In some embodiments of this application, N is a positive integer representing the total number of vector information contained in the character to be displayed. A complex CJK character may contain multiple vector paths, such as strokes, components, etc., and each path is a vector information. The number of N depends on the complexity of the character; for example, a simple character may only have a few vector information, while a complex character may contain dozens of vector information.
[0048] In some embodiments of this application, before displaying characters, the electronic device first needs to load a font file containing the characters to be displayed, the font file storing vector information for each character. Then, the electronic device can parse the font file to extract the vector information of the characters to be displayed, that is, convert the binary data in the font file into operable vector path data.
[0049] In some embodiments of this application, the electronic device can first read the vector path. Specifically, when the electronic device needs to display Chinese, Japanese, or Korean characters, the processing unit can first read the vector path information of the characters from the corresponding font files. These font files store the outline description of each character, recording the stroke shape of the character in the form of vector graphics.
[0050] In some embodiments of this application, the aforementioned processing unit refers to hardware components such as a Central Processing Unit (CPU) and a Graphics Processing Unit (GPU) used to perform computational tasks. In these embodiments, the processing unit can be one or more of these types of processors, depending on the specific requirements of the text display method and the configuration of the electronic device. The processing unit is responsible for performing tasks such as reading, analyzing, drawing, and generating bitmaps of vector information.
[0051] Step 202: The electronic device performs a drawing operation once based on one vector information from each of the M groups of vector information to obtain M first-digit images.
[0052] In some embodiments of this application, each set of vector information includes at least two matching vector information from N vector information, where M is a positive integer.
[0053] In some embodiments of this application, the above-mentioned information matching means that the vector information is the same or similar in geometry, which can be determined by the magnitude of the difference in coordinates between the vector information.
[0054] In some embodiments of this application, M sets of vector information refer to a set of vector information with the same or similar geometric shapes identified from N vector information corresponding to the character to be displayed. Each vector information in these sets can be used to represent a set of visually identical or similar character components.
[0055] In some embodiments of this application, the above-described drawing operation refers to the process of converting vector information into a bitmap, i.e., a pixel map. This process is also called rasterization, which is the conversion of a vector path into pixels that can be displayed on the screen.
[0056] In some embodiments of this application, the aforementioned bitmap refers to an image file format that uses a grid system called a raster to store image information. A bitmap image typically consists of a two-dimensional array of pixels, each pixel containing color information, which can be monochrome or color.
[0057] In some embodiments of this application, the bitmap described above is a bitmap obtained by performing a drawing operation based on the first vector information in each group of vector information, representing the visual representation of all matching vector information in that group.
[0058] In some embodiments of this application, the electronic device can analyze the acquired N vector information, identify which vector information matches in geometric shape, and group the matching vector information among the N vector information into M groups.
[0059] In some embodiments of the present application, after dividing the vector information with matching information into a group and obtaining M groups, the electronic device can perform a drawing operation on one of the vector information with matching information in each of the M groups, that is, rasterize the vector path to generate pixel data that can be displayed on the screen, thereby obtaining M first-bitmaps. The first-bitmap of each group can be used to represent all the vector information with matching information within the group.
[0060] In some embodiments of the present application, after reading the vector path information, the electronic device can merge the same items therein. Specifically, the electronic device analyzes the read vector path through the processing unit and identifies exactly the same vector paths by designing a special algorithm to merge multiple identical vector paths into one. In subsequent drawing, the processing unit only needs to draw once, reducing the number of drawing times.
[0061] In some embodiments of the present application, after the processing unit merges the same vector path information, the electronic device can directly use the processing unit for subsequent processing, or transmit the optimized vector path information to another processing unit. For example, from one core of the CPU to another core, or from the CPU to the GPU.
[0062] In some embodiments of the present application, in the case of displaying a single Chinese character, taking the character "海" as an example, the vector design method of the character "海" in font a is as Figure 2 shown, and the vector design method of the character "海" in font b is as Figure 3 shown. After marking each vector path in font a and font b, as Figure 4 shown, it can be seen that in font a, the character "海" is composed of several parts A, B, C, D, E, F, where A and B are the same, and D and E are the same. In font b, as Figure 5 shown, the character "海" is composed of several parts A, B, C, D, E, F, G, H, I, J, K, L, where A and B are the same, H and K are the same, and E and L are the same.
[0063] It can be seen that whether using font a or font b, there is a part of the vector information of the character "海" that can be merged. Thus, when displaying a single Chinese character, the repeated part can only be drawn once by the processing unit, and then the processing unit can copy the data to obtain it.
[0064] In some embodiments of the present application, in the case of displaying multiple Chinese characters, taking font a as an example, exemplarily, as Figure 6As shown, when the four Chinese characters "rivers, lakes, and seas" are to be displayed, these four characters in font a are composed of a total of 20 parts, and each part corresponds to a vector path information. Therefore, there are a total of 20 vector path information. Among them, the 1st, 2nd, and 3rd parts of the character "river", the 5th, 6th, and 7th parts of the character "stream", the 10th, 11th, and 12th parts of the character "lake", and the 15th, 16th, and 17th parts of the character "sea" are all used to form the "氵". They are the same parts, so the electronic device only needs to let the processing unit draw them once.
[0065] It can be seen from this that if the electronic device can judge the similar vector parts in the string through code, the workload of drawing by the processing unit can be reduced.
[0066] In some embodiments of the present application, the currently common vector font library formats include Freetype, OpenType, TrueType, etc. In the embodiments of the present application, Freetype is taken as an example for illustration.
[0067] In some embodiments of the present application, there are 4 types of character vector path information defined in Freetype: move to, line to, conic to, cubic to. The meaning of each type of character vector path information is as follows:
[0068] Move to: It means the pen moves to a certain place;
[0069] Line to: The pen writes straight to a certain place;
[0070] Conic to: Draw a quadratic Bézier curve;
[0071] Cubic to: Draw a cubic Bézier curve.
[0072] Each type of vector path information corresponds to a number. For example, Move to corresponds to the number 1, Line to corresponds to the number 2, and so on. The corresponding numbers of different font formats may be different. The data format of each type of vector path information is shown in the following table:
[0073] serial number starting point Control Point 1 Control Point 2 end Move to 1 (x0, y0) -- -- -- Line to 2 -- -- -- (x1, y1) Conic to 3 -- (x2, y2) -- (x3, y3) Cubic to 4 -- (x4, y4) (x5, y5) (x6, y6)
[0074] Each type of vector path information is composed of a number and the coordinate information of the following points. For example:
[0075] "1 (15, 100)", which means Move to to the coordinates x = 15, y = 100.
[0076] "2 (15, 150)", which means Line to to the coordinates x = 15, y = 150.
[0077] "3 (15,200)(15,250)", which means that Conic to passes through the control points (x = 15, y = 200) to the coordinates x = 15, y = 250.
[0078] "4 (15,300)(15,350)(15,400)", which means that Cubic to first passes through the control point (x = 15, y = 300), then through the control point (x = 15, y = 350) to the coordinates x = 15, y = 400.
[0079] In some embodiments of the present application, in the vector information of each character, each part starts with Move to, and Move to represents the coordinates of the starting point of the vector path of this part. By offsetting two vector parts to the same position, the two vector parts can be compared point by point to determine whether they are substantially the same. When the coordinate value differences in the two vector information are both less than a preset threshold, it can be considered that the display effect differences between the two vector parts are hardly perceptible to the naked eye and can be ignored.
[0080] In some embodiments of the present application, the above preset threshold is a threshold for determining whether two vector information match. For example, the preset threshold can be 0.1, 0.05, 0.02, etc. Specifically, it can be determined according to actual usage requirements, and the embodiments of the present application do not make limitations.
[0081] Exemplarily, in combination with Figure 4 , such as Figure 7 shown, taking the character "海" of font a as an example, when the font size of the "海" character to be displayed is 60, both part A and part B are 6 points and 4 lines. Among them:
[0082] The original vector information of part A is:
[0083] Move to(13.20, 36.12)
[0084] Conic to(11.05, 38.09, 4.80, 43.56)
[0085] Line to(8.09, 47.28)
[0086] Conic to(12.55, 43.86, 16.80, 40.31)
[0087] Line to(13.20, 36.12)
[0088] The original vector information of part B is:
[0089] Move to(11.70, 21.30)
[0090] Conic to(9.55, 23.27, 3.29, 28.74)
[0091] Line to (6.59, 32.45)
[0092] Conic to(11.06, 29.03, 15.30, 25.49)
[0093] Line to (11.70, 21.30)
[0094] The starting coordinates of part A are (13.20, 36.12). Subtracting (13.20, 36.12) from all the vector information of part A will give us the data when part A is offset to the origin (0, 0).
[0095] Move to (0, 0)
[0096] Conic to(-2.15, 1.97, -8.40, 7.44)
[0097] Line to (-5.11, 11.16)
[0098] Conic to(-0.65, 7.74, 3.60, 4.19)
[0099] Line to (0, 0)
[0100] The starting coordinates of part B are (11.70, 21.30). Subtracting (11.70, 21.30) from all the vector information of part B will give us the data when part B is offset to the origin (0, 0).
[0101] Move to (0, 0)
[0102] Conic to(-2.15, 1.97, -8.41, 7.44)
[0103] Line to (-5.11, 11.15)
[0104] Conic to(-0.64, 7.73, 3.60, 4.19)
[0105] Line to (0, 0)
[0106] Comparing the differences in vector information when parts A and B are offset to the origin (0, 0), as shown below... Figure 8 As shown, where:
[0107] 1. The Move to vector information for both parts is exactly the same, both moving to the origin (0, 0).
[0108] 2. The first two parameters of the first onic to vector information are exactly the same in both Part A and Part B, both being (-2.15, 1.97). The last two parameters of the first onic to vector information are almost identical in Part A and Part B, being (-8.4, 7.44) and (-8.41, 7.44) respectively, with a difference of 0.01 pixels in the horizontal coordinate.
[0109] 3. The coordinates of the line to vector information are (-5.11, 11.16) in part A and (-5.11, 11.15) in part B, with a slight difference of 0.01 in the ordinate.
[0110] 4. The first two parameters of the second onic to vector information are (-0.65, 7.74) in part A and (-0.64, 7.73) in part B, with a slight difference of 0.01 between the x and y coordinates. The last two parameters of the second onic to vector information are (3.6, 4.19) and (3.60, 4.19), which are exactly the same.
[0111] 5. The Line to vector information for both parts returns to the origin (0, 0), which is exactly the same.
[0112] Therefore, the difference between the vector information in part A and part B is as follows:
[0113] Move to (0, 0)
[0114] Conic to(0, 0, 0.01, 0)
[0115] Line to(0, 0.01)
[0116] Conic to(0.01, 0.01, 0, 0)
[0117] Line to (0, 0)
[0118] As can be seen, when displayed at a font size of 60, the vector information of part A and part B is very close, with only a few coordinate values showing slight differences. The display deviation between the two parts is less than one percent of a pixel. Taking a threshold of 0.1 as an example, the maximum difference between the vector information of part A and part B is 0.01, which is less than 0.1 and can be ignored. Therefore, part A and part B can be regarded as similar or identical vector information. During drawing, the processing unit can draw only once and then copy it to another part to reduce the number of drawing operations.
[0119] In some embodiments of the present application, the selection of the above-mentioned preset threshold is related to the font size of the characters to be displayed. The visual perception ability of the human eye to the vector information difference is different for different font sizes. The electronic device can dynamically adjust the preset threshold according to the current font size to achieve an optimal balance effect.
[0120] Exemplarily, taking the font size of 12 as an example, at this time, the display area of a single character on the screen is relatively limited, such as 12×12 pixels. In this case, even a difference of 0.5 pixels may be detected by the human eye. Therefore, at this time, the electronic device can set the preset threshold to a relatively small value, such as 0.02 pixels. Taking the "氵" component of the character "海" as an example, at the font size of 12, after rasterization of its vector path coordinates, the stroke width may only occupy 2 - 3 pixels. At this time, if the coordinate difference between two vector information exceeds 0.02 pixels, it may cause inconsistent stroke thickness or position offset during actual display, affecting the overall visual effect.
[0121] Another exemplarily, taking the font size of 60 as an example, when the font size is 60, the character display area is relatively large, such as 60×60 pixels, which belongs to a large font size display scenario. In this case, the electronic device can further relax the preset threshold, such as 0.08 - 0.1 pixels. At the font size of 60, the stroke width of the "氵" component of this character may be about 10 - 12 pixels. At this time, a coordinate difference of 0.1 pixel has little impact on the visual effect, and can minimize the drawing operation to the greatest extent without almost affecting the visual effect, improving the rendering performance, and is applicable to an advertising delivery system that needs to quickly render a large number of relatively large characters.
[0122] In some embodiments of the present application, in the case of needing to display rare characters, variant characters and rare punctuation marks, the electronic device can dynamically adjust the preset threshold specifically to improve the display effect.
[0123] Step 203: The electronic device performs a drawing operation on each of the vector information other than the M groups of vector information among the N vector information to obtain at least one second bitmap.
[0124] In some embodiments of the present application, the electronic device can perform a drawing operation on each of the vector information that is not included in the M groups of vector information among the N vector information, so as to rasterize each vector information that does not match other vector information into a bitmap form, and obtain at least one second bitmap.
[0125] Step 204: The electronic device displays the character to be displayed based on the M first bitmaps and at least one second bitmap.
[0126] In some embodiments of this application, the electronic device can perform a bitmap integration operation on M first bitmaps and at least one second bitmap, that is, precisely stitch the M first bitmaps and at least one second bitmap together according to predetermined layout information and coordinates, so that these bitmaps can be correctly combined into a complete character and displayed.
[0127] In some embodiments of this application, after the merging and copying process by the processing unit, the electronic device can transmit and draw the results. Specifically, the electronic device can draw based on the simplified path information by the processing unit, that is, based on M first-bit images and at least one second-bit image. Since the same and similar paths have been effectively processed, the number of times the processing unit draws vector paths is greatly reduced, thereby improving the efficiency of text display.
[0128] This application aims to provide a method for optimizing the vector path of Chinese and Japanese / Korean text display. By detecting the text vector path in the processing unit and finding the same vector part in a string, the processing unit first draws the same vector part once, and then copies the same vector part to the corresponding target position. This reduces the number of times the processing unit draws the vector path. Copying the drawing result has less computational overhead than redrawing, thereby improving the performance of the device when displaying a large number of CJK characters, reducing power consumption, and improving the user experience.
[0129] This application provides a text display method. When an electronic device acquires N vector information corresponding to the character to be displayed, it can generate M bitmaps by performing a drawing operation only once on one vector information from each of the M groups of vector information, without needing to perform drawing operations on the other vector information in each group. This reduces the number of drawing operations performed by the electronic device, thus reducing the consumption of system resources and the bitmap drawing time during the display of the character. This improves the text display efficiency.
[0130] In some embodiments of this application, combined with Figure 1 ,like Figure 9 As shown, prior to step 202 above, the text display method provided in this application embodiment further includes the following steps 301 and 302.
[0131] Step 301: The electronic device calculates the hash value corresponding to each vector information.
[0132] In some embodiments of this application, the hash value is calculated by a hash function, which is an algorithm that converts input into a fixed-size output, such as converting text, files, data structures, etc. into a fixed-size byte string.
[0133] In some embodiments of this application, the hash function described above can be implemented using any one or more of the following algorithms: Message-Digest Algorithm 5, Secure Hash Algorithm 1 (SHA-1), Cyclic Redundancy Check 32 (CRC32), etc. Through the selection and implementation of the above hash algorithms, the electronic device...
[0134] In some embodiments of this application, the electronic device can calculate the hash value corresponding to each vector information through a hash function, so as to accurately reflect the geometric characteristics of the vector information through the hash value, which facilitates the subsequent judgment of whether the vector information matches. This can significantly shorten the judgment time of vector information matching while ensuring accuracy, and lay a solid foundation for reducing subsequent drawing operations.
[0135] Step 302: The electronic device divides at least two vector information pieces whose corresponding hash values match among the N vector information pieces into a group of vector information pieces.
[0136] In some embodiments of this application, the above-mentioned hash value matching means that the hash values obtained after two or more vector information are processed by a hash function are the same, indicating that these vector information are relatively similar in geometry.
[0137] In some embodiments of this application, the electronic device can traverse all calculated hash values, compare these hash values to find vector information that matches the hash values, and group the matching vector information into a set of vector information.
[0138] In some embodiments of this application, since vector information may contain a large amount of data, directly comparing complete vector information requires complex algorithms and more computing resources. Hash values can capture the geometric features of vector information, and the algorithm for calculating hash values is simple and the result is much smaller than the amount of data in the original vector information. Therefore, using hash values for comparison can significantly reduce the computing resources required for comparison compared to directly comparing vector information.
[0139] In this way, electronic devices can calculate the hash value corresponding to each vector information, and thus quickly identify reusable vector information by comparing the hash values, thereby improving processing efficiency while maintaining comparison accuracy.
[0140] In some embodiments of this application, each of the above N vector information includes at least one coordinate information. Combined with... Figure 9 ,like Figure 10As shown, before step 301 above, the text display method provided in this application embodiment further includes the following step 401.
[0141] Step 401: The electronic device performs a rounding operation on the coordinate values of each coordinate information of each of the N vector information.
[0142] In some embodiments of this application, the coordinate information mentioned above refers to the coordinates in the vector information, such as (3.62, 4.19). These coordinates define key points on the vector path, such as the start point, end point, control points, etc.
[0143] In some embodiments of this application, the above-mentioned rounding operation refers to converting a numerical value into an operation that can be divided by a preset threshold, such as rounding, rounding up, or rounding down.
[0144] In some embodiments of this application, the coordinate values of some vector information have slight differences, but the difference in display effect is barely noticeable to the naked eye and can be ignored. Therefore, the electronic device can perform a rounding operation on all coordinate values in each vector information. For example, the coordinates (3.62, 4.19) can be rounded down to obtain the coordinates (3.6, 4.1). In this way, when the corresponding coordinate values in two vector information are converted to values divisible by a preset threshold, the two vector information with slightly different coordinate values can be normalized into the same vector information, thereby further increasing the number of matching vector information without affecting the display effect.
[0145] In some embodiments of this application, the electronic device can use the vector information after rounding the coordinate values for subsequent hash calculations to calculate the hash value corresponding to the vector information after rounding the coordinate values, and determine the matching vector information by comparing whether these hash values are the same.
[0146] In this way, electronic devices can expand the filtering range by rounding the coordinate values of vector information, and judge vector information that is similar to a certain extent as a match. This further increases the number of matching vector information without affecting the display effect, reduces the number of vector information that needs to be processed separately, thereby reducing the number of drawing operations, reducing system resource consumption, and improving the efficiency and performance of text display.
[0147] In some embodiments of this application, combined with Figure 1 ,like Figure 11 As shown, step 202 above can be specifically implemented through step 202a below.
[0148] Step 202a: The electronic device performs a drawing operation once based on the first vector information in each group of vector information to obtain M first-position images.
[0149] Among them, the first vector information mentioned above is the first vector information in each group of vector information after being sorted according to the order in which the drawing operations were performed.
[0150] In some embodiments of this application, when performing a drawing operation on each group of vector information in the M groups, the electronic device can first perform a drawing operation on the first vector information sorted according to the order in which the drawing operations are performed, to obtain M first-bit images.
[0151] In this way, electronic devices can generate a bitmap by selecting the first vector information in each group of vector information as a representative and performing a drawing operation once. This bitmap can be reused when drawing other vector information that matches the vector information in the future, thereby reducing the number of drawing operations, reducing the resource consumption of electronic devices, and improving the efficiency and performance of text display.
[0152] In some embodiments of this application, combined with Figure 11 ,like Figure 12 As shown, after step 202a above, the text display method provided in this application embodiment further includes step 501 below, and step 204 above can be implemented by step 204a below.
[0153] Step 501: The electronic device performs at least one copy operation based on the first bit image corresponding to each group of vector information.
[0154] In some embodiments of this application, the number of times the copy operation corresponding to each group of vector information is executed is: the number of vector information in each group of vector information excluding any one of the vector information.
[0155] In some embodiments of this application, the above-mentioned copying operation refers to copying and pasting the drawn bitmap, i.e. the first bitmap, to a new position to represent other matching vector information in the group.
[0156] In some embodiments of this application, for each group of vector information, the electronic device can determine the number of copy operations that need to be performed. This number is equal to the number of vector information in the group minus 1, because the first vector information has already generated the first bit image through the drawing operation.
[0157] In some embodiments of this application, after determining the number of copy operations, the electronic device can perform the number of copy operations on the first bitmap to copy the bitmap to new positions corresponding to other vector information within the group. After each copy operation, the electronic device generates a new bitmap, which is identical to the first bitmap but located in a different position. These copied bitmaps can be used to represent other matching vector information within the group.
[0158] In some embodiments of this application, the processing unit may first draw the repeating vector portion, so that when the processing unit draws the non-repeating portion, the repeating portion can be copied synchronously, reducing display time.
[0159] Step 204a: The electronic device displays the character to be displayed based on M first bitmaps, bitmaps obtained by copying them, and at least one second bitmap.
[0160] In some embodiments of this application, the electronic device can perform a bitmap integration operation on M first-bit images, a bitmap obtained by copying, and at least one second bitmap. That is, the M first-bit images, the bitmap obtained by copying, and at least one second bitmap are precisely stitched together according to predetermined layout information and coordinates so that these bitmaps can be correctly combined into a complete character and displayed.
[0161] In this way, the electronic device can perform a copy operation on the first bit image corresponding to each set of vector information and use it for subsequent bit image integration, avoiding drawing each vector information separately, reducing the number of drawing operations and the consumption of computing resources, thereby reducing the resource consumption of the electronic device and improving display efficiency.
[0162] Figure 13 This is a schematic diagram illustrating the execution process of the text display method provided in an embodiment of this application. For example... Figure 13 As shown, the data transmission method provided in this application embodiment may include the following steps 10 to 15.
[0163] Step 10: The electronic device reads all the vector information of the string to be displayed.
[0164] Step 11: The electronic device searches for duplicate and non-duplicate parts of the vector portion of the string.
[0165] Step 12: The electronic device has repeated parts.
[0166] Step 13: The electronic device draws the non-repeating parts.
[0167] Step 14: The electronic device copies the duplicate portion to the target location.
[0168] Step 15: The electronic device completes the string display.
[0169] In some embodiments of this application, by reducing the number of times the processing unit draws vector paths, electronic devices can significantly improve display speed and reduce lag when displaying large numbers of Chinese, Japanese, and Korean characters. For example, in e-reading scenarios, page-turning response speed is faster, and text redrawing is smoother; when switching mobile application interfaces, interfaces containing CJK characters can display complete content faster, improving the user interaction experience. Reducing the drawing tasks of the processing unit lowers the consumption of graphics processing resources and also reduces the amount of data transmission between processing units, thereby reducing the overall system power consumption. This is particularly important for devices with limited battery life, such as mobile devices, as it can extend the device's usage time.
[0170] Each of the above-described method embodiments, or various possible implementations of each method embodiment, can be executed individually or in combination of any two or more. The specific implementation can be determined according to actual usage requirements, and this application does not impose any restrictions on this.
[0171] The text display method provided in this application can be executed by a text display device. This application uses a text display device executing the text display method as an example to illustrate the text display device provided in this application.
[0172] Figure 14 A schematic diagram of a possible structure of a text display device involved in some embodiments of this application is shown. For example... Figure 14 As shown, the text display device 70 may include: an acquisition module 71, an execution module 72, and a display module 73.
[0173] The aforementioned acquisition module is used to acquire N vector information corresponding to the character to be displayed, where N is a positive integer.
[0174] The aforementioned execution module is used to perform a drawing operation once based on one vector information from each of the M groups of vector information to obtain M first-digit images. Each group of vector information includes at least two matching vector information from the N vector information obtained by the acquisition module, where M is a positive integer.
[0175] The aforementioned execution module is used to perform a drawing operation once for each of the N vector information obtained by the acquisition module, excluding the M groups of vector information, to obtain at least one second bitmap.
[0176] The aforementioned display module is used to display the character to be displayed based on the M first-bit images obtained by the execution module and at least one second-bit image obtained by the execution module.
[0177] In one possible implementation, the above execution module is further configured to: calculate the hash value corresponding to each vector information before performing a drawing operation on one vector information in each of the M groups of vector information; and group at least two vector information whose corresponding hash values match among the N vector information into a group of vector information.
[0178] In one possible implementation, each of the N vector information pieces includes at least one coordinate information piece. The execution module is further configured to perform a rounding operation on the coordinate values of each coordinate information piece of each of the N vector information pieces before calculating the hash value corresponding to each vector information piece.
[0179] In one possible implementation, the execution module is specifically used to perform a drawing operation once based on the first vector information in each group of vector information. Here, the first vector information is the first vector information in each group of vector information after being sorted according to the order in which the drawing operations are performed.
[0180] In one possible implementation, the execution module is further configured to perform at least one copy operation based on the first vector information in each group of vector information after performing a drawing operation based on the first vector information in each group of vector information. The number of copy operations performed for each group of vector information is the number of vector information in each group of vector information excluding the first vector information. The display module is specifically configured to display the character to be displayed based on M first bitmaps, the bitmap obtained by performing the copy operation, and at least one second bitmap.
[0181] This application provides a text display device. When the text display device acquires N vector information corresponding to the character to be displayed, it can generate M bitmaps by performing a drawing operation only once on one vector information from each of the M groups of vector information, without needing to perform drawing operations on the other vector information in each group. This reduces the number of drawing operations performed by the electronic device, thus reducing the consumption of system resources and the bitmap drawing time during the display of the character. This improves the text display efficiency.
[0182] The text display device in this application embodiment can be an electronic device or a component within an electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal or other devices besides a terminal. For example, the electronic device can be a mobile phone, tablet computer, laptop computer, PDA, in-vehicle electronic device, mobile internet device (MID), augmented reality (AR) / virtual reality (VR) device, robot, wearable device, ultra-mobile personal computer (UMPC), netbook, or personal digital assistant (PDA), etc. It can also be a server, network attached storage (NAS), personal computer (PC), television (TV), ATM, or self-service machine, etc. This application embodiment does not specifically limit the scope of the device.
[0183] The text display device in this application embodiment can be a device with an operating system. This operating system can be Android, iOS, or other possible operating systems; this application embodiment does not specifically limit the specific operating system used.
[0184] The text display device provided in this application embodiment can implement all the processes implemented in the above method embodiments, and will not be described again here to avoid repetition.
[0185] Optionally, such as Figure 15 As shown, this application embodiment also provides an electronic device 1000, including a processor 1001 and a memory 1002. The memory 1002 stores a program or instructions that can run on the processor 1001. When the program or instructions are executed by the processor 1001, they implement the various steps of the above-described text display method embodiment and can achieve the same technical effect. To avoid repetition, they will not be described again here.
[0186] It should be noted that the electronic devices in the embodiments of this application include the mobile electronic devices and non-mobile electronic devices described above.
[0187] Figure 16 A schematic diagram of the hardware structure of an electronic device to implement an embodiment of this application.
[0188] The electronic device 100 includes, but is not limited to, components such as: radio frequency unit 101, network module 102, audio output unit 103, input unit 104, sensor 105, display unit 106, user input unit 107, interface unit 108, memory 109, and processor 110.
[0189] Those skilled in the art will understand that the electronic device 100 may also include a power supply (such as a battery) for supplying power to various components. The power supply may be logically connected to the processor 110 through a power management system, thereby enabling functions such as managing charging, discharging, and power consumption through the power management system. Figure 16 The electronic device structure shown does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown, or combine certain components, or have different component arrangements, which will not be elaborated here.
[0190] The processor 110 is used to acquire N vector information corresponding to the character to be displayed, where N is a positive integer.
[0191] The processor 110 is used to perform a drawing operation once based on one vector information in each of the M groups of vector information to obtain M first-bit images. Each group of vector information includes at least two vector information that match the information in the N vector information obtained by the processor 110, where M is a positive integer.
[0192] The processor 110 described above is used to perform a drawing operation once for each of the N vector information (excluding the M groups of vector information) to obtain at least one second bitmap.
[0193] The aforementioned display unit 106 is used for displaying characters to be displayed using M first bit images and at least one second bit image.
[0194] Optionally, the processor 110 is further configured to: calculate the hash value corresponding to each vector information before performing a drawing operation on each vector information in each of the M groups of vector information; and group at least two vector information whose corresponding hash values match in the N vector information into a group of vector information.
[0195] Optionally, each of the N vector information pieces includes at least one coordinate information. The processor 110 is further configured to perform a rounding operation on the coordinate values of each coordinate information piece of each of the N vector information pieces before calculating the hash value corresponding to each vector information piece.
[0196] Optionally, the processor 110 is specifically configured to perform a drawing operation based on the first vector information in each group of vector information. The first vector information is the first vector information in each group of vector information after being sorted according to the order in which the drawing operations are performed.
[0197] Optionally, the processor 110 is further configured to perform at least one copy operation based on the first vector information in each group of vector information after performing a drawing operation based on the first vector information in each group of vector information. The number of times the copy operation is performed is the number of vector information in each group of vector information excluding the first vector information. The display unit 106 is specifically configured to display the character to be displayed based on M first bitmaps, the bitmap obtained by performing the copy operation, and at least one second bitmap.
[0198] This application provides an electronic device that, when it acquires N vector information corresponding to a character to be displayed, can generate M bitmaps by performing a drawing operation only once on one vector information from each of the M groups of vector information, without needing to perform drawing operations on the other vector information in each group. This reduces the number of drawing operations performed by the electronic device, thereby reducing the consumption of system resources and the bitmap drawing time during the display of the character. This improves the efficiency of text display.
[0199] The electronic device provided in this application embodiment can implement all the processes implemented in the above method embodiments and achieve the same technical effects. To avoid repetition, it will not be described again here. The beneficial effects of the various implementation methods in this embodiment can be found in the beneficial effects of the corresponding implementation methods in the above method embodiments. To avoid repetition, it will not be described again here.
[0200] It should be understood that, in this embodiment, the input unit 104 may include a GPU 1041 and a microphone 1042. The GPU 1041 processes image data of still images or videos obtained by an image capture device (such as a camera) in video capture mode or image capture mode. The display unit 106 may include a display panel 1061, which may be configured in the form of a liquid crystal display, an organic light-emitting diode, or the like. The user input unit 107 includes at least one of a touch panel 1071 and other input devices 1072. The touch panel 1071 is also called a touch screen. The touch panel 1071 may include a touch detection device and a touch controller. Other input devices 1072 may include, but are not limited to, physical keyboards, function keys (such as volume control buttons, power buttons, etc.), trackballs, mice, and joysticks, which will not be described in detail here.
[0201] The memory 109 can be used to store software programs and various data. The memory 109 may primarily include a first storage area for storing programs or instructions and a second storage area for storing data. The first storage area may store the operating system, application programs or instructions required for at least one function (such as sound playback, image playback, etc.). Furthermore, the memory 109 may include volatile memory or non-volatile memory, or both. The non-volatile memory may be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory can be random access memory (RAM), static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct memory bus RAM (DRRAM). The memory 109 in the embodiments of this application includes, but is not limited to, these and any other suitable types of memory.
[0202] Processor 110 may include one or more processing units; optionally, processor 110 integrates an application processor and a modem processor, wherein the application processor mainly handles operations involving the operating system, user interface, and applications, and the modem processor mainly handles wireless communication signals, such as a baseband processor. It is understood that the aforementioned modem processor may also not be integrated into processor 110.
[0203] This application also provides a readable storage medium storing a program or instructions. When the program or instructions are executed by a processor, they implement the various processes of the above-described text display method embodiments and achieve the same technical effect. To avoid repetition, they will not be described again here.
[0204] The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media, such as computer read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.
[0205] This application embodiment also provides a chip, which includes a processor and a communication interface. The communication interface is coupled to the processor. The processor is used to run programs or instructions to implement the various processes of the above-described text display method embodiments and can achieve the same technical effect. To avoid repetition, it will not be described again here.
[0206] It should be understood that the chip mentioned in the embodiments of this application may also be referred to as a system-on-a-chip, system chip, chip system, or system-on-a-chip, etc.
[0207] This application provides a computer program product, which is stored in a storage medium and executed by at least one processor to implement the various processes of the text display method embodiment described above, and can achieve the same technical effect. To avoid repetition, it will not be described again here.
[0208] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. Furthermore, it should be noted that the scope of the methods and apparatuses in the embodiments of this application is not limited to performing functions in the order shown or discussed, but may also include performing functions substantially simultaneously or in the reverse order, depending on the functions involved. For example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.
[0209] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a computer software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0210] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.
Claims
1. A method for displaying text, characterized in that, include: Obtain N vector information corresponding to the character to be displayed, where N is a positive integer; Based on one vector from each of the M groups of vector information, a drawing operation is performed once to obtain M first-digit images. Each group of vector information includes at least two matching vectors from the N groups of vector information, where M is a positive integer. Based on each of the N vector information (excluding the M groups of vector information), perform a drawing operation once to obtain at least one second bitmap; The character to be displayed is shown based on the M first-bit images and the at least one second-bit image.
2. The method according to claim 1, characterized in that, Before performing a drawing operation once for each vector information in each of the M groups of vector information, the method further includes: Calculate the hash value corresponding to each vector information; The vector information that matches the hash value of the corresponding N vector information is grouped into a set of vector information.
3. The method according to claim 2, characterized in that, Each of the N vector information pieces includes at least one coordinate information; Before calculating the hash value corresponding to each vector information respectively, the method further includes: The coordinate values of each coordinate information of each of the N vector information are rounded down.
4. The method according to claim 1, characterized in that, The drawing operation is performed once for each vector information in each of the M groups of vector information, including: Perform a drawing operation once based on the first vector information in each group of vector information; The first vector information is the first vector information in each group of vector information after being sorted according to the order in which the drawing operations were performed.
5. The method according to claim 4, characterized in that, After performing a drawing operation based on the first vector information in each group of vector information, the method further includes: Perform at least one copy operation based on the first image corresponding to each group of vector information. The number of copy operations performed for each group of vector information is the number of vector information in each group of vector information excluding the first vector information. The process of displaying the character to be displayed based on the M first-bit images and the at least one second-bit image includes: The character to be displayed is based on the M first bitmaps, the bitmap obtained by performing a copy operation, and the at least one second bitmap.
6. A text display device, characterized in that, include: The module includes an acquisition module, an execution module, and a display module. The acquisition module is used to acquire N vector information corresponding to the character to be displayed, where N is a positive integer; The execution module is used to perform a drawing operation once based on one vector information in each of the M groups of vector information to obtain M first-digit images. Each group of vector information includes at least two vector information that match the information in the N vector information obtained by the acquisition module. M is a positive integer. The execution module is used to perform a drawing operation once for each of the N vector information obtained by the acquisition module, excluding the M groups of vector information, to obtain at least one second bitmap; The display module is used to display the character to be displayed based on the M first bit images obtained by the execution module and the at least one second bit image obtained by the execution module.
7. The apparatus according to claim 6, characterized in that, The execution module is further configured to: Before performing a drawing operation on one vector information in each of the M groups of vector information, the hash value corresponding to each vector information is calculated. as well as, The vector information that matches the hash value of the corresponding N vector information is grouped into a set of vector information.
8. The apparatus according to claim 7, characterized in that, Each of the N vector information pieces includes at least one coordinate information; The execution module is further configured to perform a rounding operation on the coordinate values of each coordinate information of each of the N vector information before calculating the hash value corresponding to each vector information.
9. The apparatus according to claim 6, characterized in that, The execution module is specifically used to perform a drawing operation once based on the first vector information in each group of vector information; The first vector information is the first vector information in each group of vector information after being sorted according to the order in which the drawing operations were performed.
10. An electronic device, characterized in that, It includes a processor and a memory, the memory storing a program or instructions that can run on the processor, the program or instructions being executed by the processor to implement the steps of the text display method as described in any one of claims 1 to 5.