CN104572822B - Text shows method and device - Google Patents
Text shows method and device Download PDFInfo
- Publication number
- CN104572822B CN104572822B CN201410734243.8A CN201410734243A CN104572822B CN 104572822 B CN104572822 B CN 104572822B CN 201410734243 A CN201410734243 A CN 201410734243A CN 104572822 B CN104572822 B CN 104572822B
- Authority
- CN
- China
- Prior art keywords
- text content
- client
- attribute
- server
- style information
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/30—Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
- G06F16/34—Browsing; Visualisation therefor
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Databases & Information Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Information Transfer Between Computers (AREA)
Abstract
An embodiment of the present invention provides a kind of texts to show method and device.On the one hand, the embodiment of the present invention obtains content of text by server and shows style information;To which, the server sends the content of text to client and described shows style information;In turn so that the client can render the content of text according to the display properties for showing style information and the client.Therefore, technical solution provided in an embodiment of the present invention can be rendered by client in the text showed to needs according to the display properties for showing style information and client itself, can improve the flexibility that text shows pattern.
Description
[ technical field ] A method for producing a semiconductor device
The invention relates to the technical field of internet, in particular to a text display method and a text display device.
[ background of the invention ]
Currently, a client installed on a terminal, such as a browser client, a news client, etc., needs to present text content in a limited presentation area, for example, a news list shown in fig. 1. Due to the limited display area, only part of the text content can be displayed generally, and the rest of the text content needs to be hidden or cut off, as shown in fig. 1, part of the text of the second to fifth news headlines is hidden and cannot be completely displayed.
In the prior art, a method for presenting partial text content in a limited presentation area is as follows: for text contents to be displayed, performing typesetting calculation on characters by a server, for example, calculating the number of characters which can be displayed within a preset width according to the display widths of different characters; then, the server sends the style of the text to be presented, such as the number of characters that can be presented, the number of rows of characters that can be presented, and the like, to the client. Therefore, for different clients, the presentation styles of the texts obtained from the server are all the same, and the server cannot provide the presentation styles for the client according to the client, so that the flexibility of the presentation mode is low.
[ summary of the invention ]
In view of this, embodiments of the present invention provide a text presentation method and apparatus, where a client renders a text to be presented according to presentation style information and a display attribute of the client, so as to improve flexibility of a text presentation style.
In one aspect of the embodiments of the present invention, a text presentation method is provided, including:
the server obtains text content and presentation style information;
and the server sends the text content and the presentation style information to a client so that the client can render the text content according to the presentation style information and the display attribute of the client.
The above aspect and any possible implementation manner further provide an implementation manner, where the server sends the text content and the presentation style information to a client, and the sending includes:
the server sends a hypertext markup language (HTML) file and a style file to the client, wherein the HTML file contains the text content, and the style file contains the presentation style information; or,
the server sends an HTML file to the client, wherein the HTML file contains the text content; the server receives a style request sent by the client and sends a style file to the client according to the style request, wherein the style file comprises the presentation style information; or,
and the server sends an HTML file to the client, wherein the HTML file contains the text content and the presentation style information.
The above-described aspect and any possible implementation further provide an implementation, where the presentation style information includes at least one of the following style attributes: the attribute is used for indicating whether the text content is subjected to line feed, the attribute is used for indicating whether the text content overflows the display box and is hidden, the attribute is used for indicating whether the text content overflows the display box and is displayed with an omission mark, the attribute is used for indicating the line height of the text content, the attribute is used for indicating the type of the display box where the text content is located, the attribute is used for indicating the arrangement mode of the text content, and the attribute is used for indicating the displayable line number of the text content.
In one aspect of the embodiments of the present invention, a text presentation method is provided, including:
the client receives the text content and the presentation style information sent by the server;
and the client renders the text content according to the presentation style information and the display attribute of the client.
The above-mentioned aspect and any possible implementation manner further provide an implementation manner, where the receiving, by the client, text content and presentation style information sent by the server includes:
the client sends a hypertext transfer protocol (HTTP) request to the server so that the server can obtain the presentation style information and obtain the text content according to the HTTP request;
the client receives a hypertext markup language (HTML) file and a style file which are sent by the server, wherein the HTML file contains the text content, and the style file contains the presentation style information; or, the client receives an HTML file sent by the server, where the HTML file includes the text content and the presentation style information.
The above-mentioned aspect and any possible implementation manner further provide an implementation manner, where the receiving, by the client, text content and presentation style information sent by the server includes:
the client sends an HTTP request to the server so that the server can obtain the text content according to the HTTP request;
the client receives an HTML file sent by the server, wherein the HTML file contains the text content;
the client sends a style request to the server so that the server can obtain presentation style information according to the style request;
and the client receives a style file sent by the server, wherein the style file comprises the presentation style information.
The above-described aspect and any possible implementation further provide an implementation, where the presentation style information includes at least one of the following style attributes: the attribute is used for indicating whether the text content is subjected to line feed, the attribute is used for indicating whether the text content overflows the display box and is hidden, the attribute is used for indicating whether the text content overflows the display box and is displayed with an omission mark, the attribute is used for indicating the line height of the text content, the attribute is used for indicating the type of the display box where the text content is located, the attribute is used for indicating the arrangement mode of the text content, and the attribute is used for indicating the displayable line number of the text content.
The above-mentioned aspect and any possible implementation manner further provide an implementation manner, where a display attribute of the client is a size of a display frame in the client, and the rendering of the text content by the client according to the presentation style information and the display attribute of the client includes:
the client typesets the text content according to the presentation style information and the size of a display frame in the client;
and the client displays the text content obtained after typesetting.
In one aspect of the embodiments of the present invention, a text display apparatus is provided, where the apparatus is located in a server, and includes:
a processing unit for obtaining text content and presentation style information;
and the output unit is used for sending the text content and the presentation style information to a client so that the client can render the text content according to the presentation style information and the display attribute of the client.
The above-described aspect and any possible implementation further provide an implementation, where the output unit is specifically configured to:
sending a hypertext markup language (HTML) file and a style file to the client, wherein the HTML file contains the text content, and the style file contains the presentation style information; or,
sending an HTML file to the client, wherein the HTML file contains the text content; the server receives a style request sent by the client and sends a style file to the client according to the style request, wherein the style file comprises the presentation style information; or,
and sending an HTML file to the client, wherein the HTML file comprises the text content and the presentation style information.
The above-described aspect and any possible implementation further provide an implementation, where the presentation style information includes at least one of the following style attributes: the attribute is used for indicating whether the text content is subjected to line feed, the attribute is used for indicating whether the text content overflows the display box and is hidden, the attribute is used for indicating whether the text content overflows the display box and is displayed with an omission mark, the attribute is used for indicating the line height of the text content, the attribute is used for indicating the type of the display box where the text content is located, the attribute is used for indicating the arrangement mode of the text content, and the attribute is used for indicating the displayable line number of the text content.
In one aspect of the embodiments of the present invention, a text presentation apparatus is provided, where the apparatus is located at a client, and includes:
the input and output unit is used for receiving the text content and the presentation style information sent by the server;
and the content rendering unit is used for rendering the text content according to the presentation style information and the display attribute of the client.
The above-described aspect and any possible implementation further provide an implementation, where the input/output unit is specifically configured to:
sending a hypertext transfer protocol (HTTP) request to the server so that the server obtains the presentation style information and obtains the text content according to the HTTP request;
receiving a hypertext markup language (HTML) file and a style file sent by the server, wherein the HTML file contains the text content, and the style file contains the presentation style information; or receiving an HTML file sent by the server, wherein the HTML file contains the text content and the presentation style information.
The above-described aspect and any possible implementation further provide an implementation, where the input/output unit is specifically configured to:
sending an HTTP request to the server so that the server can obtain the text content according to the HTTP request;
receiving an HTML file sent by the server, wherein the HTML file contains the text content;
sending a style request to the server so that the server can obtain presentation style information according to the style request;
and receiving a style file sent by the server, wherein the style file comprises the presentation style information.
The above-described aspect and any possible implementation further provide an implementation, where the presentation style information includes at least one of the following style attributes: the attribute is used for indicating whether the text content is subjected to line feed, the attribute is used for indicating whether the text content overflows the display box and is hidden, the attribute is used for indicating whether the text content overflows the display box and is displayed with an omission mark, the attribute is used for indicating the line height of the text content, the attribute is used for indicating the type of the display box where the text content is located, the attribute is used for indicating the arrangement mode of the text content, and the attribute is used for indicating the displayable line number of the text content.
According to the technical scheme, the embodiment of the invention has the following beneficial effects:
the embodiment of the invention obtains the text content and the presentation style information through the server; thereby, the server transmits the text content and the presentation style information to a client; and then, the client can render the text content according to the presentation style information and the display attribute of the client. Compared with the prior art, the technical scheme provided by the embodiment of the invention can render the text to be displayed by the client according to the display style information and the display attribute of the client, so that the problem that the display style aiming at the client cannot be provided according to the client can be solved, the text content can be intercepted and displayed in a self-adaptive manner, and the flexibility of the text display style can be improved.
[ description of the drawings ]
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the embodiments will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without inventive labor.
FIG. 1 is an exemplary diagram of a prior art presentation of only a portion of textual content within a presentation area;
FIG. 2 is a diagram of an exemplary system for use with the solution provided by the embodiments of the present invention;
FIG. 3 is a flowchart illustrating a first embodiment of a text presentation method according to an embodiment of the present invention;
FIG. 4 is a flowchart illustrating a second embodiment of a text presentation method according to an embodiment of the present invention;
FIG. 5 is a diagram illustrating a first example in which a client displays only a portion of text according to an embodiment of the present invention;
FIG. 6 is a diagram illustrating a second example in which a client displays only a portion of text according to an embodiment of the present invention;
FIG. 7 is a functional block diagram of a first embodiment of a text presentation apparatus according to the present invention;
fig. 8 is a functional block diagram of a second embodiment of a text presentation apparatus according to the present invention.
[ detailed description ] embodiments
For better understanding of the technical solutions of the present invention, the following detailed descriptions of the embodiments of the present invention are provided with reference to the accompanying drawings.
It should be understood that the described embodiments are only some embodiments of the invention, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The terminology used in the embodiments of the invention is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used in the examples of the present invention and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
It should be understood that the term "and/or" as used herein is merely one type of association that describes an associated object, meaning that three relationships may exist, e.g., a and/or B may mean: a exists alone, A and B exist simultaneously, and B exists alone. In addition, the character "/" herein generally indicates that the former and latter related objects are in an "or" relationship.
The word "if" as used herein may be interpreted as "at … …" or "when … …" or "in response to a determination" or "in response to a detection", depending on the context. Similarly, the phrases "if determined" or "if detected (a stated condition or event)" may be interpreted as "when determined" or "in response to a determination" or "when detected (a stated condition or event)" or "in response to a detection (a stated condition or event)", depending on the context.
The system used in the technical solution provided by the embodiment of the present invention is shown in fig. 2, and mainly comprises a client and a server.
An embodiment of the present invention provides a text presentation method, please refer to fig. 3, which is a flowchart illustrating a first embodiment of the text presentation method according to an embodiment of the present invention, and the method is a server-side implementation method. As shown, the method comprises the following steps:
s301, the server obtains text content and presentation style information.
S302, the server sends the text content and the presentation style information to a client so that the client can render the text content according to the presentation style information and the display attribute of the client.
Preferably, the method for the server to obtain the text content and the presentation style information and send the text content and the presentation style information to the client may include, but is not limited to, the following three methods:
the first method comprises the following steps: first, a server receives a Hypertext Transfer Protocol (HTTP) request sent from a client, such as a network in a browser, where the HTTP request includes an identifier of a resource.
Then, the server obtains corresponding text content according to the identifier of the resource in the HTTP request, and obtains presentation style information from a configuration file of a preset text presentation style, wherein the presentation style information comprises information used for indicating a presentation style of the text content, and the server can control which style is used by the client to typeset the text content through the presentation style information.
And finally, the server sends a Hypertext markup language (HTML) file and a style file to the client, wherein the HTML file carries the obtained text content, and the style file carries the obtained presentation style information.
It can be understood that in the method, the server provides the HTML file and the style file to the client.
And the second method comprises the following steps: first, a server receives an HTTP request sent by a client, such as a network in a browser, where the HTTP request includes an identifier of a resource.
And then, the server obtains corresponding text content according to the identifier of the resource in the HTTP request, then sends an HTML file to the client, and carries the obtained text content through the HTML file.
And finally, the server receives the style request sent by the client, and then learns that the client needs to obtain the presentation style information according to the style request, so that the server obtains the presentation style information from a configuration file of a preset text presentation style, then sends a style file to the client, and carries the obtained presentation style information through the style file.
It can be understood that in the method, the server provides the HTML file and the style file to the client separately, and the style file may be provided to the client after receiving the style request from the client.
And the third is that: first, a server receives an HTTP request sent by a client, such as a network in a browser, where the HTTP request includes an identifier of a resource.
Then, the server obtains corresponding text content according to the identifier of the resource in the HTTP request, and obtains presentation style information from a configuration file of a preset text presentation style, wherein the presentation style information comprises information used for indicating a presentation style of the text content, and the server can control which style is used by the client to typeset the text content through the presentation style information.
And finally, the server sends an HTML file to the client, wherein the HTML file carries the obtained text content and the presentation style information.
It can be understood that, in the method, a separate style file is not used to carry the presentation style information, but the presentation style information and the text content are carried by an HTML file.
Preferably, in an embodiment of the present invention, the presentation style information includes at least one of the following style attributes: the attribute is used for indicating whether the text content is subjected to line feed, the attribute is used for indicating whether the text content overflows the display box and is hidden, the attribute is used for indicating whether the text content overflows the display box and is displayed with an omission mark, the attribute is used for indicating the line height of the text content, the attribute is used for indicating the type of the display box where the text content is located, the attribute is used for indicating the arrangement mode of the text content, and the attribute is used for indicating the displayable line number of the text content.
It should be noted that the execution subjects of S301 to S302 may be text presentation devices, and the devices may be located in a server.
Please refer to fig. 4, which is a flowchart illustrating a text presentation method according to a second embodiment of the present invention, the method being a client-side implementation method. As shown, the method comprises the following steps:
s401, the client receives the text content and the presentation style information sent by the server.
S402, the client renders the text content according to the presentation style information and the display attribute of the client.
Preferably, the method for the client to receive the text content and the presentation style information sent by the server may include, but is not limited to, the following three methods:
the first method comprises the following steps: a client, such as a network in a browser, may send an HTTP request to the server, where the HTTP request includes an identifier of a resource, so that the server obtains presentation style information from a configuration file of a preset text presentation style, where the presentation style information includes information indicating a presentation style of the text content, and the client may determine, according to the presentation style information, which style is used to typeset the text content. And the server obtains the corresponding text content according to the identifier of the resource in the HTTP request.
And the client receives an HTML file and a style file sent by the server, wherein the HTML file contains the text content, and the style file contains the presentation style information.
In the method, a client receives an HTML file and a style file from a server at the same time.
And the second method comprises the following steps: the client, such as a network in a browser, sends an HTTP request to a server, wherein the HTTP request contains a resource identifier, so that the server can obtain corresponding text content according to the resource identifier in the HTTP request, and then sends an HTML file to the client, wherein the HTML file carries the obtained text content, and thus, the client can receive the HTML file sent by the server and obtain the text content from the HTML file. Then, the client sends a style request to the server so that the server can obtain the presentation style information from a preset configuration file of the text presentation style according to the style request, and then sends a style file to the client, wherein the style file carries the obtained presentation style information. Thus, the client can receive the style file sent by the server and obtain the presentation style information from the style file.
It should be noted that, in the method, the client obtains the HTML file and the style file from the server separately, and the style file may be requested from the server after receiving the text content.
And the third is that: a client, such as a network in a browser, may send an HTTP request to the server, where the HTTP request includes an identifier of a resource, so that the server obtains presentation style information from a configuration file of a preset text presentation style, where the presentation style information includes information indicating a presentation style of the text content, and the client may determine, according to the presentation style information, which style is used to typeset the text content. And the server obtains the corresponding text content according to the identifier of the resource in the HTTP request.
And the client receives an HTML file sent by the server, wherein the HTML file contains the text content and the presentation style information.
Preferably, the presentation style information includes at least one of the following style attributes: the attribute is used for indicating whether the text content is subjected to line feed, the attribute is used for indicating whether the text content overflows the display box and is hidden, the attribute is used for indicating whether the text content overflows the display box and is displayed with an omission mark, the attribute is used for indicating the line height of the text content, the attribute is used for indicating the type of the display box where the text content is located, the attribute is used for indicating the arrangement mode of the text content, and the attribute is used for indicating the displayable line number of the text content.
Preferably, if the display attribute of the client is the size of the display frame in the client, the method for rendering the text content by the client according to the presentation style information may include, but is not limited to: the client, such as a rendering engine in the browser client, may learn how to type the text content after obtaining the presentation style information from the server, so that the type setting operation on the text content may be performed according to the presentation style information and the size of the display frame in the client, for example, to hide the text content outside the display frame, add an omission flag after the last character displayed, and the like, and then the client may display the text content obtained after the type setting, thereby implementing the rendering operation on the text content.
It should be noted that the execution subjects of S401 to S402 may be text presentation devices, and the text presentation devices may be applications located in the local terminal, or may also be functional units such as a plug-in or Software Development Kit (SDK) located in the applications located in the local terminal, which is not particularly limited in this embodiment of the present invention.
It should be understood that the application may be an application program (native app) installed on the terminal, or may also be a web page program (webApp) of a browser on the terminal, which is not limited in this embodiment of the present invention.
It should be noted that the terminal according to the embodiment of the present invention may include, but is not limited to, a Personal Computer (PC), a Personal Digital Assistant (PDA), a wireless handheld device, a Tablet Computer (Tablet Computer), a mobile phone, an MP3 player, an MP4 player, and the like.
For the presentation Style information in the first and second embodiments, the following description will be given by taking an example in which the presentation Style information includes a Cascading Style Sheets (CSS) attribute and the text content is a single line of text:
the attribute for indicating whether text content is to be wrapped may be a white-space attribute. If it is necessary to control the text content not to wrap, the white-space attribute may be configured to: white-space: nowrap.
The attribute for indicating whether text content is hidden when overflowing the display box may be an overflow attribute. If the text content needs to be controlled to be hidden when the display box overflows, the overflow attribute can be configured as follows: overhead flow: hidden.
The attribute for indicating whether the omission flag is displayed when the text content overflows the display box may be a text-overflow attribute. If it is desired to control the text content to display an elision mark after the last word displayed when the display box is overflowed, the text-overflow attribute may be configured to: text-overflow: ellipsosis.
The attribute for indicating the line height of the text content may be a line-height attribute. If the line height of the text content needs to be controlled, a numerical value needs to be configured for the line-height attribute, and the numerical value is used for representing the line height of the text content, for example, the line-height attribute can be configured as follows: line-height:25px, 25px indicates a line height of 25 pixels. It should be noted that, if the text is a single line of text, the line height of the single line of text may be the same as the height of the display box in the client.
For the presentation style information in the first and second embodiments, the following description will be given by taking the example that the presentation style information includes CSS attributes and text contents are multi-line text:
the attribute for indicating the line height of the text content may be a line-height attribute. If the line height of each line of text in the text content needs to be controlled, a numerical value needs to be configured for the line-height attribute, and the numerical value is used for representing the line height of each line of text, for example, the line-height attribute can be configured as follows: line-height:25px, 25px indicates a line height of 25 pixels. It should be noted that, if the text is a plurality of lines, the line height of the text may be equal to the ratio of the height of the display frame to the number of lines of the text.
The attribute for indicating whether text content is hidden when overflowing the display box may be an overflow attribute. If the text content needs to be controlled to be hidden when the display box overflows, the overflow attribute can be configured as follows: overhead flow: hidden. It should be noted that, if the text content is a multi-line text, the text content needs to be controlled to automatically feed lines, and when the text content overflows the lower edge of the display frame, at least one last line of text content of the text content needs to be hidden. As shown in fig. 5 and 6, the text content may be controlled to display an ellipsis after the last word displayed when the display box is overflowed.
The attribute indicating the type of the display box in which the text content is located may be a display attribute. If the type of the display box in which the text content is required to be controlled is a box model, the display attribute can be configured as display: -webkit-box. After the box model is configured, the display frame may occupy the display screen of the terminal.
The attribute indicating the arrangement of the text contents may be a webkit-box-origin attribute, and the arrangement of the text contents may include a vertical arrangement and a horizontal arrangement. For example, if it is desired to control the vertical arrangement of text content within a display box, the-webkit-box-origin attribute may be configured as-webkit-box-origin.
The attribute for indicating the displayable line number of the text content may be a-webkit-line-clip attribute. If the line number of the text content which can be displayed needs to be controlled, a numerical value needs to be configured for the webkit-line-clamp attribute, the numerical value is used for indicating a line number threshold value of the text content which can be displayed in the display frame, and the text content which exceeds the line number in the text content needs to be omitted. For example, the-webkit-line-clamp attribute may be configured as-webkit-line-clamp: 4, indicating that the number of lines of text content displayed within the display box is 4, and text content starting from line 5 is omitted from being displayed.
The embodiment of the invention further provides an embodiment of a device for realizing the steps and the method in the embodiment of the method.
Please refer to fig. 7, which is a functional block diagram of a first embodiment of a text presentation apparatus according to an embodiment of the present invention. As shown, the apparatus is located on the server side, and the apparatus includes:
a processing unit 701 configured to obtain text content and presentation style information;
an output unit 702, configured to send the text content and the presentation style information to a client, so that the client renders the text content according to the presentation style information and the display attribute of the client.
Preferably, the output unit 702 is specifically configured to:
sending a hypertext markup language (HTML) file and a style file to the client, wherein the HTML file contains the text content, and the style file contains the presentation style information; or,
sending an HTML file to the client, wherein the HTML file contains the text content; the server receives a style request sent by the client and sends a style file to the client according to the style request, wherein the style file comprises the presentation style information; or,
and sending an HTML file to the client, wherein the HTML file comprises the text content and the presentation style information.
Preferably, the presentation style information includes at least one of the following style attributes: the attribute is used for indicating whether the text content is subjected to line feed, the attribute is used for indicating whether the text content overflows the display box and is hidden, the attribute is used for indicating whether the text content overflows the display box and is displayed with an omission mark, the attribute is used for indicating the line height of the text content, the attribute is used for indicating the type of the display box where the text content is located, the attribute is used for indicating the arrangement mode of the text content, and the attribute is used for indicating the displayable line number of the text content.
Since each unit in the present embodiment can execute the method shown in fig. 2, reference may be made to the related description of fig. 2 for a part of the present embodiment that is not described in detail.
Please refer to fig. 8, which is a functional block diagram of a second embodiment of a text presentation apparatus according to an embodiment of the present invention. As shown, the apparatus is located at a client side, and includes:
an input/output unit 801 for receiving text content and presentation style information sent by a server;
a content rendering unit 802, configured to render the text content according to the presentation style information and the display attribute of the client.
Preferably, the input/output unit 801 is specifically configured to:
sending a hypertext transfer protocol (HTTP) request to the server so that the server obtains the presentation style information and obtains the text content according to the HTTP request;
receiving a hypertext markup language (HTML) file and a style file sent by the server, wherein the HTML file contains the text content, and the style file contains the presentation style information; or receiving an HTML file sent by the server, wherein the HTML file contains the text content and the presentation style information.
Preferably, the input/output unit 801 is specifically configured to:
sending an HTTP request to the server so that the server can obtain the text content according to the HTTP request;
receiving an HTML file sent by the server, wherein the HTML file contains the text content;
sending a style request to the server so that the server can obtain presentation style information according to the style request;
and receiving a style file sent by the server, wherein the style file comprises the presentation style information.
Preferably, the presentation style information includes at least one of the following style attributes: the attribute is used for indicating whether the text content is subjected to line feed, the attribute is used for indicating whether the text content overflows the display box and is hidden, the attribute is used for indicating whether the text content overflows the display box and is displayed with an omission mark, the attribute is used for indicating the line height of the text content, the attribute is used for indicating the type of the display box where the text content is located, the attribute is used for indicating the arrangement mode of the text content, and the attribute is used for indicating the displayable line number of the text content.
Preferably, the display attribute of the client is the size of a display frame in the client, and the content rendering unit 802 is specifically configured to:
typesetting the text content according to the presentation style information and the size of a display frame in the client;
and displaying the text content obtained after the typesetting.
Since each unit in the present embodiment can execute the method shown in fig. 3, reference may be made to the related description of fig. 3 for a part of the present embodiment that is not described in detail.
The technical scheme of the embodiment of the invention has the following beneficial effects:
the embodiment of the invention obtains the text content and the presentation style information through the server; thereby, the server transmits the text content and the presentation style information to a client; and then, the client can render the text content according to the presentation style information and the display attribute of the client.
Compared with the prior art, the technical scheme provided by the embodiment of the invention can render the text to be displayed by the client according to the display style information and the display attribute of the client, so that the problem that the display style aiming at the client cannot be provided according to the client can be solved, the text content can be intercepted and displayed in a self-adaptive manner, and the flexibility of the text display style can be improved.
In addition, for text contents to be displayed, the client carries out typesetting calculation on the characters, so that the processing pressure of the server on the typesetting calculation of the text contents can be reduced, and the load of the server is lightened.
In addition, in the prior art, the presentation style information, such as CSS attributes, is pre-configured locally at the client, so that when the client obtains text content to be displayed from the server, the text content can be typeset and presented according to the locally stored presentation style information. However, in this technical solution, the file in which the presentation style information is located is generally stored as a temporary file in the terminal in which the client is located, so that the file in which the presentation style information is located may be cleared away by the security software installed in the terminal when the temporary file is cleared, resulting in loss of the presentation style information, and thus reconfiguration is required. In addition, when the presentation style information needs to be updated, for example, when the display size of the client changes and the text presentation requirement changes, the presentation style information needs to be manually reconfigured, so that the method has low flexibility, is relatively inconvenient to update, and has low updating efficiency.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the embodiments provided in the present invention, it should be understood that the disclosed system, apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and there may be other divisions in actual implementation, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional unit.
The integrated unit implemented in the form of a software functional unit may be stored in a computer readable storage medium. The software functional unit is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device) or a Processor (Processor) to execute some steps of the methods according to the embodiments of the present invention. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
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 made within the spirit and principle of the present invention should be included in the scope of the present invention.
Claims (12)
1. A method for presenting text, the method comprising:
the server obtains text content and presentation style information;
the server sends the text content and the presentation style information to a client so that the client can render the text content according to the presentation style information and the display attribute of the client, wherein the display attribute of the client comprises the size of a display frame in the client;
wherein the presentation style information includes at least one of the following style attributes: the attribute is used for indicating whether the text content is subjected to line feed, the attribute is used for indicating whether the text content overflows the display box and is hidden, the attribute is used for indicating whether the text content overflows the display box and is displayed with an omission mark, the attribute is used for indicating the line height of the text content, the attribute is used for indicating the type of the display box where the text content is located, the attribute is used for indicating the arrangement mode of the text content, and the attribute is used for indicating the displayable line number of the text content.
2. The method of claim 1, wherein the server sends the text content and the presentation style information to a client, comprising:
the server sends a hypertext markup language (HTML) file and a style file to the client, wherein the HTML file contains the text content, and the style file contains the presentation style information; or,
the server sends an HTML file to the client, wherein the HTML file contains the text content; the server receives a style request sent by the client and sends a style file to the client according to the style request, wherein the style file comprises the presentation style information; or,
and the server sends an HTML file to the client, wherein the HTML file contains the text content and the presentation style information.
3. A method for presenting text, the method comprising:
the client receives the text content and the presentation style information sent by the server;
the client renders the text content according to the presentation style information and the display attribute of the client, wherein the display attribute of the client comprises the size of a display frame in the client;
wherein the presentation style information includes at least one of the following style attributes: the attribute is used for indicating whether the text content is subjected to line feed, the attribute is used for indicating whether the text content overflows the display box and is hidden, the attribute is used for indicating whether the text content overflows the display box and is displayed with an omission mark, the attribute is used for indicating the line height of the text content, the attribute is used for indicating the type of the display box where the text content is located, the attribute is used for indicating the arrangement mode of the text content, and the attribute is used for indicating the displayable line number of the text content.
4. The method of claim 3, wherein the client receives the text content and the presentation style information sent by the server, and comprises:
the client sends a hypertext transfer protocol (HTTP) request to the server so that the server can obtain the presentation style information and obtain the text content according to the HTTP request;
the client receives a hypertext markup language (HTML) file and a style file which are sent by the server, wherein the HTML file contains the text content, and the style file contains the presentation style information; or, the client receives an HTML file sent by the server, where the HTML file includes the text content and the presentation style information.
5. The method of claim 3, wherein the client receives the text content and the presentation style information sent by the server, and comprises:
the client sends an HTTP request to the server so that the server can obtain the text content according to the HTTP request;
the client receives an HTML file sent by the server, wherein the HTML file contains the text content;
the client sends a style request to the server so that the server can obtain presentation style information according to the style request;
and the client receives a style file sent by the server, wherein the style file comprises the presentation style information.
6. The method of claim 3, wherein the rendering the text content by the client according to the presentation style information and the display attribute of the client comprises:
the client typesets the text content according to the presentation style information and the size of a display frame in the client;
and the client displays the text content obtained after typesetting.
7. A text presentation apparatus, wherein the apparatus is located at a server, the apparatus comprising:
a processing unit for obtaining text content and presentation style information;
the output unit is used for sending the text content and the presentation style information to a client so that the client can render the text content according to the presentation style information and the display attribute of the client, wherein the display attribute of the client comprises the size of a display frame in the client;
wherein the presentation style information includes at least one of the following style attributes: the attribute is used for indicating whether the text content is subjected to line feed, the attribute is used for indicating whether the text content overflows the display box and is hidden, the attribute is used for indicating whether the text content overflows the display box and is displayed with an omission mark, the attribute is used for indicating the line height of the text content, the attribute is used for indicating the type of the display box where the text content is located, the attribute is used for indicating the arrangement mode of the text content, and the attribute is used for indicating the displayable line number of the text content.
8. The apparatus according to claim 7, wherein the output unit is specifically configured to:
sending a hypertext markup language (HTML) file and a style file to the client, wherein the HTML file contains the text content, and the style file contains the presentation style information; or,
sending an HTML file to the client, wherein the HTML file contains the text content; the server receives a style request sent by the client and sends a style file to the client according to the style request, wherein the style file comprises the presentation style information; or,
and sending an HTML file to the client, wherein the HTML file comprises the text content and the presentation style information.
9. A text presentation apparatus, wherein the apparatus is located at a client, the apparatus comprising:
the input and output unit is used for receiving the text content and the presentation style information sent by the server;
a content rendering unit, configured to render the text content according to the presentation style information and a display attribute of the client, where the display attribute of the client includes a size of a display frame in the client;
wherein the presentation style information includes at least one of the following style attributes: the attribute is used for indicating whether the text content is subjected to line feed, the attribute is used for indicating whether the text content overflows the display box and is hidden, the attribute is used for indicating whether the text content overflows the display box and is displayed with an omission mark, the attribute is used for indicating the line height of the text content, the attribute is used for indicating the type of the display box where the text content is located, the attribute is used for indicating the arrangement mode of the text content, and the attribute is used for indicating the displayable line number of the text content.
10. The apparatus of claim 9, wherein the input-output unit is specifically configured to:
sending a hypertext transfer protocol (HTTP) request to the server so that the server obtains the presentation style information and obtains the text content according to the HTTP request;
receiving a hypertext markup language (HTML) file and a style file sent by the server, wherein the HTML file contains the text content, and the style file contains the presentation style information; or receiving an HTML file sent by the server, wherein the HTML file contains the text content and the presentation style information.
11. The apparatus of claim 9, wherein the input-output unit is specifically configured to:
sending an HTTP request to the server so that the server can obtain the text content according to the HTTP request;
receiving an HTML file sent by the server, wherein the HTML file contains the text content;
sending a style request to the server so that the server can obtain presentation style information according to the style request;
and receiving a style file sent by the server, wherein the style file comprises the presentation style information.
12. The apparatus according to claim 9, wherein the content rendering unit is specifically configured to:
typesetting the text content according to the presentation style information and the size of a display frame in the client;
and displaying the text content obtained after the typesetting.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410734243.8A CN104572822B (en) | 2014-12-04 | 2014-12-04 | Text shows method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410734243.8A CN104572822B (en) | 2014-12-04 | 2014-12-04 | Text shows method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN104572822A CN104572822A (en) | 2015-04-29 |
CN104572822B true CN104572822B (en) | 2018-09-04 |
Family
ID=53088884
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201410734243.8A Active CN104572822B (en) | 2014-12-04 | 2014-12-04 | Text shows method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN104572822B (en) |
Families Citing this family (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106708852A (en) * | 2015-11-13 | 2017-05-24 | 阿里巴巴集团控股有限公司 | Client long text display method and apparatus |
CN105955637B (en) * | 2016-04-25 | 2020-06-19 | 北京小米移动软件有限公司 | Method and device for processing text input box |
CN106656743B (en) * | 2016-10-08 | 2020-02-14 | 腾讯科技(深圳)有限公司 | Message display method, device and system |
US20180191798A1 (en) * | 2016-12-30 | 2018-07-05 | Google Inc. | Methods and systems for server-side rendering of native content for presentation |
CN107590118A (en) * | 2017-08-03 | 2018-01-16 | 天脉聚源(北京)传媒科技有限公司 | A kind of method and device of the intelligent typesetting of news |
CN110020289A (en) * | 2017-09-30 | 2019-07-16 | 北京国双科技有限公司 | Text display method, device and equipment in a kind of browser |
CN109640148A (en) * | 2017-10-09 | 2019-04-16 | 武汉斗鱼网络科技有限公司 | A kind of method and device by text box text exhibition content |
CN110929188A (en) * | 2018-09-19 | 2020-03-27 | 北京国双科技有限公司 | Method and device for rendering server page |
CN111915705B (en) * | 2019-05-07 | 2023-07-28 | 百度在线网络技术(北京)有限公司 | Picture visual editing method, device, equipment and medium |
CN111460349A (en) * | 2020-03-31 | 2020-07-28 | 北京金山云网络技术有限公司 | Text display method and device and user terminal |
CN113408241A (en) * | 2021-07-16 | 2021-09-17 | 网易(杭州)网络有限公司 | Text data processing method and device, electronic equipment and readable medium |
CN114662450B (en) * | 2022-03-08 | 2025-03-11 | 阿里巴巴(中国)有限公司 | Graphic display method and electronic device |
Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103412928A (en) * | 2013-08-16 | 2013-11-27 | 北京乐动卓越科技有限公司 | Method and device for realizing browser page intelligent response-type layout on mobile terminal |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
GB2366037B (en) * | 2000-02-24 | 2004-01-21 | Ibm | Customising an HTML document |
KR100810010B1 (en) * | 2003-06-30 | 2008-03-07 | 인터내셔널 비지네스 머신즈 코포레이션 | A method and system for improving presentation of html pages in web devices |
US7653875B2 (en) * | 2005-04-07 | 2010-01-26 | Microsoft Corporation | Browser sensitive web content delivery |
-
2014
- 2014-12-04 CN CN201410734243.8A patent/CN104572822B/en active Active
Patent Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103412928A (en) * | 2013-08-16 | 2013-11-27 | 北京乐动卓越科技有限公司 | Method and device for realizing browser page intelligent response-type layout on mobile terminal |
Also Published As
Publication number | Publication date |
---|---|
CN104572822A (en) | 2015-04-29 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN104572822B (en) | Text shows method and device | |
CN106991154B (en) | Webpage rendering method and device, terminal and server | |
CN102663126B (en) | Method and device for displaying webpage in mobile terminal | |
US9413807B1 (en) | Browser rendering and computation | |
CN106331345B (en) | Interactive message display method, device and system | |
CN104572843B (en) | The loading method and device of a kind of page | |
CN107818008B (en) | Page loading method and device | |
CN106874519B (en) | Page display method and device | |
CN107656911B (en) | Form processing method and system | |
CN109740081B (en) | Page loading method and device | |
US20160080298A1 (en) | Method for generating emoticon and electronic device supporting the same | |
CN105893558B (en) | Recommended data display method and system | |
CN111915705A (en) | Picture visual editing method, device, equipment and medium | |
JP5668180B1 (en) | Information processing device | |
EP2928219A1 (en) | Restriction information distribution apparatus and restriction information distribution system | |
CN107704536B (en) | Software content display method and system | |
CN106407276B (en) | Display method and device of text live broadcast content | |
US20170169792A1 (en) | Electronic device and method for releasing content to multiple terminals | |
CN105389308A (en) | Display processing method and device for web pages | |
CN105589883B (en) | Method and device for displaying page elements of webpage | |
CN110309454B (en) | Interface display method, device, equipment and storage medium | |
CN110209965B (en) | Method and apparatus for displaying information | |
US10846360B2 (en) | Display control apparatus and display control method | |
CN107977451B (en) | Method and device for adding dynamic content in display page and terminal equipment | |
US20160140112A1 (en) | Information processing system, information processing method, data, information processing device, display device, display method, program, and information storage medium |
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 |