CN114444438A - Text drawing method and device, electronic equipment and storage medium - Google Patents

Text drawing method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN114444438A
CN114444438A CN202111593296.9A CN202111593296A CN114444438A CN 114444438 A CN114444438 A CN 114444438A CN 202111593296 A CN202111593296 A CN 202111593296A CN 114444438 A CN114444438 A CN 114444438A
Authority
CN
China
Prior art keywords
text
target text
displayed
target
position information
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111593296.9A
Other languages
Chinese (zh)
Inventor
张远路
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Co Wheels Technology Co Ltd
Original Assignee
Beijing Co Wheels Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Co Wheels Technology Co Ltd filed Critical Beijing Co Wheels Technology Co Ltd
Priority to CN202111593296.9A priority Critical patent/CN114444438A/en
Publication of CN114444438A publication Critical patent/CN114444438A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/103Formatting, i.e. changing of presentation of documents
    • G06F40/106Display of layout of documents; Previewing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/60Editing figures and text; Combining figures or text

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • General Engineering & Computer Science (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

The disclosure discloses a text drawing method and device, an electronic device and a storage medium, and the main scheme comprises: the method comprises the steps of obtaining a target text in a text to be displayed, storing the target text and first position information of the target text in the text to be displayed in a preset array, establishing an incidence relation between the first position information and second position information of the target text stored in the preset array, wherein the preset array is used for displaying all text formats of the target text, drawing is carried out from a first text of the text to be displayed, and when the first position information corresponding to the target text is drawn, the target text is obtained and drawn from the preset array based on the incidence relation. The target text with various text formats is temporarily stored by means of the preset array, and due to the fact that the preset array can display all the text formats of the target text, when the target text is drawn to the position, the target text is drawn according to all the text formats of the target text in the preset array, and therefore the drawing result is guaranteed to be consistent with the text to be displayed.

Description

Text drawing method and device, electronic equipment and storage medium
Technical Field
The present disclosure relates to the field of data processing technologies, and in particular, to a text rendering method and apparatus, an electronic device, and a storage medium.
Background
With the continuous improvement of hardware equipment of the intelligent terminal and the continuous development of various Application programs (APP), the requirements of users are met through various APPs, and the intelligent terminal brings great convenience to the life of people.
At present, the APP can realize the display of a text to be displayed through a control, the control usually adopts a word-by-word drawing mode of the text to be displayed, whether the width occupied by the text exceeds the width of a text display space is calculated when one word is drawn, if the width exceeds the width, the text is continuously drawn from the beginning of the next line, and the like until the drawing of all the texts to be displayed is completed. The method is suitable for a display mode of drawing a plain text, when the rich text is displayed based on the control, the rich text has various text formats such as pictures, links, highlights, underlines, middle dashes and the like, and for the scene, when the method is used for drawing the text to be displayed, problems of line change in drawing, disorder in drawing and the like occur, and finally the problem that the drawing effect is inconsistent with the display effect of the text to be displayed is caused.
Disclosure of Invention
The disclosure provides a text drawing method and device, an electronic device and a storage medium.
According to an aspect of the present disclosure, there is provided a text rendering method, including:
acquiring a target text in a text to be displayed, wherein the target text comprises at least one text format;
storing the target text and first position information of the target text in the text to be displayed in a preset array, and establishing an incidence relation between the first position information and second position information of the target text stored in the preset array, wherein the preset array is used for displaying all text formats of the target text;
and executing drawing from the first text of the text to be displayed, and acquiring and drawing the target text from the preset array based on the association relation when drawing the first position information corresponding to the target text.
Optionally, executing drawing from a first text of the text to be displayed, and when drawing to first position information corresponding to the target text, acquiring and drawing the target text from the preset array based on the association relationship, including:
acquiring the target text from the preset array based on the incidence relation;
and switching to a first brush to draw the target text.
Optionally, the text to be displayed further includes a plain text, and the method further includes:
and if the target text is drawn, switching to a second brush pen to draw the plain text in sequence.
Optionally, the obtaining of the target text in the text to be displayed includes:
configuring a preset searching condition and calling a preset searching function;
and acquiring the target text from the text to be displayed based on the preset search condition and the preset search function.
Optionally, before the drawing is performed from the first text of the text to be displayed, and when the first position information corresponding to the target text is drawn, and the target text is obtained and drawn from the preset array based on the association relationship, the method further includes:
confirming whether a half-angle character exists at the beginning of each line of the text to be displayed;
and if so, removing the half-corner character.
According to another aspect of the present disclosure, there is provided a text rendering apparatus including:
the device comprises an acquisition unit, a display unit and a display unit, wherein the acquisition unit is used for acquiring a target text in a text to be displayed, and the target text comprises at least one text format;
the storage unit is used for storing the target text and first position information of the target text in the text to be displayed in a preset array, and establishing an incidence relation between the first position information and second position information of the target text stored in the preset array, wherein the preset array is used for displaying all text formats of the target text;
and the drawing unit is used for executing drawing from the first text of the text to be displayed, and acquiring and drawing the target text from the preset array based on the association relation when drawing the first position information corresponding to the target text.
Optionally, the drawing unit includes:
the obtaining module is used for obtaining the target text from the preset array based on the incidence relation;
and the drawing module is used for switching to the first brush to draw the target text.
Optionally, the text to be displayed further includes a plain text, and the apparatus further includes:
and the switching unit is used for switching to a second brush pen to draw the plain text in sequence when the target text is drawn.
Optionally, the obtaining unit includes:
the configuration module is used for configuring preset searching conditions;
the calling module is used for calling a preset search function;
and the acquisition module is used for acquiring the target text from the text to be displayed based on the preset search condition and the preset search function.
Optionally, the apparatus further comprises:
the confirming unit is used for confirming whether a half-angle character exists at the beginning of each line of the text to be displayed before the first text of the text to be displayed is drawn and the target text is obtained and drawn from the preset array based on the association relation when the first position information corresponding to the target text is drawn;
a removal unit configured to remove the half character when the confirmation unit determines that the half character exists.
According to another aspect of the present disclosure, there is provided an electronic device including:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of the preceding aspect.
According to another aspect of the present disclosure, there is provided a non-transitory computer readable storage medium having stored thereon computer instructions for causing the computer to perform the method of the preceding aspect.
According to another aspect of the present disclosure, a computer program product is provided, comprising a computer program which, when executed by a processor, implements the method according to the preceding aspect.
The method, the device, the electronic equipment and the storage medium for drawing the text acquire a target text in the text to be displayed, the target text comprises at least one text format, the target text and first position information of the target text in the text to be displayed are stored in a preset array, an association relation between the first position information and second position information of the target text stored in the preset array is established, the preset array is used for displaying all text formats of the target text, drawing is performed from a first text of the text to be displayed, and when the first position information corresponding to the target text is drawn, the target text is acquired from the preset array and drawn based on the association relation. Compared with the prior art, the target text with various text formats is temporarily stored by means of the preset array, and all the text formats of the target text can be displayed by the preset array, so that when the position of the target text is drawn, the target text can be drawn according to all the text formats of the target text in the preset array, and the drawing result is ensured to be consistent with the text to be displayed.
It should be understood that the statements in this section do not necessarily identify key or critical features of the embodiments of the present application, nor do they limit the scope of the present application. Other features of the present application will become apparent from the following description.
Drawings
The drawings are included to provide a better understanding of the present solution and are not to be construed as limiting the present disclosure. Wherein:
fig. 1 is a schematic flowchart of a text rendering method according to an embodiment of the present disclosure;
fig. 2 is a schematic diagram of a text to be displayed according to an embodiment of the disclosure;
fig. 3 is a schematic structural diagram of a text rendering apparatus according to an embodiment of the present disclosure;
fig. 4 is a schematic structural diagram of another text rendering apparatus according to an embodiment of the present disclosure;
fig. 5 is a schematic block diagram of an example electronic device 300 provided by embodiments of the present disclosure.
Detailed Description
Exemplary embodiments of the present disclosure are described below with reference to the accompanying drawings, in which various details of the embodiments of the disclosure are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the present disclosure. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
A method, an apparatus, an electronic device, and a storage medium for rendering text of the embodiments of the present disclosure are described below with reference to the accompanying drawings.
Fig. 1 is a schematic flowchart of a text rendering method according to an embodiment of the present disclosure.
As shown in fig. 1, the method comprises the following steps:
step 101, obtaining a target text in a text to be displayed, wherein the target text comprises at least one text format.
In the embodiment of the application, in order to maintain universality and usability, the drawing of the text to be displayed is realized by processing an HTML format through a custom control, where the text to be displayed refers to a text with multiple text formats, such as a word, a picture, a link, a highlight, an underline, a dash-in-line, and the like, where the text to be displayed is divided into a plain text and a target text, and the target text includes at least one of the text formats of the word, the picture, the link, the highlight, the underline, the dash-in-line, the black-in-line, and the like, that is, all texts except the plain text are collectively referred to as the target text.
Step 102, storing the target text and first position information of the target text in the text to be displayed in a preset array, and establishing an association relationship between the first position information and second position information of the target text stored in the preset array, wherein the preset array is used for displaying all text formats of the target text.
Each text to be presented may include one line and a plurality of lines, and regardless of the length of the text to be presented, the elements in the text to be presented have different first position information, and for the convenience of understanding, it is assumed that the specific content of the text to be presented is: the 'today is a good day', wherein the 'good day' adopts a blacking format, the good day is a target text, each character in the text to be displayed has unique position information, the present position information is [1], the position information of a day is [2], the position information is [3], the position information is [4], the first position information of the target text 'good day' is [5] [6] [7], the above examples are only illustrative examples, and the content of the text to be displayed is not limited in practical application.
According to the embodiment, each element in the text to be displayed has unique position information, each array space in the corresponding preset array also has unique position relationship, the target text and the first position information of the target text in the text to be displayed are stored in the preset array, and the incidence relationship between the first position information and the second position information is established.
As a feasible way of this embodiment, when the preset array is customized, the length of the text to be displayed can be used as the length of the preset array, and the purpose of such configuration is to establish the association relationship more conveniently. In the example shown above, the first position information of the target text "good day" is [5] [6] [7], then the second position information of the target text stored in the preset array is [005] [006] [007], and the correlation between [5] - [005], [6] - [006], [7] - [007] is established. The above-mentioned values for establishing the association relationship and configuring the preset array length are all exemplary examples, and the embodiment of the present application does not limit this.
Step 103, drawing is executed from the first text of the text to be displayed, and when the first position information corresponding to the target text is drawn, the target text is obtained from the preset array and drawn based on the association relation.
After all target texts in the texts to be displayed are stored in the preset array, the texts to be displayed are drawn, wherein the drawing is started from the first text of the first line of the texts to be displayed.
The text drawing method comprises the steps of obtaining a target text in a text to be displayed, wherein the target text comprises at least one text format, storing the target text and first position information of the target text in the text to be displayed in a preset array, establishing an incidence relation between the first position information and second position information of the target text stored in the preset array, wherein the preset array is used for displaying all text formats of the target text, drawing is carried out from a first text of the text to be displayed, and when the first position information corresponding to the target text is drawn, the target text is obtained from the preset array and drawn based on the incidence relation. Compared with the prior art, the target text with various text formats is temporarily stored by means of the preset array, and all the text formats of the target text can be displayed by the preset array, so that when the position of the target text is drawn, the target text can be drawn according to all the text formats of the target text in the preset array, and the drawing result is ensured to be consistent with the text to be displayed.
In a specific implementation process, for better understanding, as shown in fig. 2, fig. 2 is a schematic diagram of a text to be displayed according to an embodiment of the present application, taking drawing of a first line of the text to be displayed as an example, four scenes shown in fig. 2 may be possible, where the first line does not include any text format, that is, a plain text format, and during drawing, the second brush is switched to directly draw all characters in the line; the second scene comprises one or more complete target texts, the second brush is switched to draw the plain texts, after the plain texts are drawn, the target texts are continuously obtained from the preset array, the first brush is switched to draw the target texts, and then the second brush is switched back to draw the plain texts; the third scenario is that the beginning position of the line is a target text, or the rear half part of the target text, a second brush is switched to draw the target text, and then the first brush is switched to draw the remaining plain text; and in the fourth scenario, the end position of the line is a target text or the first half part of the target text, and then the second brush is switched to draw the plain text in front of the line, and then the first brush is switched to draw the target text at the tail of the line. And repeating the steps in the above way, and drawing line by line in a top-to-bottom mode until all texts to be displayed are drawn.
As a refinement to the above embodiment, when the step 101 is executed to acquire the target text in the text to be displayed, the search may be performed through a preset function or an interface encapsulated by the preset function, which specifically includes: and configuring a preset search condition, calling a preset search function, and acquiring the target text from the text to be displayed based on the preset search condition and the preset search function. The preset search condition is an experience value, which can be flexibly set according to actual requirements, and the embodiment of the application is not illustrated here.
In order to solve the problem, in the embodiment of the present application, when a text to be displayed is drawn, a half-angle character may exist at a position of a line head, and the existence of the half-angle character may cause an abnormal line feed during drawing, so that a final display effect of the text to be displayed is uneven. The operation can ensure that the drawn text to be displayed is completely consistent with the text to be displayed, eliminate the problems of abnormal line feed and the like caused by the existence of the half-angle characters, and further ensure that the drawn effect is unified with the text to be displayed.
The temporary storage space of the target text is preset as an array, the preset array needs to be customized before the embodiment of the application is executed, and the customization process is as follows:
a preset array is defined. Taking a processed word format as an example, defining preset array variables TextSpan [ ] textSpans for storing all target words in the whole text to be displayed, wherein the type TextSpan is defined as follows:
Figure BDA0003430392650000061
Figure BDA0003430392650000071
the definition mLineY is used for saving the height coordinate of each line of the target text when drawing, the definition mViewWidth is used for recording the actual width of the control, and the definition textSpanIndex is used for recording the second position information of the start of each target text.
Rewriting an onMeasure method, wherein the width calculation follows the basic principle of the Android self-defined control about the measurement mode, and the height calculation fully considers the line spacing in the paragraphs as follows:
Figure BDA0003430392650000072
the above is only an example of self-defining the preset array, and the embodiment of the present application does not limit the method and specific numerical values of the height and width defined when the array is preset.
Corresponding to the text drawing method, the invention also provides a text drawing device. Since the device embodiment of the present invention corresponds to the method embodiment described above, details that are not disclosed in the device embodiment may refer to the method embodiment described above, and are not described again in the present invention.
An embodiment of the present application further provides a text drawing device, as shown in fig. 3, including:
the acquiring unit 31 is configured to acquire a target text in a text to be displayed, where the target text includes at least one text format;
the storage unit 32 is configured to store the target text and first position information of the target text in the text to be displayed in a preset array, and establish an association relationship between the first position information and second position information of the target text stored in the preset array, where the preset array is used to display all text formats of the target text;
and the drawing unit 33 is configured to start drawing from a first text of the text to be displayed, and when first position information corresponding to the target text is drawn, obtain and draw the target text from the preset array based on the association relationship.
The text drawing device provided by the disclosure obtains a target text in a text to be displayed, wherein the target text comprises at least one text format, stores the target text and first position information of the target text in the text to be displayed in a preset array, establishes an incidence relation between the first position information and second position information of the target text stored in the preset array, the preset array is used for displaying all text formats of the target text, starts to draw from a first text of the text to be displayed, and obtains and draws the target text from the preset array based on the incidence relation when drawing the first position information corresponding to the target text. Compared with the prior art, the target text with various text formats is temporarily stored by means of the preset array, and all the text formats of the target text can be displayed by the preset array, so that when the position of the target text is drawn, the target text can be drawn according to all the text formats of the target text in the preset array, and the drawing result is ensured to be consistent with the text to be displayed.
Further, in a possible implementation manner of this embodiment, as shown in fig. 4, the drawing unit 33 includes:
an obtaining module 331, configured to obtain the target text from the preset array based on the association relationship;
and the drawing module 332 is configured to switch to the first brush to draw the target text.
Further, in a possible implementation manner of this embodiment, as shown in fig. 4, the text to be presented further includes a plain text, and the apparatus further includes:
and the switching unit 34 is configured to switch to a second brush to draw the plain text in sequence when the target text is completely drawn.
Further, in a possible implementation manner of this embodiment, as shown in fig. 4, the obtaining unit 31 includes:
a configuration module 311, configured to configure a preset search condition;
a calling module 312, configured to call a preset search function;
an obtaining module 313, configured to obtain the target text from the text to be displayed based on the preset search condition and the preset search function.
Further, in a possible implementation manner of this embodiment, as shown in fig. 5, the apparatus further includes:
the confirming unit 35 is configured to, when the drawing is performed from the first text of the text to be displayed, and when the first position information corresponding to the target text is drawn, confirm whether a half-angle character exists at the beginning of each line of the text to be displayed before the target text is acquired from the preset array and drawn based on the association relationship;
a removing unit 36 configured to remove the half-character when the confirming unit determines that the half-character exists.
It should be noted that the foregoing explanation of the method embodiment is also applicable to the apparatus of the present embodiment, and the principle is the same, and the present embodiment is not limited thereto.
The present disclosure also provides an electronic device, a readable storage medium, and a computer program product according to embodiments of the present disclosure.
FIG. 5 illustrates a schematic block diagram of an example electronic device 300 that can be used to implement embodiments of the present disclosure. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. Electronic devices may also represent various forms of mobile devices, such as personal digital processors, cellular telephones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be examples only, and are not meant to limit implementations of the disclosure described and/or claimed herein.
As shown in fig. 5, the device 300 includes a computing unit 301 that can perform various appropriate actions and processes in accordance with a computer program stored in a ROM (Read-Only Memory) 302 or a computer program loaded from a storage unit 308 into a RAM (Random Access Memory) 303. In the RAM 303, various programs and data required for the operation of the device 300 can also be stored. The calculation unit 301, the ROM 302, and the RAM 303 are connected to each other via a bus 304. An I/O (Input/Output) interface 305 is also connected to the bus 304.
Various components in device 300 are connected to I/O interface 305, including: an input unit 306 such as a keyboard, a mouse, or the like; an output unit 307 such as various types of displays, speakers, and the like; a storage unit 308 such as a magnetic disk, optical disk, or the like; and a communication unit 309 such as a network card, modem, wireless communication transceiver, etc. The communication unit 309 allows the device 300 to exchange information/data with other devices via a computer network such as the internet and/or various telecommunication networks.
The computing unit 301 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of the computing Unit 301 include, but are not limited to, a CPU (Central Processing Unit), a GPU (graphics Processing Unit), various dedicated AI (Artificial Intelligence) computing chips, various computing Units running machine learning model algorithms, a DSP (Digital Signal Processor), and any suitable Processor, controller, microcontroller, and the like. The calculation unit 301 executes the respective methods and processes described above, such as a drawing method of text. For example, in some embodiments, the method of rendering text may be implemented as a computer software program tangibly embodied in a machine-readable medium, such as storage unit 308. In some embodiments, part or all of the computer program may be loaded and/or installed onto device 300 via ROM 302 and/or communication unit 309. When the computer program is loaded into RAM 303 and executed by the computing unit 301, one or more steps of the method described above may be performed. Alternatively, in other embodiments, the computing unit 301 may be configured to perform the aforementioned text rendering method by any other suitable means (e.g., by means of firmware).
Various implementations of the systems and techniques described here above may be realized in digital electronic circuitry, Integrated circuitry, FPGAs (Field Programmable Gate arrays), ASICs (Application-Specific Integrated circuits), ASSPs (Application Specific Standard products), SOCs (System On Chip, System On a Chip), CPLDs (Complex Programmable Logic devices), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs that are executable and/or interpretable on a programmable system including at least one programmable processor, which may be special or general purpose, receiving data and instructions from, and transmitting data and instructions to, a storage system, at least one input device, and at least one output device.
Program code for implementing the methods of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the program codes, when executed by the processor or controller, cause the functions/operations specified in the flowchart and/or block diagram to be performed. The program code may execute entirely on the machine, partly on the machine, as a stand-alone software package partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a RAM, a ROM, an EPROM (Electrically Programmable Read-Only-Memory) or flash Memory, an optical fiber, a CD-ROM (Compact Disc Read-Only-Memory), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having: a Display device (e.g., a CRT (Cathode Ray Tube) or LCD (Liquid Crystal Display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which a user can provide input to the computer. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic, speech, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a back-end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back-end, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: LAN (Local Area Network), WAN (Wide Area Network), internet, and blockchain Network.
The computer system may include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The Server can be a cloud Server, also called a cloud computing Server or a cloud host, and is a host product in a cloud computing service system, so as to solve the defects of high management difficulty and weak service expansibility in the traditional physical host and VPS service ("Virtual Private Server", or simply "VPS"). The server may also be a server of a distributed system, or a server incorporating a blockchain.
It should be noted that artificial intelligence is a subject for studying a computer to simulate some human thinking processes and intelligent behaviors (such as learning, reasoning, thinking, planning, etc.), and includes both hardware and software technologies. Artificial intelligence hardware technologies generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing, and the like; the artificial intelligence software technology mainly comprises a computer vision technology, a voice recognition technology, a natural language processing technology, machine learning/deep learning, a big data processing technology, a knowledge map technology and the like.
It should be understood that various forms of the flows shown above may be used, with steps reordered, added, or deleted. For example, the steps described in the present disclosure may be executed in parallel, sequentially, or in different orders, as long as the desired results of the technical solutions disclosed in the present disclosure can be achieved, and the present disclosure is not limited herein.
The above detailed description should not be construed as limiting the scope of the disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may be made in accordance with design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present disclosure should be included in the protection scope of the present disclosure.

Claims (10)

1. A method for rendering text, comprising:
acquiring a target text in a text to be displayed, wherein the target text comprises at least one text format;
storing the target text and first position information of the target text in the text to be displayed in a preset array, and establishing an incidence relation between the first position information and second position information of the target text stored in the preset array, wherein the preset array is used for displaying all text formats of the target text;
and executing drawing from the first text of the text to be displayed, and acquiring and drawing the target text from the preset array based on the association relation when drawing the first position information corresponding to the target text.
2. The drawing method according to claim 1, wherein drawing is performed starting from a first text of the text to be displayed, and when drawing is performed to first position information corresponding to the target text, acquiring and drawing the target text from the preset array based on the association relationship includes:
acquiring the target text from the preset array based on the incidence relation;
and switching to a first brush to draw the target text.
3. The rendering method according to claim 2, wherein the text to be presented further includes plain text, and the method further comprises:
and if the target text is drawn, switching to a second brush pen to draw the plain text in sequence.
4. The drawing method according to claim 1, wherein obtaining the target text in the text to be presented comprises:
configuring a preset searching condition and calling a preset searching function;
and acquiring the target text from the text to be displayed based on the preset search condition and the preset search function.
5. The drawing method according to claim 1, wherein before the drawing is performed starting from a first text of the text to be presented, and when drawing to the first position information corresponding to the target text, the method further comprises, before obtaining and drawing the target text from the preset array based on the association relationship:
confirming whether a half-angle character exists at the beginning of each line of the text to be displayed;
and if so, removing the half-corner character.
6. An apparatus for rendering text, comprising:
the device comprises an acquisition unit, a display unit and a display unit, wherein the acquisition unit is used for acquiring a target text in a text to be displayed, and the target text comprises at least one text format;
the storage unit is used for storing the target text and first position information of the target text in the text to be displayed in a preset array, and establishing an incidence relation between the first position information and second position information of the target text stored in the preset array, wherein the preset array is used for displaying all text formats of the target text;
and the drawing unit is used for executing drawing from the first text of the text to be displayed, and acquiring and drawing the target text from the preset array based on the association relation when drawing the first position information corresponding to the target text.
7. The drawing device according to claim 6, wherein the drawing unit includes:
the obtaining module is used for obtaining the target text from the preset array based on the incidence relation;
and the drawing module is used for switching to the first brush to draw the target text.
8. An electronic device, comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-5.
9. A non-transitory computer readable storage medium having stored thereon computer instructions for causing the computer to perform the method of any one of claims 1-5.
10. A computer program product comprising a computer program which, when executed by a processor, implements the method according to any one of claims 1-5.
CN202111593296.9A 2021-12-23 2021-12-23 Text drawing method and device, electronic equipment and storage medium Pending CN114444438A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111593296.9A CN114444438A (en) 2021-12-23 2021-12-23 Text drawing method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111593296.9A CN114444438A (en) 2021-12-23 2021-12-23 Text drawing method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114444438A true CN114444438A (en) 2022-05-06

Family

ID=81363778

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111593296.9A Pending CN114444438A (en) 2021-12-23 2021-12-23 Text drawing method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114444438A (en)

Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040268235A1 (en) * 2003-06-26 2004-12-30 International Business Machines Corporation Rich text handling for a web application
CN1913499A (en) * 2005-08-09 2007-02-14 腾讯科技(深圳)有限公司 Method for implementing character multi-type in immediate message
US20130002678A1 (en) * 2011-06-30 2013-01-03 Google Inc. Rendering a text image following a line
US20150074112A1 (en) * 2012-05-14 2015-03-12 Huawei Technologies Co., Ltd. Multimedia Question Answering System and Method
CN107783946A (en) * 2016-08-27 2018-03-09 上海卓易电子科技有限公司 Text display method and text display
CN108763188A (en) * 2018-05-24 2018-11-06 广州视源电子科技股份有限公司 A kind of text display method, device, equipment and storage medium
CN109213485A (en) * 2018-08-20 2019-01-15 武汉斗鱼网络科技有限公司 A kind of text folds implementation method, terminal device and storage medium
CN109949391A (en) * 2019-03-18 2019-06-28 武汉斗鱼鱼乐网络科技有限公司 Graphic rendering method, apparatus, electronic equipment and storage medium
CN111274760A (en) * 2020-01-09 2020-06-12 北京字节跳动网络技术有限公司 Rich text data processing method and device, electronic equipment and computer storage medium
CN113111624A (en) * 2021-04-19 2021-07-13 北京字节跳动网络技术有限公司 Text display method and device, electronic equipment and storage medium
CN113378511A (en) * 2021-06-09 2021-09-10 北京百度网讯科技有限公司 Page display method and device, electronic equipment and storage medium
CN113822010A (en) * 2020-06-19 2021-12-21 腾讯科技(深圳)有限公司 Content display method, device, equipment and storage medium

Patent Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040268235A1 (en) * 2003-06-26 2004-12-30 International Business Machines Corporation Rich text handling for a web application
CN1913499A (en) * 2005-08-09 2007-02-14 腾讯科技(深圳)有限公司 Method for implementing character multi-type in immediate message
US20130002678A1 (en) * 2011-06-30 2013-01-03 Google Inc. Rendering a text image following a line
US20150074112A1 (en) * 2012-05-14 2015-03-12 Huawei Technologies Co., Ltd. Multimedia Question Answering System and Method
CN107783946A (en) * 2016-08-27 2018-03-09 上海卓易电子科技有限公司 Text display method and text display
CN108763188A (en) * 2018-05-24 2018-11-06 广州视源电子科技股份有限公司 A kind of text display method, device, equipment and storage medium
CN109213485A (en) * 2018-08-20 2019-01-15 武汉斗鱼网络科技有限公司 A kind of text folds implementation method, terminal device and storage medium
CN109949391A (en) * 2019-03-18 2019-06-28 武汉斗鱼鱼乐网络科技有限公司 Graphic rendering method, apparatus, electronic equipment and storage medium
CN111274760A (en) * 2020-01-09 2020-06-12 北京字节跳动网络技术有限公司 Rich text data processing method and device, electronic equipment and computer storage medium
CN113822010A (en) * 2020-06-19 2021-12-21 腾讯科技(深圳)有限公司 Content display method, device, equipment and storage medium
CN113111624A (en) * 2021-04-19 2021-07-13 北京字节跳动网络技术有限公司 Text display method and device, electronic equipment and storage medium
CN113378511A (en) * 2021-06-09 2021-09-10 北京百度网讯科技有限公司 Page display method and device, electronic equipment and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
养只猫: "小程序canvas循环绘制内容的问题", pages 2 - 3, Retrieved from the Internet <URL:https://blog.csdn.net/qq_40816649/article/details/89482333> *

Similar Documents

Publication Publication Date Title
CN112597754B (en) Text error correction method, apparatus, electronic device and readable storage medium
CN113138827A (en) Method, device, electronic equipment and medium for displaying data
CN114218890A (en) Page rendering method and device, electronic equipment and storage medium
CN113242358A (en) Audio data processing method, device and system, electronic equipment and storage medium
CN113378855A (en) Method for processing multitask, related device and computer program product
CN114861059A (en) Resource recommendation method and device, electronic equipment and storage medium
JP7309811B2 (en) Data annotation method, apparatus, electronics and storage medium
CN113780297B (en) Image processing method, device, equipment and storage medium
CN113836462A (en) Page description file generation method, device, equipment and storage medium
CN112632251B (en) Reply content generation method, device, equipment and storage medium
CN114444438A (en) Text drawing method and device, electronic equipment and storage medium
CN113127058A (en) Data annotation method, related device and computer program product
CN114443197A (en) Interface processing method and device, electronic equipment and storage medium
CN114386577A (en) Method, apparatus, and storage medium for executing deep learning model
CN114138358A (en) Application program starting optimization method, device, equipment and storage medium
CN113556575A (en) Method, apparatus, device, medium and product for compressing data
CN112507671B (en) Method, apparatus, and readable medium for adjusting text distance
CN113360636B (en) Content display method, device, equipment and storage medium
CN113723120B (en) Display method and device of reference information and electronic equipment
CN113392660B (en) Page translation method and device, electronic equipment and storage medium
CN114363627B (en) Image processing method and device and electronic equipment
CN113642612B (en) Sample image generation method and device, electronic equipment and storage medium
CN115481339A (en) Information presentation method, device, equipment and storage medium
CN115826964A (en) Component arrangement method, device, equipment, storage medium and product
CN115759010A (en) Data insertion method, device, equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination