CN111723316A - Character string rendering method and device, terminal equipment and computer storage medium - Google Patents

Character string rendering method and device, terminal equipment and computer storage medium Download PDF

Info

Publication number
CN111723316A
CN111723316A CN201910220170.3A CN201910220170A CN111723316A CN 111723316 A CN111723316 A CN 111723316A CN 201910220170 A CN201910220170 A CN 201910220170A CN 111723316 A CN111723316 A CN 111723316A
Authority
CN
China
Prior art keywords
character string
rendering
determining
sub
label
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.)
Granted
Application number
CN201910220170.3A
Other languages
Chinese (zh)
Other versions
CN111723316B (en
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.)
Alibaba Group Holding Ltd
Original Assignee
Alibaba Group Holding 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 Alibaba Group Holding Ltd filed Critical Alibaba Group Holding Ltd
Priority to CN201910220170.3A priority Critical patent/CN111723316B/en
Priority claimed from CN201910220170.3A external-priority patent/CN111723316B/en
Publication of CN111723316A publication Critical patent/CN111723316A/en
Application granted granted Critical
Publication of CN111723316B publication Critical patent/CN111723316B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/957Browsing optimisation, e.g. caching or content distillation
    • G06F16/9574Browsing optimisation, e.g. caching or content distillation of access to content, e.g. by caching
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/38Creation or generation of source code for implementing user interfaces

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Human Computer Interaction (AREA)
  • Document Processing Apparatus (AREA)

Abstract

The embodiment of the invention provides a rendering method and device of a character string, terminal equipment and a computer storage medium, wherein the rendering method of the character string comprises the following steps: determining a character string needing to be split according to the hierarchical relationship among labels in the character string, and splitting the character string needing to be split to obtain a plurality of sub-character strings; and determining a view component for bearing the corresponding sub-character string according to the labels respectively included in the sub-character strings, and rendering the sub-character strings according to the view components bearing the sub-character strings. According to the scheme provided by the embodiment, the native component can be used for bearing part or all of the plurality of sub-character strings during rendering, so that the rendering speed is increased, and the problems of rendering errors or low rendering speed in the prior art are solved.

Description

Character string rendering method and device, terminal equipment and computer storage medium
Technical Field
The embodiment of the invention relates to the technical field of data processing, in particular to a character string rendering method and device, terminal equipment and a computer storage medium.
Background
Generally, when an HTML file is rendered in an Android system, since the Android system cannot directly and completely analyze the whole HTML file, part of tags in the HTML file cannot be displayed, such as gif tags, and further, content corresponding to the tags cannot be displayed, so that rendering is wrong. Therefore, when rendering, the html file is mostly rendered through the view component webview.
However, when the WebView rendering is adopted, page resources of the html file need to be loaded, and then rendering processing is performed according to the loaded page resources to obtain and output a rendering result of the rich text, so that the rendering processing process is slow, and further the display speed of the page is slow.
Disclosure of Invention
In view of the above, embodiments of the present invention provide a method and an apparatus for rendering a character string, a terminal device, and a computer storage medium to solve any of the above problems.
According to a first aspect of the embodiments of the present invention, there is provided a method for rendering a character string, including: determining a character string needing to be split according to the hierarchical relationship among labels in the character string, and splitting the character string needing to be split to obtain a plurality of sub-character strings; and determining a view component for bearing the corresponding sub-character string according to the sub-character strings, and rendering the sub-character strings according to the view components bearing the sub-character strings.
According to a second aspect of the embodiments of the present invention, there is provided a rendering apparatus of a character string, including: the splitting module is used for determining the character string needing to be split according to the hierarchical relationship among the labels in the character string and splitting the character string needing to be split to obtain a plurality of sub-character strings; and the rendering module is used for determining a view component for bearing the corresponding sub-character string according to the sub-character strings and rendering the sub-character strings according to the view components bearing the sub-character strings.
According to a third aspect of the embodiments of the present invention, there is provided a terminal device, including: the system comprises a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface complete mutual communication through the communication bus; the memory is used for storing at least one executable instruction, and the executable instruction causes the processor to execute the operation corresponding to the character string rendering method.
According to a fourth aspect of embodiments of the present invention, there is provided a computer storage medium having stored thereon a computer program which, when executed by a processor, implements the rendering method of character strings as described above.
According to the scheme provided by the embodiment of the invention, the character string needing to be split is determined according to the hierarchical relationship among the labels in the character string, and the character string needing to be split is split to obtain a plurality of sub-character strings; and determining a view component for bearing a corresponding sub-character string according to the labels respectively included in the sub-character strings, rendering the sub-character strings according to the view components bearing the sub-character strings, and then using a native component to bear part or all of the sub-character strings, thereby improving the rendering speed and avoiding the problems of rendering errors or slow rendering speed in the prior art.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments described in the embodiments of the present invention, and it is also possible for a person skilled in the art to obtain other drawings based on the drawings.
Fig. 1 is a flowchart illustrating steps of a method for rendering a character string according to a first embodiment of the present invention;
FIG. 2 is a flowchart illustrating steps of a method for rendering a string according to a second embodiment of the present invention;
FIG. 3a is a diagram of an HTML file according to a second embodiment of the present invention;
FIG. 3b is a diagram illustrating a tag grouping result according to a second embodiment of the present invention;
fig. 4 is a block diagram of a rendering apparatus for character strings according to a third embodiment of the present invention;
fig. 5 is a schematic structural diagram of a terminal device according to a fourth embodiment of the present invention.
Detailed Description
In order to make those skilled in the art better understand the technical solutions in the embodiments of the present invention, the technical solutions in the embodiments of the present invention will be described clearly and completely with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all embodiments. All other embodiments obtained by a person skilled in the art based on the embodiments of the present invention shall fall within the scope of the protection of the embodiments of the present invention.
The following further describes specific implementation of the embodiments of the present invention with reference to the drawings.
Example one
Referring to fig. 1, a flowchart illustrating steps of a method for rendering a character string according to a first embodiment of the present invention is shown.
The method of the embodiment comprises the following steps:
s102, determining the character strings needing to be split according to the hierarchical relation among the labels in the character strings, and splitting the character strings needing to be split to obtain a plurality of sub character strings.
In this embodiment, when some content needs to be presented, most of the presented content is represented by a character string, and then the character string is processed by a device such as an intelligent terminal, so that the content corresponding to the character string is presented in a page.
For example, if the displayed content is an HTML page, the character string is a character string corresponding to the HTML page. The character string may include text with attribute values (the attribute values may be color, font, thickness, italics, etc.), picture address, video address, table, etc., and the attribute of the text, the format of the picture, the video, the table, etc. may be identified by a label in the character string.
In this embodiment, for example, the character string corresponding to the HTML page is taken as an example, and the included tags are HTML tags, such as < p >, < body >, < canvas >, and the like. Usually, the HTML tag is used in a dual-tag manner, where the dual-tag includes a start tag and an end tag, the content of the element corresponding to the tag is all the strings from the start tag to the end tag, for example, in the string "< p > This is my first paramgraph. </p >", the start tag is < p >, the end tag is </p >, and the element corresponding to the tag is "This is my first paramgraph.". Certainly, a part of the tags do not have an end tag, and when the tags are actually used, a person skilled in the art may accurately determine the tags and the elements corresponding to the tags according to experience, which is not described herein again in this embodiment.
When a plurality of labels are included in a character string, a hierarchical relationship may exist between the labels, and the hierarchical relationship may specifically include a parallel relationship, a nested relationship, and the like. In order to ensure correct rendering effect, the character strings to be split need to be determined according to the hierarchical relationship between the labels, so that the sub-character strings obtained after splitting can be accurately spliced, and the situation of rendering errors caused by splicing errors of the sub-character strings due to errors of the hierarchical relationship is avoided.
S104, determining a view component for bearing the corresponding sub-character string according to the sub-character strings, and rendering the sub-character strings according to the view components bearing the sub-character strings.
In this embodiment, as can be seen from the foregoing steps, the substrings are divided according to labels, and the determined substring may include a label, where the label and the element corresponding to the label are not separable because the label is used to indicate an attribute or a category of the element corresponding to the label, and the substring may further include the element corresponding to the label.
Since the tag may indicate the type of the element, e.g. by the tag indicating the nature of the text, by the tag indicating that what is to be rendered is a picture, video, etc., the view component for carrying the sub-string may be determined by the tag included in the sub-string. For example, if the tag is used to indicate an attribute of a word, it may be determined that the view component bearing the substring is a text component; if the label is used to indicate that the picture is to be rendered, the view component bearing the substring may be determined to be a video component, and the like. A person skilled in the art can determine the view component carrying the sub-character string directly according to the label of the sub-character string as needed, which is not described herein again in this embodiment. Of course, in other implementation manners, the view component for bearing the sub-character string may also be determined directly according to all contents of the sub-character string without using a tag, which is not limited in this embodiment.
In this embodiment, after determining the view component bearing the sub-character strings, a plurality of sub-character strings may be rendered by the view component, and specific rendering steps are described in the following embodiments. Since the substring is obtained by splitting the character string, rendering of a plurality of substrings, that is, rendering of the character string is completed.
According to the scheme provided by the embodiment, the character string needing to be split is determined according to the hierarchical relationship among the labels in the character string, and the character string needing to be split is split to obtain a plurality of sub-character strings; and determining a view component for bearing a corresponding sub-character string according to the labels respectively included in the sub-character strings, rendering the sub-character strings according to the view components bearing the sub-character strings, and then using a native component to bear part or all of the sub-character strings, thereby improving the rendering speed and avoiding the problems of rendering errors or slow rendering speed in the prior art.
Example two
Referring to fig. 2, a flowchart illustrating steps of a method for rendering a character string according to a second embodiment of the present invention is shown.
In this embodiment, an html file is taken as an example to specifically describe a rendering process of a character string.
The method of the embodiment comprises the following steps:
s202, acquiring the HTML file and acquiring the character string from the HTML file.
In this embodiment, all html files include three tags, namely, the < html >, < head >, < body >, and most of the contents to be rendered are included in the < body > tag. Then, in this embodiment, the element contained in the < body > tag is obtained, that is, the character string is obtained from the HTML file.
For example, as shown in fig. 3a, fig. 3a shows an HTML file, which includes tags such as < HTML >, < head >, < body >, < meta >, etc.
Specifically, in this embodiment, the elements included in the < body > tag may be obtained in any appropriate manner, for example, the elements may be obtained in a regular matching manner, and the regular expression used in obtaining may be: < body (.?) (/ >). Of course, the elements included in the < body > tag may also be obtained in other manners, which is not limited in this embodiment.
S204, determining the character string needing to be split according to the hierarchical relation among the labels in the character string, and splitting the character string needing to be split to obtain a plurality of sub-character strings.
Specifically, if it is determined that there is no corresponding parent tag in the character string according to the hierarchical relationship between the tags in the character string, the character string corresponding to the tag is determined to be the character string that needs to be split. By determining that the character string corresponding to the label is the character string needing to be split, the method can ensure that the sub character string can be simply and accurately spliced after being rendered, and further ensure the rendering accuracy of the character string.
In this embodiment, after determining that the character string corresponding to the tag is the character string that needs to be split, the position of the tag may be recorded, and the character string that needs to be split is subsequently split according to the recorded position.
In this embodiment, the hierarchical relationship may include a parallel relationship and a nested relationship. Two tags in a parallel relationship means that one tag is used after the other tag is used, for example, < h2> </h2> < p > </p >. Two tags having a nested relationship means that the beginning use and the end use of one tag both fall within the beginning and end range of the other tag, for example, < div > < h2> </h2> </div >.
Specifically, two tags having a parallel relationship may correspond to the same parent tag, or a parallel relationship exists between the outermost tags of a plurality of nested relationships, which is not limited in this embodiment.
If the corresponding parent tag does not exist in the tag in the character string, determining that the relationship between the tag and other tags comprises a parallel relationship, and of course, a child tag embedded in the tag may also exist. After determining that the label does not have the corresponding parent label, determining that the character string corresponding to the label is the character string needing to be split.
Specifically, for a plurality of tags in a nested relationship, if it is determined that a corresponding parent tag exists in a tag in a character string according to a hierarchical relationship between the tags in the character string, it is determined that the relationship between the parent tag and the tag is the nested relationship, and the outermost tag corresponding to the nested relationship is a tag without the parent tag, and it is determined that the character string corresponding to the outermost tag is a character string to be split.
In this embodiment, whether the tag is embedded into other tags can be determined by determining whether the tag has a corresponding parent tag, so that when the tag is split, the integrity of the character string corresponding to the nesting relationship is ensured, the accuracy of the rendering result of the character string is ensured, and the situation that the tags in the nesting relationship cannot be nested and rendering errors are avoided when the tags are split and rendered respectively to cause combination.
In addition, in this embodiment, determining that the character string corresponding to the tag is a character string that needs to be split includes: and determining the label and the character string inserted in the label as the character string needing to be split.
For example, if the character string is "< h1> header"/> < video source ═ 1.mp4"/> bold face"/> img src ═ 1.jpg "/>, after the character string corresponding to the tag < h1> is determined to be a character string that needs to be split, it can be determined that the element inserted in the tag < h1> is the" header ", and the sub-character string obtained after the splitting is" < h1> header "/>.
After the character strings are completely split in sequence, four sub character strings can be obtained, which are respectively: < h1> head </>, < video source ═ 1.mp4"/>, bold, < imgsrc ═ 1. jpg"/>. Here, since the character string under the body label is obtained when the character string is obtained in step S202, the sub-character string "bold" is the character string directly added under the body.
In this embodiment, when splitting, the position order of the split sub-character string in the character string before splitting must be determined, so that a plurality of sub-character strings can be rendered according to the position order in the subsequent step, and the situation that rendering of the character strings is wrong due to inconsistent order is avoided.
S206, determining the view component as the sub character string of the text component according to the plurality of sub character strings.
Specifically, all the substrings may be divided into two groups, one group being a substring whose view component is a text component, and the other group being a substring which is composed of the remaining substrings and whose view component is not a text component.
Referring specifically to fig. 3b, fig. 3b shows the tag grouping result. Fig. 3b shows grouping results obtained by grouping according to the labels in the substrings, and the labels represent the groups in which the substrings are located. Specifically, the labels may be grouped according to the labels in the substrings, and the labels are divided into two groups, namely "labels supported by the text component textview" and "labels not supported by the text component textview", where the "labels supported by the text component textview" correspond to the substrings of which the view component is a text component, and the "labels not supported by the text component textview" correspond to the substrings of which the view component is not a text component. If the label is the label under the label supported by the text component textview, the view component bearing the substring in which the label is located can be determined to be the text component.
For example, after the four sub-character strings obtained by splitting in the above step are divided into two groups, the sub-character string whose view component is a text component includes: < h1> head </>, bold; the view component is a substring of the text component and comprises: < video source ═ 1.mp4"/>, and < img src ═ 1. jpg"/>.
And S208, determining a view component for bearing the corresponding sub-character string according to the remaining sub-character strings.
Specifically, when determining the view component, it may be determined according to the label in the substring, for example, as shown in fig. 3b, it may be determined that the view component corresponding to the label < img > is imageview, the view component corresponding to the label < video > is video, and the view component corresponding to the label < gif > is gifview.
Since the text component supports the rendering of some texts such as "head", "bold", and the like by default, the workload can be reduced by determining the view component as the sub-character string of the text component in step S206, and determining the view component corresponding to the remaining sub-character string in step S208.
In this embodiment, in order to increase the rendering speed, when determining the view component for carrying the corresponding substring according to the remaining substrings, the priority of the native component is higher than that of the non-native component.
In this embodiment, the native component is a native view component in a system (such as an Android system), and the non-native component is a view component obtained by developing on the basis of the native component. The non-native component may be developed by a person skilled in the art according to the substring, or may be obtained in an open source manner, which is not limited in this embodiment.
S210, rendering the view components carrying the substrings into a layout container according to a splitting sequence so as to render the substrings.
In this embodiment, the different view components include respective customized processing requirements, and when the sub-character strings are carried by the view components, the different view components may process the sub-character strings according to the respective customized requirements, and a person skilled in the art may set or modify the sub-character strings according to experience, which is not described herein again.
In this embodiment, the layout container may be implemented by a cycleview, a viewport, a listview, or the like. And rendering the view components into the layout container according to the splitting sequence, namely filling the view components into the positions corresponding to the layout container according to the splitting sequence.
For example, when the layout container is implemented by a reclerview, the view components corresponding to the four character strings according to the splitting order are TextView1, VideoView, TextView2, and ImageView, where TextView1 is used for bearing a character string "< h1> header </>, VideoView is used for bearing a character string" < video source ═ 1.mp4"/>, TextView2 is used for bearing a character string" bold ", and ImageView is used for bearing a character string" < imgsrc ″ "1.jpg"/> ". The first list item in the RecycleView may be populated with TextView1, the second list item may be populated with VideoView, the third list item may be populated with TextView2, and the fourth list item may be populated with ImageView. And after the filling is finished, combining rendering results of the four sub-character strings through RecyclerView, and further realizing the rendering of the character strings.
According to the scheme provided by the embodiment, the view component is determined to be the sub-character string of the text component, and then the view components corresponding to the rest sub-character strings are determined, so that the workload can be reduced, the native components are preferentially considered when the view components corresponding to the rest sub-character strings are determined, and the rendering speed can be increased.
In addition, it should be noted that, because the number of pages included in the H5 page is greater than that of other pages, compared with other pages rendered by webview, the rendering speed is slower when the H5 page is rendered by webview, and thus the user experience is greatly reduced, whereas when the H5 page is rendered by the scheme provided in this embodiment, the rendering speed is greatly increased, and thus the page display speed is increased, and the rendering success probability is ensured, so that the user experience is better.
The rendering method of the character string of the present embodiment may be executed by any suitable terminal device with data processing capability, including but not limited to: mobile terminals (such as tablet computers, mobile phones and the like) and PCs.
EXAMPLE III
Referring to fig. 4, a block diagram of a rendering apparatus for a character string according to a third embodiment of the present invention is shown.
The rendering apparatus of character strings shown in fig. 4 includes: a splitting module 302 and a rendering module 304.
The splitting module 302 is configured to determine a character string that needs to be split according to a hierarchical relationship between tags in the character string, and split the character string that needs to be split to obtain a plurality of sub-character strings.
A rendering module 304, configured to determine, according to the multiple substrings, a view component for bearing a corresponding substring, and render, according to the multiple view components bearing the substrings, the multiple substrings.
In an alternative embodiment, the splitting module 302 includes: and the determining module is used for determining that the character string corresponding to the label is the character string needing to be split if the fact that the parent label corresponding to the label does not exist in the character string is determined according to the hierarchical relationship among the labels in the character string.
In an alternative embodiment, the splitting module 302 includes: and the view component determining module is used for determining the view component as the substring of the text component and determining the view component for bearing the corresponding substring according to the rest substrings.
In an alternative embodiment, the rendering module 304 includes: and the sequential rendering module is used for rendering the view components bearing the substrings into a layout container according to a splitting sequence so as to render the substrings.
According to the scheme provided by the embodiment of the invention, the character string needing to be split is determined according to the hierarchical relationship among the labels in the character string, and the character string needing to be split is split to obtain a plurality of sub-character strings; and determining a view component for bearing a corresponding sub-character string according to the labels respectively included in the sub-character strings, rendering the sub-character strings according to the view components bearing the sub-character strings, and then using a native component to bear part or all of the sub-character strings, thereby improving the rendering speed and avoiding the problems of rendering errors or slow rendering speed in the prior art.
Example four
A terminal device, comprising: the system comprises a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface complete mutual communication through the communication bus; the memory is used for storing at least one executable instruction, and the executable instruction causes the processor to execute the operation corresponding to the character string rendering method.
Specifically, referring to fig. 5, a schematic structural diagram of a terminal device according to a fourth embodiment of the present invention is shown, and the specific embodiment of the present invention does not limit the specific implementation of the terminal device.
As shown in fig. 5, the terminal device may include: a processor (processor)402, a Communications Interface 404, a memory 406, and a Communications bus 408.
Wherein:
the processor 402, communication interface 404, and memory 406 communicate with each other via a communication bus 408.
A communication interface 404 for communicating with other terminal devices or servers.
The processor 402 is configured to execute the program 410, and may specifically perform relevant steps in the above embodiment of the rendering method for a character string.
In particular, program 410 may include program code comprising computer operating instructions.
The processor 402 may be a central processing unit CPU, or an application specific Integrated circuit asic, or one or more Integrated circuits configured to implement an embodiment of the present invention. The terminal device comprises one or more processors, which can be the same type of processor, such as one or more CPUs; or may be different types of processors such as one or more CPUs and one or more ASICs.
And a memory 406 for storing a program 410. Memory 406 may comprise high-speed RAM memory, and may also include non-volatile memory (non-volatile memory), such as at least one disk memory.
The program 410 may specifically be configured to cause the processor 402 to perform the following operations: determining a character string needing to be split according to the hierarchical relationship among labels in the character string, and splitting the character string needing to be split to obtain a plurality of sub-character strings; and determining a view component for bearing the corresponding sub-character string according to the sub-character strings, and rendering the sub-character strings according to the view components bearing the sub-character strings.
In an optional implementation manner, the determining, according to a hierarchical relationship between tags in a character string, a character string that needs to be split includes: and if the fact that the corresponding parent label does not exist in the label in the character string is determined according to the hierarchical relation between the labels in the character string, determining the character string corresponding to the label as the character string needing to be split.
In an optional implementation manner, if it is determined that there is no corresponding parent tag in the character string according to the hierarchical relationship between the tags in the character string, determining that the character string corresponding to the tag is the character string that needs to be split includes: if the fact that the corresponding parent label exists in the label in the character string is determined according to the hierarchical relationship among the labels in the character string, the fact that the relationship between the parent label and the parent label is a nested relationship is determined, the outermost label corresponding to the nested relationship is the label without the parent label, and the character string corresponding to the outermost label is determined to be the character string needing to be split.
In an optional implementation manner, the determining that the character string corresponding to the tag is a character string that needs to be split includes: and determining the label and the element corresponding to the label as character strings needing to be split.
In an optional embodiment, the determining, according to the plurality of substrings, a view component for carrying a corresponding substring includes: and determining the view component as a substring of the text component, and determining the view component for bearing the corresponding substring according to the remaining substrings.
In an alternative embodiment, the native component has a higher priority than the non-native component when determining the view component for carrying the corresponding substring based on the remaining substrings.
In an optional embodiment, the rendering the plurality of sub-character strings according to the plurality of view components bearing the sub-character strings includes: rendering the view components carrying the substrings into a layout container according to a splitting order so as to render the substrings.
For specific implementation of each step in the program 410, reference may be made to corresponding steps and corresponding descriptions in units in the foregoing embodiments of the rendering method for a character string, which are not described herein again. It can be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described devices and modules may refer to the corresponding process descriptions in the foregoing method embodiments, and are not described herein again.
According to the terminal equipment of the embodiment, the character string needing to be split is determined according to the hierarchical relationship among the labels in the character string, and the character string needing to be split is split to obtain a plurality of sub-character strings; and determining a view component for bearing a corresponding sub-character string according to the labels respectively included in the sub-character strings, rendering the sub-character strings according to the view components bearing the sub-character strings, and then using a native component to bear part or all of the sub-character strings, thereby improving the rendering speed and avoiding the problems of rendering errors or slow rendering speed in the prior art.
It should be noted that, according to the implementation requirement, each component/step described in the embodiment of the present invention may be divided into more components/steps, and two or more components/steps or partial operations of the components/steps may also be combined into a new component/step to achieve the purpose of the embodiment of the present invention.
The above-described method according to an embodiment of the present invention may be implemented in hardware, firmware, or as software or computer code storable in a recording medium such as a CD ROM, a RAM, a floppy disk, a hard disk, or a magneto-optical disk, or as computer code originally stored in a remote recording medium or a non-transitory machine-readable medium downloaded through a network and to be stored in a local recording medium, so that the method described herein may be stored in such software processing on a recording medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware such as an ASIC or FPGA. It will be appreciated that the computer, processor, microprocessor controller or programmable hardware includes memory components (e.g., RAM, ROM, flash memory, etc.) that can store or receive software or computer code that, when accessed and executed by the computer, processor or hardware, implements the string rendering method described herein. Further, when a general-purpose computer accesses code for implementing the rendering method of a character string shown herein, execution of the code converts the general-purpose computer into a special-purpose computer for executing the rendering method of a character string shown herein.
Those of ordinary skill in the art will appreciate that the various illustrative elements and method steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present embodiments.
The above embodiments are only for illustrating the embodiments of the present invention and not for limiting the embodiments of the present invention, and those skilled in the art can make various changes and modifications without departing from the spirit and scope of the embodiments of the present invention, so that all equivalent technical solutions also belong to the scope of the embodiments of the present invention, and the scope of patent protection of the embodiments of the present invention should be defined by the claims.

Claims (13)

1. A rendering method of a character string, comprising:
determining a character string needing to be split according to the hierarchical relationship among labels in the character string, and splitting the character string needing to be split to obtain a plurality of sub-character strings;
and determining a view component for bearing the corresponding sub-character string according to the sub-character strings, and rendering the sub-character strings according to the view components bearing the sub-character strings.
2. The method according to claim 1, wherein the determining the character string to be split according to the hierarchical relationship between the labels in the character string comprises:
and if the fact that the corresponding parent label does not exist in the label in the character string is determined according to the hierarchical relation between the labels in the character string, determining the character string corresponding to the label as the character string needing to be split.
3. The method according to claim 2, wherein if it is determined that there is no corresponding parent tag in the character string according to the hierarchical relationship between the tags in the character string, determining that the character string corresponding to the tag is a character string that needs to be split includes:
if the fact that the corresponding parent label exists in the label in the character string is determined according to the hierarchical relationship among the labels in the character string, the fact that the relationship between the parent label and the parent label is a nested relationship is determined, the outermost label corresponding to the nested relationship is the label without the parent label, and the character string corresponding to the outermost label is determined to be the character string needing to be split.
4. The method of claim 1, wherein the determining that the character string corresponding to the tag is a character string that needs to be split includes:
and determining the label and the element corresponding to the label as character strings needing to be split.
5. The method of claim 1, wherein determining, from the plurality of substrings, a view component for carrying a corresponding substring comprises:
and determining the view component as a substring of the text component, and determining the view component for bearing the corresponding substring according to the remaining substrings.
6. The method of claim 5, wherein the native component has a higher priority than the non-native component when determining the view component for carrying the corresponding substring based on the remaining substrings.
7. The method of claim 1, wherein the rendering the plurality of substrings according to the plurality of view components bearing the substrings comprises:
rendering the view components carrying the substrings into a layout container according to a splitting order so as to render the substrings.
8. An apparatus for rendering a character string, comprising:
the splitting module is used for determining the character string needing to be split according to the hierarchical relationship among the labels in the character string and splitting the character string needing to be split to obtain a plurality of sub-character strings;
and the rendering module is used for determining a view component for bearing the corresponding sub-character string according to the sub-character strings and rendering the sub-character strings according to the view components bearing the sub-character strings.
9. The apparatus of claim 8, wherein the splitting module comprises:
and the determining module is used for determining that the character string corresponding to the label is the character string needing to be split if the fact that the parent label corresponding to the label does not exist in the character string is determined according to the hierarchical relationship among the labels in the character string.
10. The apparatus of claim 8, wherein the splitting module comprises:
and the view component determining module is used for determining the view component as the substring of the text component and determining the view component for bearing the corresponding substring according to the rest substrings.
11. The apparatus of claim 8, wherein the rendering module comprises:
and the sequential rendering module is used for rendering the view components bearing the substrings into a layout container according to a splitting sequence so as to render the substrings.
12. A terminal device, comprising: the system comprises a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface complete mutual communication through the communication bus;
the memory is used for storing at least one executable instruction, and the executable instruction causes the processor to execute the operation corresponding to the character string rendering method according to any one of claims 1-7.
13. A computer storage medium having stored thereon a computer program which, when executed by a processor, implements a rendering method of a character string according to any one of claims 1 to 7.
CN201910220170.3A 2019-03-22 Character string rendering method and device, terminal equipment and computer storage medium Active CN111723316B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910220170.3A CN111723316B (en) 2019-03-22 Character string rendering method and device, terminal equipment and computer storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910220170.3A CN111723316B (en) 2019-03-22 Character string rendering method and device, terminal equipment and computer storage medium

Publications (2)

Publication Number Publication Date
CN111723316A true CN111723316A (en) 2020-09-29
CN111723316B CN111723316B (en) 2024-06-04

Family

ID=

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2011149747A2 (en) * 2010-05-25 2011-12-01 Microsoft Corporation Efficient application-neutral vector documents
WO2013135188A1 (en) * 2012-03-14 2013-09-19 优视科技有限公司 Calling method and device for extender
US20140253584A1 (en) * 2013-03-08 2014-09-11 Apple Inc. Subpixel Shape Smoothing Based On Predicted Shape Background Information
CN107066186A (en) * 2017-02-23 2017-08-18 青岛海信电器股份有限公司 A kind of UI interfaces character methods of exhibiting and display device based on Canvas
CN107368487A (en) * 2016-05-12 2017-11-21 阿里巴巴集团控股有限公司 A kind of page assembly Dynamic Distribution method, apparatus and client
CN108280119A (en) * 2017-11-29 2018-07-13 广州市动景计算机科技有限公司 Page generation method, device and user terminal
CN108279964A (en) * 2018-01-19 2018-07-13 广州视源电子科技股份有限公司 The implementation method and device that text control, mask for copy editor render
US20190079649A1 (en) * 2017-09-12 2019-03-14 Sap Se Ui rendering based on adaptive label text infrastructure

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2011149747A2 (en) * 2010-05-25 2011-12-01 Microsoft Corporation Efficient application-neutral vector documents
WO2013135188A1 (en) * 2012-03-14 2013-09-19 优视科技有限公司 Calling method and device for extender
US20140253584A1 (en) * 2013-03-08 2014-09-11 Apple Inc. Subpixel Shape Smoothing Based On Predicted Shape Background Information
CN107368487A (en) * 2016-05-12 2017-11-21 阿里巴巴集团控股有限公司 A kind of page assembly Dynamic Distribution method, apparatus and client
CN107066186A (en) * 2017-02-23 2017-08-18 青岛海信电器股份有限公司 A kind of UI interfaces character methods of exhibiting and display device based on Canvas
US20190079649A1 (en) * 2017-09-12 2019-03-14 Sap Se Ui rendering based on adaptive label text infrastructure
CN108280119A (en) * 2017-11-29 2018-07-13 广州市动景计算机科技有限公司 Page generation method, device and user terminal
CN108279964A (en) * 2018-01-19 2018-07-13 广州视源电子科技股份有限公司 The implementation method and device that text control, mask for copy editor render

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
彭四伟;蔡明;: "基于OGRE的汉字渲染方案", 计算机***应用, no. 10, 15 October 2010 (2010-10-15), pages 173 - 176 *

Similar Documents

Publication Publication Date Title
CN108415702B (en) Dynamic rendering method and device for application interface of mobile terminal
CN107704615B (en) Webpage font display method and system based on Chinese font subset
CN108121539B (en) Component processing method and device
CN113382083B (en) Webpage screenshot method and device
CN107798064B (en) Page processing method, electronic device and computer readable storage medium
CN108885544B (en) Front-end page internationalized processing method, application server and computer-readable storage medium
CN106294480A (en) A kind of file layout change-over method, device and examination question import system
CN114218890A (en) Page rendering method and device, electronic equipment and storage medium
CN115731313A (en) SVG format picture processing method, device, equipment, medium and product
CN113360106B (en) Webpage printing method and device
CN104462036A (en) Method and system for synchronously editing format information of document
CN104899203B (en) Webpage generation method and device and terminal equipment
CN110807162A (en) Method and device for loading occupation bitmap
CN111240962B (en) Test method, test device, computer equipment and computer storage medium
CN111723316B (en) Character string rendering method and device, terminal equipment and computer storage medium
CN111723316A (en) Character string rendering method and device, terminal equipment and computer storage medium
CN113177391B (en) Method for redirecting operation cursor in streaming interface, computing equipment and storage medium
CN111724453A (en) Rich text rendering method and device, terminal equipment and computer storage medium
CN105260353A (en) Typesetting method and device for mobile terminal
CN109726346B (en) Page component processing method and device
CN112686000B (en) Format conversion method of electronic book document, electronic equipment and storage medium
CN114020187A (en) Font icon display method and device and electronic equipment
US20220214773A1 (en) Method and system for transforming wireframes to as-is screens with responsive behaviour
CN110309517B (en) Expression document processing method, device, system and storage medium
CN113760283A (en) Text rendering method and device

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
GR01 Patent grant