Character display method and device, computer equipment and storage medium
By obtaining and processing the encoding and component information of the text to be displayed, dynamically generate pixel dot matrix data, solving the problem of poor adaptability of text display in traditional technology, and achieving efficient text display to adapt to display screens of different resolutions.
Patent Information
- Application Number
- CN202411332723.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-24
- Publication Date
- 2025-02-18
AI Technical Summary
Traditional technology cannot adapt to display screens of different resolutions when displaying text, resulting in poor display adaptability.
By obtaining the encoding, position and font size of the text to be displayed, the vector data and component information of the corresponding components to be displayed, including relative position and proportional parameters, and dynamically generate pixel lattice data to adapt to different resolutions.
Improves the adaptability of text display, reduces storage space requirements, and reduces the cost and power consumption of embedded systems.
Smart Images

Figure CN119476199A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of display technology, and in particular to a text display method, device, computer equipment and storage medium. Background Art
[0002] With the rapid development of embedded technology, embedded systems play an important role in smart home, smart manufacturing, autonomous driving, medical equipment and other fields. Embedded devices display human-computer interaction interfaces through display screens. When embedded devices need to display text on the display screen, they usually obtain the corresponding text in units of each word and display the corresponding text.
[0003] In the traditional technology, the embedded device loads each complete text and then displays each complete text on the display screen. However, since the traditional technology can only generate complete text, it has poor adaptability to different display screens when displaying and cannot adapt to display screens with different resolutions. Summary of the invention
[0004] Based on this, it is necessary to provide a text display method, device, computer equipment and storage medium to address the above technical problems.
[0005] In a first aspect, the present application provides a text display method, the method comprising: obtaining a text code to be displayed, a position to be displayed and a font size to be displayed corresponding to the text to be displayed; determining, based on the text code to be displayed, vector data to be displayed and component information to be displayed of a component to be displayed corresponding to the text to be displayed; the component information to be displayed includes a relative position and relative scale parameters of the component to be displayed; and displaying the text to be displayed based on the component information to be displayed, the vector data to be displayed, the position to be displayed and the font size to be displayed.
[0006] In one of the embodiments, determining the vector data to be displayed and the component information to be displayed of the component to be displayed corresponding to the text to be displayed according to the code of the text to be displayed includes: determining the component code to be displayed and the component information to be displayed of the component to be displayed corresponding to the text to be displayed according to the code of the text to be displayed and the code mapping relationship; determining the vector data to be displayed corresponding to the component code to be displayed according to the code of the component to be displayed and the vector library.
[0007] In one of the embodiments, the method also includes: splitting all characters to determine the basic components corresponding to each character and the component information of each basic component; generating vector data and component codes corresponding to each basic component based on all the basic components; constructing a vector library based on the vector data and component codes corresponding to each basic component; and constructing a coding mapping relationship based on the character code of each character, the component code of the basic component corresponding to each character, and the component information.
[0008] In one of the embodiments, generating vector data and component codes corresponding to each basic component based on all basic components includes: vectorizing all basic components to obtain vector data corresponding to each basic component; encoding all basic components to obtain component codes corresponding to each basic component.
[0009] In one of the embodiments, displaying the text to be displayed according to the component information to be displayed, the vector data to be displayed, the position to be displayed and the font size to be displayed includes: determining the pixel dot matrix data of the text to be displayed according to the relative scale parameters of the component to be displayed corresponding to the text to be displayed, the vector data to be displayed and the font size to be displayed; determining the display starting position of the text to be displayed according to the relative position of the component to be displayed corresponding to the text to be displayed and the position to be displayed; displaying the text to be displayed according to the pixel dot matrix data and the display starting position of the text to be displayed.
[0010] In one of the embodiments, determining the pixel dot matrix data of the text to be displayed according to the relative proportion parameters of the component to be displayed corresponding to the text to be displayed, the vector data to be displayed and the font size to be displayed includes: determining the actual display proportion of the component to be displayed according to the relative proportion parameters of the component to be displayed corresponding to the text to be displayed and the font size to be displayed; adjusting the corresponding vector data to be displayed according to the actual display proportion to determine the pixel dot matrix data of the component to be displayed; determining the pixel dot matrix data of the text to be displayed according to the pixel dot matrix data of the component to be displayed.
[0011] In one of the embodiments, determining the display starting position of the text to be displayed based on the relative position of the component to be displayed corresponding to the text to be displayed and the position to be displayed includes: adjusting the position to be displayed based on the relative position of the component to be displayed corresponding to the text to be displayed to determine the display starting position of the component to be displayed; determining the display starting position of the text to be displayed based on the display starting position of the component to be displayed.
[0012] In the second aspect, the present application also provides a text display device, which includes: an acquisition module, used to obtain the text code to be displayed, the position to be displayed and the font size to be displayed corresponding to the text to be displayed; a search module, used to determine the vector data to be displayed and the component information to be displayed of the component to be displayed corresponding to the text to be displayed according to the text code to be displayed; the component information to be displayed includes the relative position and relative scale parameters of the component to be displayed; a display module, used to display the text to be displayed according to the component information to be displayed, the vector data to be displayed, the position to be displayed and the font size to be displayed.
[0013] In a third aspect, the present application further provides a computer device, wherein the computer device comprises a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, any one of the text display methods in the first aspect is implemented.
[0014] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, any one of the text display methods in the first aspect is implemented.
[0015] The above-mentioned text display method, device, computer equipment and storage medium first obtain the text code to be displayed, the position to be displayed and the font size to be displayed corresponding to the text to be displayed, and then determine the vector data to be displayed and the component information to be displayed of the component to be displayed corresponding to the text to be displayed according to the text code to be displayed, and finally display the text to be displayed according to the component information to be displayed, the vector data to be displayed, the position to be displayed and the font size to be displayed. By obtaining the vector data to be displayed of the component to be displayed corresponding to the text to be displayed, and then displaying the text to be displayed according to the vector data to be displayed, the position to be displayed and the font size to be displayed, it can adapt to display screens with different resolutions, thereby improving the adaptability of text display. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 A flowchart of a text display method in one embodiment;
[0017] Figure 2 is a flow chart of a text display method in another embodiment;
[0018] Figure 3 is a structural block diagram of a text display device in an embodiment;
[0019] Figure 4 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0020] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0021] An embedded system is composed of hardware and software and is a device that can operate independently. Its software part includes the software operating environment and its operating system. The hardware part includes a hardware structure including a processor, a memory, a communication module, and a display. Compared with a general computer processing system, an embedded system cannot realize a large-capacity storage function because there is no large-capacity medium that matches it. Most of the storage media used are E-PROM, EEPROM, etc. The text display method provided in this application is applied to the processor of an embedded system.
[0022] In one embodiment, Figure 1 As shown, a text display method is provided, comprising the following steps:
[0023] Step 101, obtaining the character code to be displayed, the position to be displayed and the font size to be displayed corresponding to the character to be displayed.
[0024] When the embedded system needs to display text, first, based on the user input, the text to be displayed, that is, the text to be displayed, is obtained. Among them, the user can input the text to be displayed through the input device of the embedded system, for example, through the touch screen, keyboard or mouse of the embedded system. The user also needs to input the position to be displayed of the text to be displayed in the display of the embedded system and the font size to be displayed. Among them, the position to be displayed can be coordinate information, indicating that the text to be displayed needs to be displayed at the corresponding coordinate position in the display, and the coordinate information can be the coordinates of the first pixel point in the upper left corner of the text to be displayed. The font size to be displayed indicates the size of the text to be displayed in the display. After obtaining the text to be displayed, the text to be displayed is converted into the text encoding corresponding to the text to be displayed, that is, the text encoding to be displayed, through the text encoding standard. Among them, the text encoding standard can be: ANSI encoding, UTF-8 encoding, UTF-8-BOM encoding, UTF-8BigEndian encoding and UTF-8LittleEndian encoding, etc. The specific encoding standard can be GB2312-80 encoding, GBK encoding standard, GB18030 encoding standard, etc. This embodiment does not make specific limitations, and it only needs to be able to convert text into a unique corresponding text encoding.
[0025] When only one character needs to be displayed, the character to be displayed consists of only one character. At this time, it is necessary to obtain the character encoding, display position, and display font size corresponding to this character. For example, if it is necessary to display the character "打" on the display of an embedded system, it is necessary to obtain the character encoding corresponding to the character "打", the display coordinates of the character "打" on the display, and the display font size of the character "打".
[0026] When multiple characters need to be displayed, the characters to be displayed include multiple characters. At this time, it is necessary to obtain the character encoding, display position, and display font size corresponding to each character. For example, if it is necessary to display "马到成功" on the display of an embedded system, it is necessary to separately obtain the character encodings corresponding to the four characters "马", "到", "成", and "功", the display coordinates of the four characters "马", "到", "成", and "功" on the display respectively, and the display font sizes of the four characters "马", "到", "成", and "功". When there are multiple characters, the display font sizes of each character to be displayed can be the same or different, and this embodiment does not make specific limitations.
[0027] Step 102, determine the vector data to be displayed and the component information to be displayed of the component to be displayed corresponding to the character to be displayed according to the character encoding to be displayed.
[0028] Before determining the vector data to be displayed and the component information to be displayed of the component to be displayed corresponding to the character to be displayed, it is necessary to construct a coding mapping relationship and a vector library.
[0029] Step 1, split all characters, and determine the basic components corresponding to each character and the component information of each basic component.
[0030] When constructing the encoding mapping relationship and the vector library, it is first necessary to determine all the characters that need to be displayed on the embedded system. Among them, all the characters can be all Chinese characters, or some Chinese characters that the embedded system may use. This embodiment does not make specific limitations, and only needs to ensure that all the characters can support the character display of the embedded system. After determining all the characters, it is necessary to split each character to determine the basic components corresponding to each character and the component information of the basic components corresponding to each character. Among them, the component information is the relative position and relative proportion parameters of the basic components corresponding to each character in the character. Through the combination of basic components, all characters can be combined. For example, the basic components can be radicals, strokes, or the whole character, and it is specifically necessary to determine the basic components according to the characteristics of each character. For example, the basic components of the character "打" include "扌" and "丁"; the basic component of the character "一" includes "一", and the basic components of the character "涵" include "氵" and "函". While splitting the character into the corresponding basic components, it is necessary to determine the relative position and relative proportion parameters of the basic components in the character. Among them, the relative position is the relative position of each basic component that makes up the character in the character, and the relative position can be coordinates, that is, the coordinates of the first pixel point in the upper left corner of the component to be displayed. The relative proportion parameter is the relative proportion parameter of each basic component that makes up the character in the character, and the relative proportion parameter can be a percentage. For example, the basic components of the character "打" include "扌" and "丁". After determining the basic components, it is determined that the relative position of "扌" in the character "打" is (10, 10), and the relative proportion parameter is 100%; it is determined that the relative position of "丁" in the character "打" is (30, 10), and the relative proportion parameter is 80%. It can be understood that the corresponding range of each character is set. For example, each character corresponds to a range of 60*60. After splitting the character "打", the position corresponding to "扌" is at the position of (10, 10) in the 60*60 range; the position corresponding to "丁" is at the position of (30, 10) in the 60*60 range. Since the "扌" of the character "打" is slightly larger than "丁", the relative proportion parameter of "扌" is 100%, and the relative proportion parameter of "丁" is 80%. For example, the basic component of the character "一" includes "一". After determining the basic component, the position corresponding to "一" is at the position of (10, 30) in the 60*60 range, that is, the relative position is (10, 30), and the relative proportion parameter is 100%.
[0031] The text can be split manually in advance by deep learning, and the basic components corresponding to each text and the component information of each basic component in each text are generated. A data set is constructed according to each text and the basic components corresponding to each text and the component information of each basic component in each text. The deep learning model is trained by the data set to obtain a text splitting model based on the deep learning model. When the text needs to be split, all the texts that need to be split are input into the text splitting model to obtain the basic components corresponding to each text and the component information of each basic component. It can be understood that all the texts that need to be split can also be directly split manually to obtain the basic components corresponding to each text and the component information of each basic component. The embodiments of the present application are not specifically limited.
[0032] Step 2: Generate vector data and component code corresponding to each basic component based on all basic components.
[0033] After obtaining the basic components of all the text, all the basic components are vectorized to obtain the vector data corresponding to each basic component; all the basic components are encoded to obtain the component code corresponding to each basic component. The vector data may be a mathematical equation or a parameterized curve representing the basic component, for example, a Bezier curve. Converting text to Bezier curves is a font design technology. By using Bezier curves, developers can use high-quality vector text in different applications. After obtaining the basic components corresponding to all the text, each basic component needs to be encoded to obtain the component code corresponding to each component. For example, if all the text is split and 20 basic components are obtained, then the component code for each basic component is started by using 20 numbers from 1 to 20 to obtain the component code corresponding to each basic component.
[0034] Step 3: Build a vector library based on the vector data corresponding to each basic component and the component code.
[0035] After obtaining the vector data and component code, a vector library is constructed. The vector library stores the component code of each basic component and the vector data corresponding to the component code. When using the vector library, the vector data corresponding to the component code can be found through the component code of the basic component.
[0036] Step 4: construct a coding mapping relationship according to the text code of each character, the component code of the basic component corresponding to each character, and the component information.
[0037] After obtaining the component codes and component information of the basic components corresponding to each character, a coding mapping relationship is constructed. The character code of each character corresponds to the component codes and corresponding component information of each basic component that makes up the character. For example, in the coding mapping relationship, the character code of the character "打" is stored, and the character code of the character "打" corresponds to the component code and component information of "扌" and the component code and component information of "丁". When using the coding mapping relationship, the component codes and component information of the basic components corresponding to the character code can be found through the character code.
[0038] After the vector library and the coding mapping relationship are constructed, by looking up the coding mapping relationship according to the character code to be displayed, the component codes and component information of the basic components corresponding to the character to be displayed can be obtained, that is, the component codes and component information of the component to be displayed. Among them, the component information to be displayed includes the relative position and relative proportion parameters of the component to be displayed. After the component code to be displayed is determined, by looking up the vector library through the component code to be displayed, the vector data corresponding to the component code to be displayed can be determined, that is, the vector data to be displayed.
[0039] Step 103: Display the character to be displayed according to the component information to be displayed, the vector data to be displayed, the position to be displayed, and the font size to be displayed.
[0040] After obtaining the component information to be displayed and the vector data to be displayed, the character to be displayed is displayed in combination with the position to be displayed and the font size to be displayed input by the user.
[0041] For the above text display method, first, the character code to be displayed, the position to be displayed, and the font size to be displayed corresponding to the character to be displayed are obtained. Then, according to the character code to be displayed, the vector data to be displayed and the component information of the component to be displayed corresponding to the character to be displayed are determined. Finally, the character to be displayed is displayed according to the component information to be displayed, the vector data to be displayed, the position to be displayed, and the font size to be displayed. By obtaining the vector data to be displayed of the component to be displayed corresponding to the character to be displayed, and then displaying the character to be displayed according to the vector data to be displayed, the position to be displayed, and the font size to be displayed, it can adapt to displays with different resolutions, thereby improving the adaptability of text display. By first splitting all characters into basic components, vectorizing the basic components, encoding the basic components, and constructing a vector library for storage, the storage space required on the embedded system can be significantly reduced. Compared with the traditional technology of storing all entire characters, only the vector data and component information of the necessary basic components need to be stored to complete the construction of the vector library. Further, on the basis of reducing the storage space and reducing the processing of a large amount of font data, when designing the embedded system, the cost of the embedded system can be reduced, and the power consumption of the embedded system can be reduced. This is particularly important for embedded systems that need to run for a long time.
[0042] In one embodiment, determining the to-be-displayed vector data and the to-be-displayed component information of the to-be-displayed component corresponding to the to-be-displayed text according to the to-be-displayed text encoding specifically includes: determining the to-be-displayed component encoding and the to-be-displayed component information of the to-be-displayed component corresponding to the to-be-displayed text according to the to-be-displayed text encoding and the encoding mapping relationship; determining the to-be-displayed vector data corresponding to the to-be-displayed component encoding according to the to-be-displayed component encoding and the vector library.
[0043] When the embedded system only needs to display the character "打", then the character "打" is the to-be-displayed text for this time. First, obtain the to-be-displayed text encoding of the character "打". By looking up the encoding mapping relationship through the to-be-displayed text encoding, determine the two basic components corresponding to the character "打", that is, the to-be-displayed component encodings and the to-be-displayed component information of the to-be-displayed components "扌" and "丁". Then, look up the vector library through the to-be-displayed component encodings of "扌" and "丁" to determine the vector data of "扌" and "丁".
[0044] When the embedded system needs to display "懈獬廨澥邂", then "懈獬廨澥邂" is the to-be-displayed text for this time. First, obtain the to-be-displayed text encodings corresponding to each character of "懈", "獬", "廨", "澥", and "邂" respectively. By looking up the encoding mapping relationship through the to-be-displayed text encoding, determine the to-be-displayed component encodings and the to-be-displayed component information of the to-be-displayed components "忄" and "解" corresponding to "懈"; the to-be-displayed component encodings and the to-be-displayed component information of the to-be-displayed components "犭" and "解" corresponding to "獬"; the to-be-displayed component encodings and the to-be-displayed component information of the to-be-displayed components "广" and "解" corresponding to "廨"; the to-be-displayed component encodings and the to-be-displayed component information of the to-be-displayed components "氵" and "解" corresponding to "澥"; the to-be-displayed component encodings and the to-be-displayed component information of the to-be-displayed components "辶" and "解" corresponding to "邂". It can be understood that in the above to-be-displayed text, each character has the basic component "解". Therefore, when obtaining the vector data subsequently, it only needs to be obtained once. That is, look up the vector library through the to-be-displayed component encodings of "忄", "犭", "广", "氵", "辶", and "解" to determine the vector data of "忄", "犭", "广", "氵", "辶", and "解".
[0045] By only obtaining the repeated information once when obtaining the information of the to-be-displayed text, the power consumption of the embedded system is reduced.
[0046] In one embodiment, as Figure 2 shown, a text display method is provided, including the following steps:
[0047] Step 201, determine the pixel dot matrix data of the to-be-displayed text according to the relative proportion parameter, the to-be-displayed vector data, and the to-be-displayed font size of the to-be-displayed component corresponding to the to-be-displayed text.
[0048] After determining the relative proportion parameters, the to-be-displayed vector data, and the to-be-displayed font size of all to-be-displayed components of the to-be-displayed text, the actual display proportion of the to-be-displayed components is determined according to the relative proportion parameters and the to-be-displayed font size of the to-be-displayed components corresponding to the to-be-displayed text. When the embedded system only needs to display the character "打" (da), the to-be-displayed components corresponding to the character "打" include "扌" (left hand radical) and "丁" (ding). Multiply the relative proportion parameter corresponding to "扌" by the to-be-displayed font size to determine the actual display proportion of "扌"; multiply the relative proportion parameter corresponding to "丁" by the to-be-displayed font size to determine the actual display proportion of "丁". Then, adjust the corresponding to-be-displayed vector data according to the actual display proportion to determine the pixel dot matrix data of the to-be-displayed components. Since the to-be-displayed vector data is a Bezier curve, the actual displayed pixel dot matrix data of the corresponding to-be-displayed components can be determined through the Bezier curve and the actual display proportion. Multiply the actual display proportion of "扌" by the to-be-displayed vector data of "扌" to determine the pixel dot matrix data of "扌"; multiply the actual display proportion of "丁" by the to-be-displayed vector data of "丁" to determine the pixel dot matrix data of "丁". Finally, according to the pixel dot matrix data of the to-be-displayed components, the pixel dot matrix data of the to-be-displayed text is determined. That is, the pixel dot matrix data of "扌" and the pixel dot matrix data of "丁" constitute the pixel dot matrix data of the character "打".
[0049] Step 202: Determine the display start position of the to-be-displayed text according to the relative position and the to-be-displayed position of the to-be-displayed components corresponding to the to-be-displayed text.
[0050] After determining the relative positions and display positions of the display components for all the text to be displayed, adjust the display positions according to the relative positions of the display components corresponding to the text to be displayed, and determine the display start positions of the display components. Here, the display position is the position where the text to be displayed needs to be shown on the display, and the relative position is the relative position of each basic component in the text. By adjusting the display position according to the relative position, the display start position for the display component to be actually displayed can be determined. When the embedded system only needs to display the character "打", the display components corresponding to the character "打" include "扌" and "丁". Adjust the display position of the character "打" according to the relative position corresponding to "扌", and the display start position where "扌" is actually displayed can be determined. For example, the abscissa of the relative position corresponding to "扌" can be added to the abscissa of the display position of the character "打" to obtain the abscissa of the display start position of "扌", and the ordinate of the relative position corresponding to "扌" can be added to the ordinate of the display position of the character "打" to obtain the ordinate of the display start position of "扌". Adjust the display position of the character "打" according to the relative position corresponding to "丁", and the display start position where "丁" is actually displayed can be determined. For example, the abscissa of the relative position corresponding to "丁" can be added to the abscissa of the display position of the character "打" to obtain the abscissa of the display start position of "丁", and the ordinate of the relative position corresponding to "丁" can be added to the ordinate of the display position of the character "打" to obtain the ordinate of the display start position of "丁". Finally, according to the display start positions of the display components, determine the display start position of the text to be displayed. That is, the display start position of "扌" and the display start position of "丁" constitute the display start position of the character "打".
[0051] Step 203: Display the text to be displayed according to the pixel dot matrix data of the text to be displayed and the display start position.
[0052] After determining the pixel dot matrix data and display start position corresponding to each text to be displayed, perform text display of the text to be displayed on the display screen of the embedded system. For example, when the embedded system only needs to display the character "打", display the pixel dot matrix data of "扌" at the display start position of "扌"; display the pixel dot matrix data of "丁" at the display start position of "丁", thereby completing the display of the entire character "打".
[0053] Through the vector data of the component to be displayed, the pixel dot matrix data of the text to be displayed is dynamically generated according to the font size and position to be displayed, avoiding the waste of resources caused by preloading the entire text, and the dynamically generated pixel dot matrix data can be optimized according to the resolution and display requirements of the embedded device, thereby ensuring the clarity and smoothness of the display quality. Through the characteristics of dynamic generation, it can adapt to embedded systems with different resolutions, whether it is a small smart watch or a high-resolution tablet computer, the quality and adaptability of the font can be guaranteed. And through the characteristics of dynamic display, it can respond quickly when the user operates, thereby ensuring the smoothness and timeliness of the display interface, while enabling users to obtain high-quality text display.
[0054] In the field of embedded systems, text display technology faces challenges due to the limited performance and storage space of embedded systems. Traditional text display methods usually store complete text data, which will take up a lot of storage space, and when displaying a large number of texts, the data of each text will be read, consuming a lot of performance. In the embodiment of the present application, all texts are split to realize the componentization of texts, and then each basic component is vectorized to realize text display, which can solve the above problems. By decomposing each text into a common basic component, and recording the relative position and relative scale parameters of each basic component of each text in the corresponding text, and then converting each basic component into vector image data, the storage space required for the embedded system can be significantly reduced. At the same time, when displaying text, by reading the vector data to be displayed of the component to be displayed corresponding to each text to be displayed and the information of the component to be displayed, and displaying through vector data, it is possible to ensure high-quality display of text while reducing storage space. When constructing a vector library, if vector data of different fonts are constructed for the basic components, multiple font types can also be supported.
[0055] In one specific embodiment, first, the text needs to be componentized. All the text is split into different basic components, and then all the basic components are represented as mathematical equations or parametric curves. For example, it can be a Bezier curve, which facilitates maintaining clarity and scalability at different resolutions later. By generating a vector library, the storage amount of the overall text in the text library is reduced, thereby reducing the storage space occupied by the vector library. When splitting all the text, determine the relative position and relative scale parameter of each basic component corresponding to each character. For example, the basic components of the character "打" include "扌" and "丁". The relative position of "扌" in the character "打" is (10, 10), and the relative scale parameter is 100%; the relative position of "丁" in the character "打" is (30, 10), and the relative scale parameter is 80%. Construct a vector library and a coding mapping relationship based on the above information. When it is necessary to display text on an embedded system, obtain the code of the text to be displayed corresponding to the text to be displayed. Through the code of the text to be displayed, search for the vector library and the coding mapping relationship, and determine the vector data to be displayed, the relative position, and the relative scale parameter of the component to be displayed corresponding to the text to be displayed. For example, in the character "打", the vector data to be displayed of "扌": C(1), the relative position: S1 = (X1, Y1), the relative scale parameter: P1; the vector data to be displayed of "丁": C(2), the relative position: S2 = (X2, Y2), the relative scale parameter: P2. The position to be displayed of the obtained character "打": (Gx, Gy); the font size to be displayed: D. Then the starting position of the display of "扌" is: G1 = (X1 + Gx, Y1 + Gy); the pixel dot matrix data is: R1(D) = C(1) * (D * P1); the starting position of the display of "丁" is G2 = (X2 + Gx, Y2 + Gy), and the pixel dot matrix data is: R2(D) = C(2) * (D * P2). Finally, through the starting position of the display and the pixel dot matrix data, the corresponding text to be displayed is displayed on the display of the embedded system.
[0056] In the above embodiment, by encoding and vectorizing the basic components, the storage space occupied by the database on the embedded system can be significantly reduced. Dynamically generating the pixel dot matrix data of the text to be displayed improves the display quality and display smoothness, and can make the generated pixel dot matrix data adapt to displays with different resolutions, thereby improving the adaptability of text display.
[0057] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0058] Based on the same inventive concept, the embodiment of the present application also provides a text display device for implementing the text display method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more text display device embodiments provided below can refer to the limitations on the text display method above, and will not be repeated here.
[0059] In one embodiment, Figure 3 As shown, a text display device is provided, including: an acquisition module 301, a search module 302 and a display module 303, wherein:
[0060] The acquisition module 301 is used to acquire the character code to be displayed, the position to be displayed and the font size to be displayed corresponding to the character to be displayed;
[0061] The search module 302 is used to determine the to-be-displayed vector data and the to-be-displayed component information of the to-be-displayed component corresponding to the to-be-displayed text according to the to-be-displayed text code; the to-be-displayed component information includes the relative position and relative scale parameters of the to-be-displayed component;
[0062] The display module 303 is used to display the text to be displayed according to the component information to be displayed, the vector data to be displayed, the position to be displayed and the font size to be displayed.
[0063] The search module 302 is also used to determine the component code to be displayed and the component information to be displayed of the component to be displayed corresponding to the text to be displayed according to the text code to be displayed and the code mapping relationship; and determine the vector data to be displayed corresponding to the component code to be displayed according to the component code to be displayed and the vector library.
[0064] The text display device also includes: a preprocessing module.
[0065] The preprocessing module is used to split all characters, determine the basic components corresponding to each character and the component information of each basic component; generate vector data and component codes corresponding to each basic component according to all basic components; construct a vector library according to the vector data and component codes corresponding to each basic component; construct a coding mapping relationship according to the character code of each character, the component code of the basic component corresponding to each character and the component information.
[0066] The preprocessing module is also used to perform vectorization processing on all basic components to obtain vector data corresponding to each of the basic components; and perform encoding processing on all basic components to obtain component codes corresponding to each of the basic components.
[0067] The display module 303 is further used to determine the pixel dot matrix data of the text to be displayed according to the relative scale parameters of the component to be displayed corresponding to the text to be displayed, the vector data to be displayed and the font size to be displayed; determine the display starting position of the text to be displayed according to the relative position of the component to be displayed corresponding to the text to be displayed and the position to be displayed; and display the text to be displayed according to the pixel dot matrix data and the display starting position of the text to be displayed.
[0068] The display module 303 is also used to determine the actual display ratio of the component to be displayed according to the relative ratio parameters of the component to be displayed corresponding to the text to be displayed and the font size to be displayed; adjust the corresponding vector data to be displayed according to the actual display ratio to determine the pixel dot matrix data of the component to be displayed; determine the pixel dot matrix data of the text to be displayed according to the pixel dot matrix data of the component to be displayed.
[0069] The display module 303 is further used to adjust the position to be displayed according to the relative position of the component to be displayed corresponding to the text to be displayed, and determine the display starting position of the component to be displayed; according to the display starting position of the component to be displayed, determine the display starting position of the text to be displayed.
[0070] Each module in the above-mentioned text display device can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module above.
[0071] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Figure 4As shown. The computer device includes a processor, a memory, a communication interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be achieved through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a text display method is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covered on the display screen, or a key, trackball or touchpad set on the computer device housing, or an external keyboard, touchpad or mouse, etc.
[0072] Those skilled in the art will understand that Figure 4 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0073] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, any one of the text display methods in the above embodiments is implemented.
[0074] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, any one of the text display methods in the above embodiments is implemented.
[0075] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0076] The technical features of the above embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0077] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be construed as limiting the scope of the present application. It should be noted that, for a person of ordinary skill in the art, several modifications and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A text display method, characterized in that: The method comprises: Obtain the text code to be displayed, the position to be displayed, and the font size to be displayed corresponding to the text to be displayed; According to the code of the text to be displayed, determining the vector data to be displayed and the component information to be displayed of the component to be displayed corresponding to the text to be displayed; the component information to be displayed includes the relative position and relative scale parameters of the component to be displayed; The text to be displayed is displayed according to the component information to be displayed, the vector data to be displayed, the position to be displayed and the font size to be displayed.
2. The method according to claim 1, characterized in that The step of determining the to-be-displayed vector data and the to-be-displayed component information of the to-be-displayed component corresponding to the to-be-displayed character code according to the to-be-displayed character code includes: Determine the component code to be displayed and the component information to be displayed of the component to be displayed corresponding to the text to be displayed according to the code of the text to be displayed and the code mapping relationship; According to the component code to be displayed and the vector library, vector data to be displayed corresponding to the component code to be displayed is determined.
3. The method according to claim 2, characterized in that The method further comprises: Split all characters to determine the basic components corresponding to each character and the component information of each basic component; According to all basic components, vector data and component codes corresponding to each basic component are generated; Build a vector library based on the vector data and component code corresponding to each basic component; A coding mapping relationship is constructed according to the text code of each character, the component code of the basic component corresponding to each character, and the component information.
4. The method according to claim 3, characterized in that: The step of generating vector data and component code corresponding to each basic component according to all basic components includes: Performing vectorization processing on all basic components to obtain vector data corresponding to each of the basic components; All basic components are encoded to obtain component codes corresponding to each basic component.
5. The method according to claim 1, characterized in that The displaying of the text to be displayed according to the component information to be displayed, the vector data to be displayed, the position to be displayed and the font size to be displayed comprises: Determine pixel dot matrix data of the text to be displayed according to the relative proportion parameter of the component to be displayed corresponding to the text to be displayed, the vector data to be displayed, and the font size to be displayed; Determining a display start position of the text to be displayed according to the relative position of the component to be displayed corresponding to the text to be displayed and the position to be displayed; The text to be displayed is displayed according to the pixel matrix data of the text to be displayed and the display starting position.
6. The method according to claim 5, characterized in that Determining the pixel matrix data of the text to be displayed according to the relative proportion parameter of the component to be displayed corresponding to the text to be displayed, the vector data to be displayed, and the font size to be displayed comprises: Determining the actual display ratio of the component to be displayed according to the relative ratio parameter of the component to be displayed corresponding to the text to be displayed and the font size to be displayed; Adjust the vector data to be displayed corresponding to the actual display ratio to determine the pixel dot matrix data of the component to be displayed; The pixel dot matrix data of the text to be displayed is determined according to the pixel dot matrix data of the component to be displayed.
7. The method according to claim 5, characterized in that The step of determining the display starting position of the text to be displayed according to the relative position of the component to be displayed corresponding to the text to be displayed and the position to be displayed comprises: Adjusting the position to be displayed according to the relative position of the component to be displayed corresponding to the text to be displayed, and determining the display starting position of the component to be displayed; According to the display starting position of the component to be displayed, the display starting position of the text to be displayed is determined.
8. A text display device, characterized in that: The device comprises: An acquisition module is used to acquire the character code to be displayed, the position to be displayed and the font size to be displayed corresponding to the character to be displayed; A search module, used to determine the to-be-displayed vector data and the to-be-displayed component information of the to-be-displayed component corresponding to the to-be-displayed text according to the to-be-displayed text code; the to-be-displayed component information includes the relative position and relative scale parameters of the to-be-displayed component; The display module is used to display the text to be displayed according to the component information to be displayed, the vector data to be displayed, the position to be displayed and the font size to be displayed.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the method according to any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.