CN105095161B - Method and device for displaying rich text information - Google Patents

Method and device for displaying rich text information Download PDF

Info

Publication number
CN105095161B
CN105095161B CN201410191115.3A CN201410191115A CN105095161B CN 105095161 B CN105095161 B CN 105095161B CN 201410191115 A CN201410191115 A CN 201410191115A CN 105095161 B CN105095161 B CN 105095161B
Authority
CN
China
Prior art keywords
information
information element
picture
display
block
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.)
Active
Application number
CN201410191115.3A
Other languages
Chinese (zh)
Other versions
CN105095161A (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.)
Tencent Technology Beijing Co Ltd
Original Assignee
Tencent Technology Beijing 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 Tencent Technology Beijing Co Ltd filed Critical Tencent Technology Beijing Co Ltd
Priority to CN201410191115.3A priority Critical patent/CN105095161B/en
Publication of CN105095161A publication Critical patent/CN105095161A/en
Application granted granted Critical
Publication of CN105095161B publication Critical patent/CN105095161B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Information Transfer Between Computers (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

The invention discloses a method and a device for displaying rich text information, and belongs to the field of internet. The method comprises the following steps: acquiring each information element included in the rich text information; arranging the basic drawing unit corresponding to each information element in a display interface; converting each information element to obtain a picture of each information element; and respectively drawing each information element on the basic drawing unit corresponding to each information element by referring to the picture of each information element so as to display the rich text information. The device comprises: the device comprises an acquisition module, a discharge module, a conversion module and a drawing module. The invention can improve the display efficiency of displaying rich text information.

Description

Method and device for displaying rich text information
Technical Field
The invention relates to the field of internet, in particular to a method and a device for displaying rich text information.
Background
Information in social platforms such as early microblogs and instant messaging is plain text information, and information elements contained in the plain text information are single, so that pursuit of users for information diversity cannot be met. To meet the pursuit of users, rich text information is currently emerging. The rich Text information contains rich information elements, which include various information elements such as nicknames, expressions, topics, HTML (Hyper Text Mark-up Language) elements, hyperlinks and plain texts.
Since rich text information is different from plain text information, it requires a separate display method to display. At present, there is a method for displaying rich text information, which may be that when a client receives a piece of rich text information, the client parses information elements included in the rich text information according to a preset regular expression, and the parsed information elements include a nickname, an expression, a topic, an HTML element and/or a hyperlink, and the like. And calling the WebView display control, wherein the WebView display control can only display information elements in an HTML format. Therefore, for the HTML elements in the HTML format, the HTML elements can be directly displayed in the WebView display control. For the nicknames, expressions, topics and hyperlinks in the non-HTML format, the nicknames, the expressions, the topics and the hyperlinks need to be converted into information elements in the HTML format through a preset JS code, and then the converted information elements are displayed in the WebView display control.
In the process of implementing the invention, the inventor finds that the prior art has at least the following problems:
for information elements such as nicknames, expressions, topics, hyperlinks and the like in a non-HTML format, the information elements in the non-HTML format need to be converted into the information elements in the HTML format through JS codes, the conversion process is complicated, the time spent in the conversion is long, and meanwhile, a large amount of hardware resources are occupied, so that the display efficiency of displaying rich text information is low.
Disclosure of Invention
In order to improve the display efficiency of displaying rich text information, the invention provides a method and a device for displaying rich text information. The technical scheme is as follows:
a method for displaying rich text information is applied to a terminal, and the method comprises the following steps:
acquiring each information element included in the rich text information;
arranging the basic drawing unit corresponding to each information element in a display interface;
for the character elements in each information element, acquiring character information and display style information of the character elements from an element block of the character elements, rendering the character information in a text region according to the display style information, carrying out screenshot on the character information in the text region, and taking the intercepted picture as a picture corresponding to the character elements;
for the picture element in each information element, obtaining a picture included in the picture element from an element block of the picture element, and determining the picture included in the picture element as a picture corresponding to the picture element;
and respectively drawing each information element on the basic drawing unit corresponding to each information element by referring to the picture of each information element so as to display the rich text information.
An apparatus to display rich textual information, the apparatus comprising:
the acquiring module is used for acquiring each information element included in the rich text information;
the discharge module is used for discharging the basic drawing unit corresponding to each information element in a display interface;
the conversion module is used for acquiring the text information and the display style information of the text elements from the element blocks of the text elements for the text elements in each information element, rendering the text information in a text area according to the display style information, carrying out screenshot on the text information in the text area, and taking the intercepted picture as the picture corresponding to the text elements; for the picture element in each information element, obtaining a picture included in the picture element from an element block of the picture element, and determining the picture included in the picture element as a picture corresponding to the picture element;
and the drawing module is used for drawing each information element on the corresponding basic drawing unit of each information element respectively by referring to the picture of each information element so as to display the rich text information.
A computer-readable storage medium having a program stored therein, the program being executed by a processor to implement the method of displaying rich textual information as described above.
In the embodiment of the invention, each information element in the rich text information is converted to obtain the picture of each information element, and each information element is directly drawn in the basic drawing unit corresponding to each information element by referring to the picture of each information element, so that the format of any information element does not need to be converted, and the display efficiency of displaying the rich text information is improved.
Drawings
FIG. 1 is a flow chart of a method of displaying rich textual information according to an embodiment of the present invention;
fig. 2-1 is a flowchart of a method for displaying rich text information according to embodiment 2 of the present invention;
fig. 2-2 is a schematic diagram of a piece of rich text information provided in embodiment 2 of the present invention;
fig. 2-3 are schematic diagrams of an intercepted picture provided in embodiment 2 of the present invention;
2-4 are schematic diagrams for displaying rich text information provided by embodiment 2 of the present invention;
fig. 3 is a schematic structural diagram of an apparatus for displaying rich text information according to embodiment 3 of the present invention;
fig. 4 is a schematic structural diagram of a terminal for displaying rich text information according to embodiment 4 of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, embodiments of the present invention will be described in detail with reference to the accompanying drawings.
Example 1
Referring to fig. 1, an embodiment of the present invention provides a method for displaying rich text information, including:
step 101: acquiring each information element included in the rich text information;
step 102: arranging a basic drawing unit corresponding to each information element in a display interface;
step 103: converting each information element to obtain a picture of each information element;
step 104: and respectively drawing each information element on the corresponding basic drawing unit of each information element by referring to the picture of each information element so as to display the rich text information.
The execution main body of the embodiment of the invention can be a terminal.
In the embodiment of the invention, each information element in the rich text information is converted to obtain the picture of each information element, and each information element is directly drawn in the basic drawing unit corresponding to each information element by referring to the picture of each information element, so that the format of any information element does not need to be converted, and the display efficiency of displaying the rich text information is improved.
Example 2
Referring to fig. 2-1, an embodiment of the present invention provides a method for displaying rich text information, including:
step 201: receiving rich text information, and acquiring information elements included in the rich text information;
the rich text information is composed of one or more information elements, and the rich text information can comprise information elements of various element types such as html elements, nicknames, topics, hyperlinks and/or expressions. The rich text information may be microblog information or the like, for example, see a piece of rich text information shown in fig. 2-2, and the rich text information includes html elements, nicknames, topics, hyperlinks, and expressions. Any two adjacent information elements in the rich text information are separated by a separator.
The step may be to receive rich text information from the server, divide the rich text information according to separators included in the rich text information, and obtain each information element included in the rich text information.
For example, the rich text information shown in fig. 2-2 is divided to obtain a first information element, a second information element, a third information element, a fourth information element and a fifth information element included in the rich text information. The first information element is "@ stubborn small beaver", and the second information element is "album" pace published two days before May days "which includes the song 14 years ago. "and the third information element is" music: http://163.fm/VlzTml2 ", the fourth information element is" # horse aviation rescue situation # "and the fifth information element is an expression picture.
Step 202: acquiring the element type of each information element included in the rich text information;
specifically, a regular expression corresponding to each element type is obtained from a stored corresponding relationship between the element types and the regular expressions, for each information element in the rich text information, an information format corresponding to the information element is matched with the regular expression corresponding to each element type, a corresponding regular expression is matched, and the element type corresponding to the matched regular expression is used as the element type of the information element.
Generating a regular expression corresponding to each element type in advance according to the information format corresponding to each element type, and storing each element type and the regular expression corresponding to each element in a corresponding relation between the element type and the regular expression.
For example, the html element corresponds to an information format: the regular expression generated according to the information format is as follows: @' (< a [ < > < > < >) ". The information format corresponding to the nickname is as follows: @ nickname, and the regular expression generated according to the information format is: @' (@ ([ \ u4E00- \ u9FA5a-zA-Z0-9_ - ] +)). The information format corresponding to the topic is as follows: topic #, the regular expression generated according to the information format is: @' (\\ \ u4E00- \ u9FA5a-zA-Z \\. + ] +).
TABLE 1
Figure BDF0000007121470000051
For a piece of rich text information shown in fig. 2-2, first, a regular expression corresponding to each element type is obtained from the corresponding relationship between the element types and the regular expressions shown in table 1, for a first information element "@ stubborn strong little racoon in the rich text information, an information format corresponding to the first information element is matched with the regular expression corresponding to each element type, a corresponding regular expression is" @ ([ \ u4E00- \ u9FA5a-zA-Z0-9_ +) ") is matched, and an element type" topic "corresponding to the matched regular expression is used as the element type of the first information element. In the same manner as above, the element type of the second information element is "html element", the element type of the third information element is "hyperlink", the element type of the fourth information element is "topic", and the element type of the fifth information element is "expression".
Step 203: for each acquired information element, creating a corresponding element block for the information element;
the element block corresponding to the information element is a data structure, and the element block comprises a jump attribute, a display attribute and the like.
Step 204: determining whether the information element is a text element or a picture element according to the element type of the information element, if the information element is a text element, executing step 205, and if the information element is a picture element, executing step 208;
for information elements such as html elements, nicknames, topics, hyperlinks and the like, the information elements include text information, so that the information elements are text elements. For information elements such as expressions, the information elements are composed of one or more pictures, so the information elements are picture-like elements. The character type elements correspond to an element type set, and the element type set comprises html elements, nicknames, topics, hyperlinks and other element types; the picture element corresponds to an element type set, and the element type set comprises element types such as expressions.
The method comprises the following steps: judging the element type of the information element, and if the element type corresponding to the information element exists in the element type set corresponding to the character element, determining that the information element is the character element; and if the element type of the information element exists in the element type set corresponding to the picture class element, determining that the information element is the information element of the picture class.
For example, as for the first information element included in the rich text information shown in fig. 2-2, the element type "nickname" of the first information element is determined, and the element type "nickname" of the first information element is determined to be the element type in the element type set corresponding to the word type element, so that the first information element is determined to be the word type element.
Step 205: acquiring display style information of the information element according to the element type of the information element, and storing the information element and the display style information of the information element in an element block corresponding to the information element;
in order to perform personalized display on the information elements corresponding to each element type, display style information corresponding to each element type is defined in advance, and the display style information comprises information such as fonts, sizes, colors, underlines and/or line spacing. And then storing each element type and the display style information corresponding to each element type in the corresponding relationship between the element type and the display style information.
The method comprises the following steps: and according to the element type of the information element, acquiring corresponding display style information from the corresponding relation between the stored element type and the display style information, determining the acquired display style information as the display style information of the information element, and storing the information element and the display style information corresponding to the information element in an element block corresponding to the information element.
For example, the previously defined display style information corresponding to the nickname includes: the font is a regular script, the size is a four-point bold font and the color is black; the display style information defining the html element includes: the font is a regular font, the size is four marks and the color is black; the display style information defining the hyperlink includes: the font is a regular script, the size is four, the color is black and is underlined; the display style information defining the topic includes: the font is regular font, the size is four marks, and the color is red. Then, each element type and display style information corresponding to each element type are stored in the correspondence relationship between the element type and the display style information as shown in table 2.
TABLE 2
Figure BDF0000007121470000061
For the first information element, according to the element type "nickname" of the first information element, the display style information "font is a regular font, a bold font with a size of four and a black color" corresponding to the first information element is obtained from the correspondence between the element type and the display style information shown in table 2, and the display style information "font is a regular font, a bold font with a size of four and a black color" corresponding to the first information element and the first information element is stored in the element block corresponding to the first information element.
Step 206: determining whether the information element has a jump function according to the element type of the information element, and if so, executing step 207;
for an information element with a jump function, if the information element is clicked, a jump to a page corresponding to the information element can be made according to a jump address of the information element. The information elements with the jump function comprise information elements such as hyperlinks, topics and nicknames. Therefore, an element type set with a jump function is established in advance, and the element type set comprises element types such as hyperlinks, topics and nicknames.
The method comprises the following steps: judging the element type of the information element, and if the element type corresponding to the information element exists in the element type set with the jump function, determining that the information element has the jump function; and if the element type corresponding to the information element does not exist in the element type set with the jump function, determining that the information element does not have the jump function.
Wherein if it is determined that the information element does not have the jump function, step 209 is directly performed.
For example, the element type "nickname" of the first information element is determined, and the element type "nickname" of the first information element is determined to be an element type existing in the element type set having the jump function, thereby determining that the first information element has the jump function.
Step 207: acquiring a jump address of the information element, setting a jump attribute in an element block of the information element, storing the jump address in an element block corresponding to the information element, and executing step 209;
if the information element is a hyperlink, acquiring a URL included in the information element, and using the URL as a jump address of the information element; and if the information element is a nickname or a topic, acquiring the character information included by the information element, and taking the character information as the jump address of the information element.
For example, the first information element is a nickname, the character information included in the first information element is acquired as "stubborn small beaver", the character information "stubborn small beaver" is used as a jump address of the first information element, and the jump address is stored in an element block corresponding to the first information element.
Step 208: acquiring a picture included by the information element, and storing the picture included by the information element in an element block corresponding to the information element;
if the information element is an expression and is a dynamic expression, acquiring the playing frame rate of the information element, and storing the playing frame rate of the information element in an element block corresponding to the information element.
For each other information element in the rich text information, the element block corresponding to each information element is obtained according to the steps 203 to 208, and the obtained element block corresponding to each information element is stored in the element block list. For example, according to the above steps 203 to 208, the element block corresponding to the second information element, the element block corresponding to the third information element, the element block corresponding to the fourth information element, and the element block corresponding to the fifth information element are obtained, and the element block corresponding to the first information element, the element block corresponding to the second information element, the element block corresponding to the third information element, the element block corresponding to the fourth information element, and the element block corresponding to the fifth information element are stored in the element block list.
Step 209: acquiring a display range of each information element in a display interface and a basic drawing unit corresponding to each information element, and respectively storing the display range of each information element and the corresponding basic drawing unit in an element block corresponding to each information element;
this step can be realized by the following steps (1) to (3), including:
(1): determining the display range of each information element in the display interface according to the width of the display interface;
and arranging each information element on the display interface according to the width of the display interface to obtain the display range of each information element in the display interface, wherein the arrangement sequence of each information element on the display interface is the same as the position sequence of each information element in the rich text information.
For example, the first information element, the second information element, the third information element, the fourth information element, and the fifth information element are arranged on the display interface according to the width of the display interface, and the display range of the first information element is "abscissa 0 of the first row to abscissa 6 of the first row", the display range of the second information element is "abscissa 7 of the first row to abscissa 10 of the second row", the display range of the third information element is "abscissa 11 of the second row to abscissa 23 of the second row", the display range of the fourth information element is "abscissa 0 of the third row to abscissa 10 of the third row", and the display range of the fifth information element is "abscissa 11 of the third row to abscissa 14 of the third row".
(2): respectively acquiring a basic drawing unit corresponding to each information element according to the line number occupied by the display range of each information element;
wherein each row corresponds to a basic rendering unit. For example, assuming that the display range of a certain information element takes three lines, three basic drawing units corresponding to the information element are acquired. The basic drawing unit can be a control such as an Ulable.
(3): and respectively storing the display range of each information element and the corresponding basic drawing unit in the element block corresponding to each information element.
For example, if the display range of the first information element occupies one line, a basic drawing unit is created for the first information element, and the display range of the first information element and a corresponding basic drawing unit are stored in the element block corresponding to the first element. And if the display range of the second information element occupies two lines, creating two basic drawing units for the second information element, and storing the display range of the second information element and the two corresponding basic drawing units in an element block corresponding to the second element. And if the display range of the third information element occupies one row, creating a basic drawing unit for the third information element, and storing the display range of the third information element and a corresponding basic drawing unit in an element block corresponding to the third element. And if the display range of the fourth information element occupies one line, creating a basic drawing unit for the fourth information element, and storing the display range of the fourth information element and a corresponding basic drawing unit in an element block corresponding to the fourth element. And if the display range of the fifth information element occupies one row, creating a basic drawing unit for the fifth information element, and storing the display range of the fifth information element and a corresponding basic drawing unit in an element block corresponding to the fifth element.
After the element block corresponding to each information element included in the rich text information is acquired, the rich text information can be displayed according to the following procedures, including:
step 210: arranging a basic drawing unit corresponding to each information element in a display interface;
specifically, an element block of an information element is selected from the element block list, a basic drawing unit corresponding to the information element and a display range of the information element are obtained from the element block, and the basic drawing unit corresponding to the information element is placed on a display interface according to the display range of the information element. And for each unselected information element included in the element list, placing the basic drawing unit corresponding to each unselected information element on the display interface according to the same method.
Further, for the element block of the selected information element, if the jump attribute of the element block is set, it is determined that the information element has a jump function, a jump address of the information element is acquired from the element block corresponding to the information element, and the correspondence between the display range of the information element and the jump address is stored in a jump list.
For example, an element block of a first information element is selected from the element block list, a basic drawing unit corresponding to the first information element and a display range of the first information element are acquired from the element block, and the basic drawing unit corresponding to the first information element is placed on the display interface according to the display range of the first information element. And respectively placing a basic drawing unit corresponding to the second information element, a basic drawing unit corresponding to the third information element, a basic drawing unit corresponding to the fourth information element and a basic drawing unit corresponding to the fifth information element on the display interface according to the same method.
Step 211: converting each information element to obtain a picture of each information element;
specifically, for each information element selected in step 210, if the information element is a text element, the text information and the display style information of the information element are obtained from the element block of the information element, the text information of the information element is rendered in the text region according to the display style information of the information element, the text information in the text region is captured, and the captured picture is used as the picture of the information element. And if the information element is a picture type element, acquiring a picture included in the information element from an element block of the information element, and taking the acquired picture as the picture of the information element.
For example, for the first information element, the text information "@ stubborn small beaver" and the display style information "font of regular script, bold four-point and black color" of the first information element are obtained from the element block of the first information element, the text information of the first information element is rendered in the text region according to the display style information of the first information element, the text information in the text region is subjected to screenshot to obtain the intercepted picture shown in fig. 2-3, and the intercepted picture is taken as the picture of the first information element. The picture of each other information element is obtained in the same way as described above.
Step 212: and respectively drawing each information element on the corresponding basic drawing unit of each information element by referring to the picture of each information element so as to display the rich text information on the display interface.
For example, referring to fig. 2-4, referring to the picture of the first information element, the picture of the second information element, the picture of the third information element, the picture of the fourth information element, and the picture of the fifth information element, the first information element, the second information element, the third information element, the fourth information element, and the fifth information element are respectively drawn on the respective corresponding basic drawing units, so as to display a piece of rich text information as shown in fig. 2-2 on the display interface.
If the rich text information contains the dynamic expression, acquiring a playing frame rate of the dynamic expression from an element block corresponding to the dynamic expression, repeatedly drawing pictures included by the dynamic expression on a basic drawing unit corresponding to the dynamic expression according to the playing frame rate, namely, sequentially drawing the pictures included by the dynamic expression on the basic drawing unit corresponding to the dynamic expression according to the playing frame rate, and when the pictures are drawn, sequentially drawing the pictures included by the dynamic expression again according to the playing frame rate.
After the rich text information is displayed, if a user wants to view a page corresponding to an information element with a jump function, the information element with the jump function can be clicked.
When it is detected that the user clicks the information element in the display interface, the clicking position of the user is obtained, the skip list is searched according to the clicking position, if the display range containing the clicking position is searched, the fact that the information element clicked by the user has a skip function is determined, and the page corresponding to the information element clicked by the user is skipped according to the skip address corresponding to the searched display range.
And if the information element clicked by the user is a hyperlink, the jump address of the information element is a URL (uniform resource locator), and a corresponding page is opened according to the URL, wherein the page is the page corresponding to the information element clicked by the user.
If the information element clicked by the user is a nickname, the jump address of the information element is the nickname, a background database of the server is searched according to the nickname, user basic information containing the nickname is searched, the user basic information of each user registered in the server is stored in the background data, the user basic information comprises information such as the nickname, the name, the age and/or the occupation, the nickname of each user is different, a page is generated according to the searched user basic information, and the generated page is the page corresponding to the information element clicked by the user.
If the information element clicked by the user is a topic, the jump address of the information element is the topic, the instant information stored by the server is searched according to the topic, the instant information can be microblog information, the instant information containing the topic is searched, a page is generated according to the searched instant information, and the generated page is the page corresponding to the information element clicked by the user.
Further, in the embodiment of the present invention, an element type of a new information element and a corresponding regular expression may also be defined to implement expanding the information element.
The execution main body of the embodiment of the invention can be a terminal.
In the embodiment of the invention, each information element in the rich text information is converted to obtain the picture of each information element, and each information element is directly drawn in the basic drawing unit corresponding to each information by referring to the picture of each information element, so that the format of any information element does not need to be converted, thereby improving the display efficiency of displaying the rich text information; in addition, corresponding display style information can be defined for each type of information element, so that each type of information element can be displayed in a personalized manner.
Example 3
Referring to fig. 3, an embodiment of the present invention provides an apparatus for displaying rich text information, including:
an obtaining module 301, configured to obtain each information element included in the rich text information;
a discharge module 302, configured to discharge, in the display interface, the basic drawing unit corresponding to each information element;
a conversion module 303, configured to convert each information element to obtain a picture of each information element;
and a drawing module 304, configured to draw each information element on a corresponding basic drawing unit of each information element, respectively, with reference to the picture of each information element, so as to display the rich text information.
Preferably, the exhaust module 302 includes:
a selection unit configured to select an element block of one information element from an element block list for storing an element block of each information element;
the first acquisition unit is used for acquiring a basic drawing unit corresponding to the selected information element and a display range of the selected information element in the display interface from the element block;
and the placing unit is used for placing the basic drawing unit corresponding to the selected information element in the display interface according to the display range.
Preferably, the conversion module 303 comprises:
the screenshot unit is used for acquiring the character information and the display style information of the selected information element from the element block if the selected information element is a character element, rendering the character information in the text area according to the display style information, screenshot the character information in the text area, and taking the intercepted picture as the picture corresponding to the selected information element;
and the first determining unit is used for acquiring the picture included by the selected information element from the element block if the selected information element is the picture type element, and determining the picture included by the selected information element as the picture corresponding to the selected information element.
Further, the apparatus further comprises:
and the first storage module is used for acquiring the jump address of the selected information element from the element block and storing the corresponding relation between the display range and the jump address in a jump list if the selected information element has the jump function.
Further, the apparatus further comprises:
and the skipping module is used for determining whether the information element clicked by the user has a skipping function or not according to the skipping list when the information element clicked by the user in the display interface is detected, and skipping to the page corresponding to the information element clicked by the user if the information element clicked by the user has the skipping function.
Preferably, the skip module includes:
the second module unit is used for acquiring the click position of the user and searching the skip list according to the click position;
the second determining unit is used for determining that the information element clicked by the user has a skip function if the display range containing the click position is found out;
and the jumping unit is used for jumping to a page corresponding to the information element clicked by the user according to the jumping address corresponding to the searched display range.
Further, the apparatus further comprises:
the device comprises a creating module, a judging module and a judging module, wherein the creating module is used for creating an element block for an information element when the information element is acquired;
the second storage module is used for acquiring the display style information of the information element according to the element type of the information element and storing the information element and the display style information in the element block if the information element is a character element;
and the third storage module is used for acquiring the pictures included by the information element if the information element is a picture type element, and storing the pictures included by the information element in the element block.
Further, the apparatus further comprises:
and the fourth storage module is used for acquiring the jump address of the information element if the information element has the jump function, setting the jump attribute of the element block and storing the jump address in the element block.
Further, the apparatus further comprises:
the fifth storage module is used for respectively determining the display range of each information element in the display interface according to the width of the display interface; respectively acquiring a basic drawing unit corresponding to each information element according to the line number occupied by the display range of each information element; and respectively storing the display range of each information element and the basic drawing unit corresponding to each information element in the element block corresponding to each information element.
In the embodiment of the invention, each information element in the rich text information is converted to obtain the picture of each information element, and each information element is directly drawn in the basic drawing unit corresponding to each information element by referring to the picture of each information element, so that the format of any information element does not need to be converted, and the display efficiency of displaying the rich text information is improved.
Example 4
Referring to fig. 4, a schematic diagram of a terminal with a touch-sensitive surface according to an embodiment of the present invention is shown, where the terminal may be used to implement the method for displaying rich text information provided in the above-mentioned embodiment. Specifically, the method comprises the following steps:
the terminal 900 may include RF (Radio Frequency) circuitry 110, memory 120 including one or more computer-readable storage media, an input unit 130, a display unit 140, a sensor 150, audio circuitry 160, a WiFi (wireless fidelity) module 170, a processor 180 including one or more processing cores, and a power supply 190. Those skilled in the art will appreciate that the terminal configuration shown in fig. 4 is not intended to be limiting and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components. Wherein:
the RF circuit 110 may be used for receiving and transmitting signals during information transmission and reception or during a call, and in particular, receives downlink information from a base station and then sends the received downlink information to the one or more processors 180 for processing; in addition, data relating to uplink is transmitted to the base station. In general, the RF circuitry 110 includes, but is not limited to, an antenna, at least one Amplifier, a tuner, one or more oscillators, a Subscriber Identity Module (SIM) card, a transceiver, a coupler, an LNA (Low Noise Amplifier), a duplexer, and the like. In addition, the RF circuitry 110 may also communicate with networks and other devices via wireless communications. The wireless communication may use any communication standard or protocol, including but not limited to GSM (Global System for Mobile communications), GPRS (General Packet Radio Service), CDMA (Code Division Multiple Access), WCDMA (Wideband Code Division Multiple Access), LTE (Long Term Evolution), email, SMS (Short Messaging Service), and the like.
The memory 120 may be used to store software programs and modules, and the processor 180 executes various functional applications and data processing by operating the software programs and modules stored in the memory 120. The memory 120 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data (such as audio data, a phonebook, etc.) created according to the use of the terminal 900, and the like. Further, the memory 120 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device. Accordingly, the memory 120 may further include a memory controller to provide the processor 180 and the input unit 130 with access to the memory 120.
The input unit 130 may be used to receive input numeric or character information and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control. In particular, the input unit 130 may include a touch-sensitive surface 131 as well as other input devices 132. The touch-sensitive surface 131, also referred to as a touch display screen or a touch pad, may collect touch operations by a user on or near the touch-sensitive surface 131 (e.g., operations by a user on or near the touch-sensitive surface 131 using a finger, a stylus, or any other suitable object or attachment), and drive the corresponding connection device according to a predetermined program. Alternatively, the touch sensitive surface 131 may comprise two parts, a touch detection means and a touch controller. The touch detection device detects the touch direction of a user, detects a signal brought by touch operation and transmits the signal to the touch controller; the touch controller receives touch information from the touch sensing device, converts the touch information into touch point coordinates, sends the touch point coordinates to the processor 180, and can receive and execute commands sent by the processor 180. Additionally, the touch-sensitive surface 131 may be implemented using various types of resistive, capacitive, infrared, and surface acoustic waves. In addition to the touch-sensitive surface 131, the input unit 130 may also include other input devices 132. In particular, other input devices 132 may include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, a joystick, and the like.
The display unit 140 may be used to display information input by or provided to a user and various graphical user interfaces of the terminal 900, which may be made up of graphics, text, icons, video, and any combination thereof. The Display unit 140 may include a Display panel 141, and optionally, the Display panel 141 may be configured in the form of an LCD (Liquid Crystal Display), an OLED (Organic Light-Emitting Diode), or the like. Further, the touch-sensitive surface 131 may cover the display panel 141, and when a touch operation is detected on or near the touch-sensitive surface 131, the touch operation is transmitted to the processor 180 to determine the type of the touch event, and then the processor 180 provides a corresponding visual output on the display panel 141 according to the type of the touch event. Although in FIG. 4, touch-sensitive surface 131 and display panel 141 are shown as two separate components to implement input and output functions, in some embodiments, touch-sensitive surface 131 may be integrated with display panel 141 to implement input and output functions.
The terminal 900 can also include at least one sensor 150, such as a light sensor, motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor that may adjust the brightness of the display panel 141 according to the brightness of ambient light, and a proximity sensor that may turn off the display panel 141 and/or the backlight when the terminal 900 is moved to the ear. As one of the motion sensors, the gravity acceleration sensor can detect the magnitude of acceleration in each direction (generally, three axes), can detect the magnitude and direction of gravity when the mobile phone is stationary, and can be used for applications of recognizing the posture of the mobile phone (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer and tapping), and the like; as for other sensors such as a gyroscope, a barometer, a hygrometer, a thermometer, and an infrared sensor, which can be configured in the terminal 900, detailed descriptions thereof are omitted.
Audio circuitry 160, speaker 161, and microphone 162 may provide an audio interface between a user and terminal 900. The audio circuit 160 may transmit the electrical signal converted from the received audio data to the speaker 161, and convert the electrical signal into a sound signal for output by the speaker 161; on the other hand, the microphone 162 converts the collected sound signal into an electric signal, converts the electric signal into audio data after being received by the audio circuit 160, and then outputs the audio data to the processor 180 for processing, and then to the RF circuit 110 to be transmitted to, for example, another terminal, or outputs the audio data to the memory 120 for further processing. The audio circuitry 160 may also include an earbud jack to provide communication of peripheral headphones with the terminal 900.
WiFi belongs to a short-distance wireless transmission technology, and the terminal 900 can help a user send and receive e-mails, browse web pages, access streaming media, and the like through the WiFi module 170, and it provides wireless broadband internet access for the user. Although fig. 4 shows the WiFi module 170, it is understood that it does not belong to the essential constitution of the terminal 900 and can be omitted entirely as needed within the scope not changing the essence of the invention.
The processor 180 is a control center of the terminal 900, connects various parts of the entire mobile phone using various interfaces and lines, and performs various functions of the terminal 900 and processes data by operating or executing software programs and/or modules stored in the memory 120 and calling data stored in the memory 120, thereby performing overall monitoring of the mobile phone. Optionally, processor 180 may include one or more processing cores; preferably, the processor 180 may integrate an application processor, which mainly handles operating systems, user interfaces, application programs, etc., and a modem processor, which mainly handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into the processor 180.
Terminal 900 also includes a power supply 190 (e.g., a battery) for powering the various components, which may preferably be logically coupled to processor 180 via a power management system that may be used to manage charging, discharging, and power consumption. The power supply 190 may also include any component including one or more of a dc or ac power source, a recharging system, a power failure detection circuit, a power converter or inverter, a power status indicator, and the like.
Although not shown, the terminal 900 may further include a camera, a bluetooth module, etc., which will not be described herein. Specifically, in this embodiment, the display unit of the terminal 900 is a touch screen display, the terminal 900 further includes a memory, and one or more programs, where the one or more programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs include instructions for:
acquiring each information element included in the rich text information;
arranging a basic drawing unit corresponding to each information element in a display interface;
converting each information element to obtain a picture of each information element;
and respectively drawing each information element on the corresponding basic drawing unit of each information element by referring to the picture of each information element so as to display the rich text information.
Preferably, the arranging the basic drawing unit corresponding to each information element in the display interface includes:
selecting an element block of an information element from an element block list for storing the element block of each information element;
acquiring a basic drawing unit corresponding to the selected information element and a display range of the selected information element in a display interface from the element block;
and according to the display range, placing the basic drawing unit corresponding to the selected information element in the display interface.
Preferably, converting each information element to obtain a picture of each information element includes:
if the selected information element is a character element, acquiring character information and display style information of the selected information element from the element block, rendering the character information in the text area according to the display style information, carrying out screenshot on the character information in the text area, and taking the intercepted picture as a picture corresponding to the selected information element;
and if the selected information element is a picture type element, acquiring a picture included in the selected information element from the element block, and determining the picture included in the selected information element as a picture corresponding to the selected information element.
Further, after the basic drawing unit corresponding to each information element is arranged in the display interface, the method further comprises the following steps:
and if the selected information element has the jump function, acquiring the jump address of the selected information element from the element block, and storing the corresponding relation between the display range and the jump address in a jump list.
Further, after displaying the rich text information, the method further comprises:
when it is detected that the user clicks the information element in the display interface, whether the information element clicked by the user has a skip function is determined according to the skip list, and if the information element clicked by the user has the skip function, the page corresponding to the information element clicked by the user is skipped to.
Preferably, determining whether the information element clicked by the user has a jump function according to the jump list, and if so, jumping to a page corresponding to the information element clicked by the user, including:
acquiring a click position of a user, and searching a skip list according to the click position;
if the display range containing the click position is found out, determining that the information element clicked by the user has a skip function;
and jumping to a page corresponding to the information element clicked by the user according to the jump address corresponding to the searched display range.
Further, still include:
when an information element is acquired, creating an element block for the information element;
if the information element is a character element, acquiring display style information of the information element according to the element type of the information element, and storing the information element and the display style information in the element block;
if the information element is a picture type element, obtaining the pictures included by the information element, and storing the pictures included by the information element in the element block.
Further, after creating the element block for the information element, the method further includes:
if the information element has the jump function, acquiring the jump address of the information element, setting the jump attribute of the element block, and storing the jump address in the element block.
Further, after obtaining each information element included in the rich text information, the method further includes:
respectively determining the display range of each information element in the display interface according to the width of the display interface;
respectively acquiring a basic drawing unit corresponding to each information element according to the line number occupied by the display range of each information element;
and respectively storing the display range of each information element and the basic drawing unit corresponding to each information element in the element block corresponding to each information element.
In the embodiment of the invention, each information element in the rich text information is converted to obtain the picture of each information element, and each information element is directly drawn in the basic drawing unit corresponding to each information element by referring to the picture of each information element, so that the format of any information element does not need to be converted, and the display efficiency of displaying the rich text information is improved.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program instructing relevant hardware, where the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like that fall within the spirit and principle of the present invention are intended to be included therein.

Claims (17)

1. A method for displaying rich text information, which is applied to a terminal, the method comprises the following steps:
acquiring each information element included in the rich text information;
arranging the basic drawing unit corresponding to each information element in a display interface;
for the character elements in each information element, acquiring character information and display style information of the character elements from an element block of the character elements, rendering the character information in a text region according to the display style information, carrying out screenshot on the character information in the text region, and taking the intercepted picture as a picture corresponding to the character elements;
for the picture element in each information element, obtaining a picture included in the picture element from an element block of the picture element, and determining the picture included in the picture element as a picture corresponding to the picture element;
and respectively drawing each information element on the basic drawing unit corresponding to each information element by referring to the picture of each information element so as to display the rich text information.
2. The method of claim 1, wherein said arranging the basic drawing unit corresponding to each information element in the display interface comprises:
selecting an element block of an information element from an element block list, the element block list being used for storing the element block of each information element;
acquiring a basic drawing unit corresponding to the selected information element and a display range of the selected information element in a display interface from the element block;
and placing the basic drawing unit corresponding to the selected information element in the display interface according to the display range.
3. The method of claim 2, wherein after the arranging the basic drawing unit corresponding to each information element in the display interface, further comprises:
and if the selected information element has the jump function, acquiring the jump address of the selected information element from the element block, and storing the corresponding relation between the display range and the jump address in a jump list.
4. The method of claim 3, wherein after said displaying the rich textual information, further comprising:
and when the fact that the user clicks the information element in the display interface is detected, determining whether the information element clicked by the user has a skipping function or not according to the skipping list, and skipping to a page corresponding to the information element clicked by the user if the information element clicked by the user has the skipping function.
5. The method of claim 4, wherein the determining whether the information element clicked by the user has a jump function according to the jump list, and if so, jumping to a page corresponding to the information element clicked by the user comprises:
acquiring the click position of the user, and searching the skip list according to the click position;
if the display range containing the click position is found out, determining that the information element clicked by the user has a skip function;
and jumping to a page corresponding to the information element clicked by the user according to the jump address corresponding to the searched display range.
6. The method of claim 1, wherein the method further comprises:
when an information element is acquired, creating an element block for the information element;
if the information element is a character element, acquiring display style information of the information element according to the element type of the information element, and storing the information element and the display style information in the element block;
and if the information element is a picture type element, obtaining the picture included by the information element, and storing the picture included by the information element in the element block.
7. The method of claim 6, wherein after creating the element block for the information element, further comprising:
and if the information element has the jump function, acquiring the jump address of the information element, setting the jump attribute of the element block, and storing the jump address in the element block.
8. The method of claim 1, wherein after obtaining each information element included in the rich textual information, further comprising:
respectively determining the display range of each information element in the display interface according to the width of the display interface;
respectively acquiring a basic drawing unit corresponding to each information element according to the line number occupied by the display range of each information element;
and respectively storing the display range of each information element and the basic drawing unit corresponding to each information element in the element block corresponding to each information element.
9. An apparatus for displaying rich textual information, the apparatus comprising:
the acquiring module is used for acquiring each information element included in the rich text information;
the discharge module is used for discharging the basic drawing unit corresponding to each information element in a display interface;
the conversion module is used for acquiring the text information and the display style information of the text elements from the element blocks of the text elements for the text elements in each information element, rendering the text information in a text area according to the display style information, carrying out screenshot on the text information in the text area, and taking the intercepted picture as the picture corresponding to the text elements; for the picture element in each information element, obtaining a picture included in the picture element from an element block of the picture element, and determining the picture included in the picture element as a picture corresponding to the picture element;
and the drawing module is used for drawing each information element on the corresponding basic drawing unit of each information element respectively by referring to the picture of each information element so as to display the rich text information.
10. The apparatus of claim 9, wherein the exhaust module comprises:
a selecting unit, configured to select an element block of one information element from an element block list, where the element block list is used to store an element block of each information element;
a first obtaining unit, configured to obtain, from the element block, a basic drawing unit corresponding to the selected information element and a display range of the selected information element in a display interface;
and the placing unit is used for placing the basic drawing unit corresponding to the selected information element in the display interface according to the display range.
11. The apparatus of claim 10, wherein the apparatus further comprises:
and the first storage module is used for acquiring the jump address of the selected information element from the element block and storing the corresponding relation between the display range and the jump address in a jump list if the selected information element has the jump function.
12. The apparatus of claim 11, wherein the apparatus further comprises:
and the skipping module is used for determining whether the information element clicked by the user has a skipping function or not according to the skipping list when the fact that the information element clicked by the user in the display interface is clicked by the user is detected, and skipping to a page corresponding to the information element clicked by the user if the information element clicked by the user has the skipping function.
13. The apparatus of claim 12, wherein the hopping module comprises:
the second module unit is used for acquiring the click position of the user and searching the skip list according to the click position;
a second determining unit, configured to determine that the information element clicked by the user has a skip function if the display range including the click position is found;
and the jumping unit is used for jumping to a page corresponding to the information element clicked by the user according to the jumping address corresponding to the searched display range.
14. The apparatus of claim 9, wherein the apparatus further comprises:
the device comprises a creating module, a judging module and a judging module, wherein the creating module is used for creating an element block for an information element when the information element is acquired;
the second storage module is used for acquiring the display style information of the information element according to the element type of the information element and storing the information element and the display style information in the element block if the information element is a character element;
and the third storage module is used for acquiring the pictures included by the information elements and storing the pictures included by the information elements in the element blocks if the information elements are picture type elements.
15. The apparatus of claim 14, wherein the apparatus further comprises:
and the fourth storage module is used for acquiring the jump address of the information element if the information element has the jump function, setting the jump attribute of the element block and storing the jump address in the element block.
16. The apparatus of claim 9, wherein the apparatus further comprises:
the fifth storage module is used for respectively determining the display range of each information element in the display interface according to the width of the display interface; respectively acquiring a basic drawing unit corresponding to each information element according to the line number occupied by the display range of each information element; and respectively storing the display range of each information element and the basic drawing unit corresponding to each information element in the element block corresponding to each information element.
17. A computer-readable storage medium, characterized in that a program is stored in the computer-readable storage medium, which is executed by a processor to implement the method of displaying rich text information according to any one of claims 1 to 8.
CN201410191115.3A 2014-05-07 2014-05-07 Method and device for displaying rich text information Active CN105095161B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410191115.3A CN105095161B (en) 2014-05-07 2014-05-07 Method and device for displaying rich text information

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410191115.3A CN105095161B (en) 2014-05-07 2014-05-07 Method and device for displaying rich text information

Publications (2)

Publication Number Publication Date
CN105095161A CN105095161A (en) 2015-11-25
CN105095161B true CN105095161B (en) 2021-03-26

Family

ID=54575638

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410191115.3A Active CN105095161B (en) 2014-05-07 2014-05-07 Method and device for displaying rich text information

Country Status (1)

Country Link
CN (1) CN105095161B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109933751B (en) * 2019-03-20 2021-07-20 腾讯科技(深圳)有限公司 Image-text drawing method and device, computer-readable storage medium and computer equipment
CN109948581B (en) * 2019-03-28 2023-05-05 腾讯科技(深圳)有限公司 Image-text rendering method, device, equipment and readable storage medium
CN111241793B (en) * 2020-02-17 2023-12-08 湖南快乐阳光互动娱乐传媒有限公司 Method, system and medium for resolving rich text editor content to render to native client
CN112100978B (en) * 2020-09-16 2022-07-08 掌阅科技股份有限公司 Typesetting processing method based on electronic book, electronic equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101419597A (en) * 2007-10-26 2009-04-29 英业达股份有限公司 System for establishing formatted web page and method thereof
CN101930459A (en) * 2010-08-19 2010-12-29 百度在线网络技术(北京)有限公司 Method for assisting user equipment in realizing network block browsing and network equipment
CN102622395A (en) * 2011-12-20 2012-08-01 深信服网络科技(深圳)有限公司 Method, server and client for assisting in accessing to webpage by application virtualization
CN103136171A (en) * 2011-12-02 2013-06-05 明博教育科技有限公司 E-book making method based on shock wave flash (SWF)
CN103532828A (en) * 2013-09-03 2014-01-22 国家电网公司 Rich text format realization system and method based on expanded XMPP (xml based messaging and presence protocol)

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102693243A (en) * 2011-03-24 2012-09-26 洪发生 Information display structure of website and method for spreading information on website

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101419597A (en) * 2007-10-26 2009-04-29 英业达股份有限公司 System for establishing formatted web page and method thereof
CN101930459A (en) * 2010-08-19 2010-12-29 百度在线网络技术(北京)有限公司 Method for assisting user equipment in realizing network block browsing and network equipment
CN103136171A (en) * 2011-12-02 2013-06-05 明博教育科技有限公司 E-book making method based on shock wave flash (SWF)
CN102622395A (en) * 2011-12-20 2012-08-01 深信服网络科技(深圳)有限公司 Method, server and client for assisting in accessing to webpage by application virtualization
CN103532828A (en) * 2013-09-03 2014-01-22 国家电网公司 Rich text format realization system and method based on expanded XMPP (xml based messaging and presence protocol)

Also Published As

Publication number Publication date
CN105095161A (en) 2015-11-25

Similar Documents

Publication Publication Date Title
CN106775637B (en) Page display method and device for application program
CN105786878B (en) Display method and device of browsing object
US10643021B2 (en) Method and device for processing web page content
CN104852885B (en) Method, device and system for verifying verification code
CN108156508B (en) Barrage information processing method and device, mobile terminal, server and system
CN108549519B (en) Split screen processing method and device, storage medium and electronic equipment
CN105740263B (en) Page display method and device
CN107436948B (en) File searching method and device and terminal
JP6910300B2 (en) A method for displaying chat history records and a device for displaying chat history records
CN105302452B (en) Operation method and device based on gesture interaction
CN106375179B (en) Method and device for displaying instant communication message
US10956653B2 (en) Method and apparatus for displaying page and a computer storage medium
CN106293738B (en) Expression image updating method and device
US20150128033A1 (en) Method and apparatus for webpage browsing
CN108595107B (en) Interface content processing method and mobile terminal
WO2015027909A1 (en) Method and apparatus for obtaining hot-topic information
CN105095161B (en) Method and device for displaying rich text information
CN110688497A (en) Resource information searching method and device, terminal equipment and storage medium
JP6915074B2 (en) Message notification method and terminal
CN112749074B (en) Test case recommending method and device
CN105653112B (en) Method and device for displaying floating layer
CN106844572B (en) Search result processing method and device for search result processing
CN106202422B (en) The treating method and apparatus of Web page icon
CN105631059B (en) Data processing method, data processing device and data processing system
CN108932243B (en) Method and device for refreshing webpage

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant