Text composition

The method addresses font inconsistency in online collaborative documents by determining and applying compatible fonts based on character size data, ensuring consistent formatting across devices.

JP2024534171AActive Publication Date: 2024-09-18BEIJING KINGSOFT OFFICE SOFTWARE INC +1
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
JP2024513148
Authority / Receiving Office
JP · JP
Patent Type
Applications
Current Assignee / Owner
Priority Date
2021-08-26
Filing Date
2021-12-28
Publication Date
2024-09-18
Estimated Expiration
2041-12-28

AI Technical Summary

Technical Problem

The inconsistency in document formatting across different devices due to font availability issues in online collaborative document editing systems, leading to aesthetic and consistency problems.

Method used

A method and device for text typesetting that determines the original font used in a collaboration document, checks if the terminal supports it, acquires character size data if it doesn't, and displays the text in a compatible font based on this data to maintain formatting consistency.

Benefits of technology

Ensures typographical consistency across collaboration terminals by using compatible fonts and adjusting text dimensions to match the original font's characteristics, even when the terminal lacks the original font.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 2024534171000001
    Figure 2024534171000001
Patent Text Reader

Abstract

The present invention relates to a computer technical field, and to a text typesetting method, device, electronic device, and storage medium. The method includes the steps of: determining an original font used for a target text in a collaboration document; determining whether a first terminal among a plurality of collaboration terminals supports the original font; if the first terminal does not support the original font, acquiring character size data of the original font; if the first terminal successfully acquires the character size data of the original font, displaying the target text in a first font supported by the first terminal, and typesetting the target text displayed in the first font based on the character size data of the original font.
Need to check novelty before this filing date? Find Prior Art

Description

[Technical field]

[0001] The present invention relates to the field of computer technology, and more particularly to a method, apparatus, electronic device, and storage medium for typesetting text. [Background technology]

[0002] More and more applications are introducing online collaborative document functions, such as the ability for multiple users to simultaneously edit and view an online document. When one or more users view the same online document on different devices, the lack of a specific font may cause the document to be typeset significantly differently on different devices, affecting the aesthetics of the document and the consistency of the viewing experience. The common method is to install the corresponding font in the current environment. However, this method requires searching, downloading, and installing the font, and the font may be paid, making it difficult to be widely used and applied. Therefore, a new text typesetting method needs to be proposed. Summary of the Invention

[0003] An objective of the embodiments of the present invention is to provide a new technical solution for typesetting text so as to keep typesetting consistency of online collaboration documents in the absence of fonts.

[0004] According to a first aspect of the present invention, there is provided a text typesetting method adapted to multiple collaboration terminals of a collaboration document, the text typesetting method comprising: determining an original font used for target text in the collaboration document; determining whether a first terminal of the plurality of collaboration terminals supports the original font; the first terminal acquiring character size data of the original font when the first terminal does not support the original font; when the first terminal has successfully acquired character size data of the original font, displaying the target text in a first font supported by the first terminal; The first terminal includes a step of typesetting the target text to be displayed in the first font based on character size data of the original font.

[0005] According to a second aspect of the present invention, there is provided a text typesetting device adapted for use in a plurality of collaboration terminals of a collaboration document, the text typesetting device comprising: a first determination module for determining an original font used for target text in the collaboration document; a second determination module for determining whether a first terminal of the plurality of collaboration terminals supports the original font; an acquisition module for acquiring character size data of the original font when the first terminal does not support the original font; and a typesetting module for, if the character size data of the original font is successfully acquired, displaying the target text in a first font supported by the first terminal, and typesetting the target text displayed in the first font based on the character size data of the original font.

[0006] According to a third aspect of the present invention, there is provided an electronic device comprising a memory and a processor, the memory adapted to store a computer program and the processor adapted to execute the computer program and thereby perform the method of the first aspect of the present invention.

[0007] According to a fourth aspect of the present invention there is provided a computer readable storage medium having stored thereon a computer program which, when executed by a processor, performs the method of the first aspect of the present invention.

[0008] The beneficial effects of the embodiment of the present invention are as follows: For a collaboration document of online multi-user collaboration, if a collaboration terminal does not support the original font of a target text in the collaboration document, the collaboration terminal can use a first font supported by the collaboration terminal to display the target text, and typeset the target text based on character size data corresponding to the original font, so that the collaboration terminal can maintain typesetting consistency with other collaboration terminals even when the original font is not available. The text typesetting method provided in the embodiment of the present invention is applicable to multi-user editing of online documents.

[0009] Other features and advantages of the embodiments of the present invention will become apparent from the following detailed description of exemplary embodiments of the present invention with reference to the accompanying drawings. [Brief description of the drawings]

[0010] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments of the invention and, together with the description, serve to explain the principles of embodiments of the invention.

[0011] [Figure 1] 1 is a schematic diagram of an online document collaboration system according to an embodiment of the present invention. [Diagram 2] 1 is a flowchart of a text typesetting method according to an embodiment of the present invention. [Diagram 3] FIG. 6 is a schematic diagram of character size data according to an embodiment of the present invention. [Figure 4] FIG. 2 is an exemplary diagram of a method for typesetting text according to an embodiment of the present invention; [Diagram 5] 1 is a schematic diagram of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

[0012] Various exemplary embodiments of the present invention will be described in detail below with reference to the accompanying drawings. Note that the relative arrangement of components and steps, formulas, and numerical values ​​described in these embodiments do not limit the scope of the present invention unless otherwise specified.

[0013] The following description of at least one exemplary embodiment is merely exemplary in nature and is in no way intended to limit the invention, its application, or uses.

[0014] Techniques, methods and equipment known to those skilled in the art may not be described in detail, but, where appropriate, such techniques, methods and equipment should be considered part of this specification.

[0015] In all examples shown and discussed herein, any particular values ​​should be construed as merely exemplary and not limiting, and thus other instances of the example embodiments may have different values.

[0016] In the following accompanying drawings, like numerals and letters represent like items, so that once an item is defined in one drawing, no further explanation is required in subsequent drawings.

[0017] <Text composition method> 1 is a block diagram of an online document collaboration system according to an embodiment of the present invention. As shown in FIG. 1, the online document collaboration system includes a plurality of terminal devices, which can communicate with each other through a network.

[0018] The terminal device may be, for example, an electronic device in which an intelligent operating system (e.g., Android, IOS, Windows, Linux, etc.) is installed, and includes, but is not limited to, a portable computer, a desktop computer, a mobile phone, a tablet, etc. The configuration of the terminal device includes, but is not limited to, a processor 1031, a memory 1032, an interface device 1033, a communication device 1034, a GPU (Graphics Processing Unit, image processing device) 1035, a display device 1036, an input device 1037, a speaker 1038, a microphone 1039, and a camera 1030. The processor 1031 includes, but is not limited to, a central processing unit CPU, a microprocessor MCU, etc. The memory 1032 includes, but is not limited to, a non-volatile memory such as a ROM (Read Only Memory), a RAM (Random Access Memory), a hard disk, etc. The interface device 1033 includes, but is not limited to, a USB interface, a serial interface, a parallel interface, etc. The communication device 1034 is capable of, for example, wired or wireless communication, specifically, WiFi communication, Bluetooth communication, 2G / 3G / 4G / 5G communication, etc. The GPU 1035 is used to process images. The display device 1036 includes, but is not limited to, a liquid crystal display, a touch panel display, etc. The input device 1037 includes, but is not limited to, a keyboard, a mouse, a touch panel, etc. In addition, the configuration of the terminal device may include only a part of the above devices.

[0019] In one embodiment of the present invention, User A can submit a collaboration document through one terminal device and select collaboration partners to initiate online multi-user collaboration function. After that, all selected collaborators and User A can view and jointly edit the collaboration document using their respective terminal devices. These terminal devices are collaboration terminals of the collaboration document.

[0020] In one embodiment of the present invention, the online multi-user collaboration function may be realized based on a target application. A user can submit a collaboration document on the target application and view and co-edit the document on the target application. In one example, a user can register an account on the target application in advance, open the target application using a terminal device, and use the online multi-user collaboration function after logging in to the account. The target application running on the terminal device is a collaboration terminal application of the collaboration document.

[0021] In one example, the target application may be, for example, document editing software, instant messaging software, office software, a browser, and the like.

[0022] In one example, the target application may be, for example, a native application, a web application, a hybrid application, a light (lightweight) application, etc. A native application is an application that can be run directly on the current operating system. A web application is a web application that must be run in a browser. A hybrid application may be a combination of a native application and a web application, and is typically a native application with an embedded browser. A lightweight application is an application that can be used without requiring download or installation, and can be directly searched and used by the user, or can be scanned and used.

[0023] When the same account is registered in the target application on multiple terminal devices, each terminal device may be regarded as one collaboration terminal, i.e., a user with the same account may use two or more collaboration terminals to view and collaboratively edit the target text.

[0024] The online document collaboration system shown in FIG. 1 is merely exemplary and is not meant to limit the embodiment of the present invention, its application or use. Although multiple devices of the terminal device are described, those skilled in the art will understand that the embodiment of the present invention may relate to only some of the devices. For example, the terminal device may include only a processor, a memory, a communication device, an input device, and a display. Those skilled in the art may design instructions according to the aspects disclosed in the embodiment of the present invention. How instructions control and operate a processor is a well-known technique in the art, and will not be described in detail in this specification.

[0025] As shown in Fig. 2, an embodiment of the present invention provides a text typesetting method, including steps S102 to S108. Steps S102 to S108 may be performed by a first terminal, which is one collaboration terminal among multiple collaboration terminals of a collaboration document.

[0026] In step S102, the original font used for the target text in the collaboration document is determined.

[0027] In an embodiment of the present invention, the target text may be any part of text in the collaboration document. In one example, the first terminal obtains original font information of the target text from the collaboration document to determine the original font used for the target text. Typically, the original font information may be stored in the document data of the collaboration document. In a possible embodiment, the original font information may be a font identifier, name, code, etc.

[0028] In an embodiment of the present invention, the font may be a font loaded into the operating system of the terminal device, a font loaded into a client (e.g., a browser or an application) of the terminal device, a font stored in a server, or a font included in a document file. Here, a document file may include a font, but a document file including a font usually has a relatively large amount of data. In addition, the font loaded into the operating system of the terminal device, the font loaded into the client of the terminal device, and the font included in the document file are all fonts that can be supported by the terminal device, and may be collectively referred to as local fonts. Meanwhile, a font stored in a server is called a server font or a cloud font.

[0029] In step S104, it is determined whether the first terminal supports the original font.

[0030] In an embodiment of the present invention, after the first terminal determines the original font used in the target text, it checks whether the original font is included in all fonts that it supports. If the original font is not included in all fonts that it supports, it is determined that the first terminal does not support the original font. For example, if the original font is loaded in the operating system of the first terminal or the client of the first terminal, or if the original font is stored in the target text (or collaboration document), it is determined that the first terminal supports the original font; otherwise, it is determined that the first terminal does not support the original font.

[0031] The fonts supported by the first terminal may be determined based on a font package (font pack) installed on the first terminal. For example, if a font package for a certain font is installed on the first terminal, it means that the first terminal supports the font. Generally, various widely used font packages are pre-installed in the basic data packet of the operating system or application of the terminal device, and one of the fonts is set as the default font. If a user wants to use a special font, the corresponding font package needs to be downloaded separately.

[0032] In step S106, if the first terminal does not support the original font, the first terminal obtains character size data of the original font.

[0033] In the embodiment of the present invention, the characters include, but are not limited to, letters and symbols. The characters include, but are not limited to, Chinese characters and alphabets. The symbols include, but are not limited to, punctuation marks, numeric symbols, mathematical symbols, special symbols, emojis, etc.

[0034] In an embodiment of the present invention, the character size data of a font includes the height and width of a character. The character size data of an original font includes the character width of the original font and the character height of the original font, which are the width and height of a character of a target text in the state of the original font. For the same font, under the same font size, different characters can be designed to have the same or different sizes. For the same font, under the same font size, if all characters do not adopt the same size, a mapping relationship between the character and the character width and height is established. In this way, the mapping relationship can be the character size data of the corresponding font, and the character size of each character in the corresponding font size can be searched based on the mapping relationship.

[0035] As shown in FIGS. 3(a) and 3(b), for the same Chinese character "zao", the widths and heights of the two types of fonts are different under the same font size. The width and height of the font shown in FIG. 3(b) are smaller than those of the font in FIG. 3(a).

[0036] As an example, the font character size data can be obtained by measuring the size of the character. For example, if one of the plurality of collaboration terminals supports the original font, the collaboration terminal may display the target text in the original font and measure the character size (specifically, the character width and height) of the target text in the original font to obtain the character size data of the original font.

[0037] In another embodiment, the original font information of the original font includes the character size data of the original font. Further, the character size data of the original font may be read from the original font information of the original font.

[0038] In one example, the first terminal may obtain the character size data of the original font shared among the plurality of collaboration terminals by another collaboration terminal. That is, based on the collaboration relationship among multiple users online, if the first terminal does not support the original font, and if a collaboration terminal other than the first terminal supports the original font, the collaboration terminal that supports the original font may share the character size data of the original font among the plurality of collaboration terminals, whereby the first terminal can obtain the size data of the original font.

[0039] In one example, the collaboration terminal that shares the character size data of the original font is called the second terminal. The second terminal supports the original font. The process of determining the second terminal from among multiple collaboration terminals can refer to the following step S202. In one embodiment, after the first terminal obtains the character size data of the original font from the second terminal, the first terminal may store the character size data of the original font in a local cache of the first terminal, and next time when the font needs to be used, the first terminal may directly read the character size data of the font from the local cache.

[0040] In one embodiment, the first terminal obtaining the character size data of the original font may be querying a local cache of the first terminal for the character size data of the original font.

[0041] In one example, the first terminal obtaining the character size data of the original font may be to query the local cache of the first terminal for the character size data of the original font, and if the character size data of the original font is not found in the local cache of the first terminal, obtain the character size data of the original font from the second terminal. In this example, after obtaining the character size data of the original font, the first terminal may store the character size data of the original font in the local cache, and directly read the character size data of the original font from the local cache the next time the font needs to be used.

[0042] The step of the first terminal acquiring character size data of the original font from the second terminal may include steps S202 to S204.

[0043] In step S202, a font query request for the original font is broadcast among multiple collaboration terminals to determine a second terminal.

[0044] In one example, when a terminal becomes a collaboration terminal of a collaboration document, notification information of "join collaboration" is broadcast, and accordingly, when a terminal ends collaboration and is no longer a collaboration terminal of the collaboration document, notification information of "end collaboration" is broadcast. In this way, the collaboration terminal of the collaboration document can determine the number of collaboration terminals based on the received notification information. For example, the number of collaboration terminals is the difference between the number of received notification information of "join collaboration" and the number of received notification information of "end collaboration". If the first terminal does not support the original font, when the number of collaboration terminals reaches two or more, the first terminal broadcasts a font inquiry request among multiple collaboration terminals to determine the second terminal.

[0045] The step of the first terminal broadcasting the font query request among the multiple collaboration terminals to determine the second terminal may include steps S2022 to S2024.

[0046] In step S2022, the font query request is broadcast among a plurality of collaboration terminals, and collaboration terminals that support the original font are determined as candidate terminals.

[0047] In step S2024, if the number of candidate terminals is 1, the candidate terminal is determined as the second terminal, and if the number of candidate terminals is greater than 1, a candidate terminal that satisfies a predetermined condition is determined as the second terminal.

[0048] The predetermined conditions may include at least one of the following conditions a to c.

[0049] Condition a: the candidate terminal with the best communication quality with the first terminal. For example, the candidate terminal with the shortest network delay with the first terminal may be determined as the candidate terminal with the best communication quality.

[0050] Condition b: the candidate terminal that receives the fewest font support requests. The candidate terminal that receives the fewest font support requests is relatively idle, so selecting it as the second terminal is advantageous for improving overall efficiency.

[0051] Condition c: the candidate terminal that has sent the fewest number of font query requests. Since the candidate terminal that has sent the fewest number of font query requests is relatively idle, it is advantageous to select this as the second terminal in terms of improving overall efficiency.

[0052] In one example, when the first terminal finds that the original font is not supported, i.e., the first terminal does not have the original font locally, it creates an information queue and adds a font query request to the information queue, thereby broadcasting the font query request among multiple collaboration terminals of the collaboration document. When each collaboration terminal of the collaboration document receives the font query request, it determines whether it supports the original font, and if it determines that it supports the original font, it sends first response information to the first terminal. The first response information indicates that it supports the original font. When the first terminal receives the first response information to the font query request sent from another collaboration terminal, it may determine the collaboration terminal as a second terminal.

[0053] In step S204, a font assistance request for the original font is sent to the second terminal, and character size data of the original font is obtained from the second terminal.

[0054] The first terminal sends a font assistance request to the second terminal, and the second terminal sends character size data corresponding to the original font to the first terminal upon receiving the font assistance request. For example, the second terminal performs a character measurement operation on the original font upon receiving the font assistance request to obtain the character size data of the original font.

[0055] In step S108, if the first terminal succeeds in acquiring the character size data of the original font, the first terminal displays the target text in a first font supported by the first terminal, and typesets the displayed target text based on the character size data of the original font. The first font may be a font that most closely matches the character size data of the original font among all fonts supported by the first terminal. In one example, the step of determining the first font may include the following steps: When the typesetting direction of the target text is horizontal writing, the difference between the character width of the target text in the original font and the character width of the target text in each font supported by the first terminal is calculated as a first difference, and the smaller the absolute value of the first difference is, the closer the character width of the corresponding font supported by the first terminal is to the character width of the original font, and the font supported by the first terminal with the smallest absolute value of the first difference is selected as the first font. In addition, when the typesetting direction of the target text is vertical, the difference between the character height of the target text in the original font and the character height of the target text in each font supported by the first terminal is calculated as a second difference, and the smaller the absolute value of the second difference, the closer the character height of the corresponding font supported by the first terminal is to the character height of the original font, and the font supported by the first terminal having the smallest absolute value of the second difference is selected as the first font.

[0056] The first terminal may typeset the target text to be displayed in the first font on the first terminal based on the character size data of the original font in various ways, which will be described below with examples.

[0057] Example 1:

[0058] A typesetting direction of the target text is determined, and the target text is typeset in the first font on the first terminal based on the typesetting direction of the target text.

[0059] When the typesetting direction of the target text is horizontal, a first enlargement / reduction process is performed on the characters of the target text in the first font so that the character width of the target text in the first font matches the character width of the target text in the original font, and when the typesetting direction of the target text is vertical, a second enlargement / reduction process is performed on the characters of the target text in the first font so that the character height of the target text in the first font matches the character height of the target text in the original font.

[0060] In Example 1, character scaling can be achieved by adjusting the font size.

[0061] In one embodiment, in step S108, typesetting the target text to be displayed on the first terminal based on character size data corresponding to the original font may include obtaining character size data corresponding to a first font, and typesetting the target text to be displayed on the first terminal based on the character size data corresponding to the original font and the character size data corresponding to the first font.

[0062] Example 2:

[0063] A typesetting direction of the target text is determined, and the target text is typeset in the first font on the first terminal based on the typesetting direction of the target text.

[0064] If the typesetting direction of the target text is horizontal, a first difference is determined, which is the difference between the character width of the target text in the original font and the character width of the target text in the first font. If the first difference is a positive value, the abscissa value of the character of the target text is adjusted, and if the first difference is a negative value, the character of the target text is shrunk.

[0065] If the typesetting direction of the target text is vertical, a second difference is determined, which is the difference between the character height of the target text in the original font and the character height of the target text in the first font. If the second difference is a positive value, the ordinate value of the character of the target text is adjusted, and if the second difference is a negative value, the character of the target text is scaled down.

[0066] In Example 2, the character reduction process may be achieved by adjusting the font size.

[0067] The following description will be given taking as an example a case where the typesetting direction of the target text is horizontal.

[0068] As shown in Fig. 3(a), the character width of each character in the target text in the original font is approximately W1. As shown in Fig. 3(b), the character width of each character in the target text in the first font is approximately W2. The difference DW (=W1-W2) between W1 and W2 is calculated as the first difference.

[0069] If the first difference DW is a positive value, it indicates that the character width of the first font is smaller than the character width of the original font, and the horizontal coordinate value of each character of the target text in the first font needs to be adjusted.

[0070] As shown in Figure 4, the target text is a one-line content, which contains 10 characters, “Good morning today’s weather is good.” In the original font, the horizontal coordinate values ​​of the 10 characters are X1, X2, ..., X 10 After typesetting, the horizontal coordinate values ​​of the 10 characters are X1', X2', ..., X 10 This gives us the following formula: X1'=X1+0.5*DW X2'=X2+(2-1)*DW+0.5*DW … X n '=X n +(n-1)*DW+0.5*DW … X 10 '=X 10 +(10-1)*DW+0.5*DW

[0071] Here, n is an integer and 1≦n≦10.

[0072] As can be seen, adjusting the horizontal coordinate value of each character in the content of this line under the first font is equivalent to adjusting the spacing between adjacent characters in the content of this line.

[0073] If the first difference DW is a negative value, it means that the character width of the first font is larger than that of the original font, and adjusting the coordinate value may cause overlapping of characters, so it is necessary to reduce the font size of the target text displayed in the first font on the first terminal and not change the position (coordinate value) of the original target text in the first font. In one example, the font size of the target text displayed in the first font on the first terminal is reduced based on the ratio W1 / W2. For example, if W1 / W2=R1 and the original font size of the content is U1, the font size of the content is adjusted to U2, and U2=R1*U1. Here, the font size in this specification is in points, which is a measurement method of printing fonts well known to those skilled in the art, such as 5 points, 12 points, etc.

[0074] The following description will be given taking as an example a case where the typesetting direction of the target text is vertical.

[0075] As shown in Fig. 3(a), the character height of each character in the original font is approximately H1. As shown in Fig. 3(b), the character height of each character in the first font is approximately H2. The difference DH (=H1-H2) between H1 and H2 is calculated as the second difference.

[0076] If the second difference DH is a positive value, it indicates that the character height of the first font is smaller than the character height of the original font, and the vertical coordinate value of each character in the first font is adjusted.

[0077] The target text under the original font has a total of M lines of content, the ordinate values ​​of the characters in each line are the same, and the ordinate values ​​of the characters in the first line to the Mth line are Y1, Y2, ..., Y M After typesetting, the ordinate values ​​of the characters from the 1st line to the Mth line are Y1', Y2', ..., Y M ', we obtain the following formula: Y1'=Y1+0.5*DH Y2'=Y2+(2-1)*DH+0.5*DH … Y m '=Y m +(m-1)*DH+0.5*DH … Y M '=Y M +(M-1)*DH+0.5*DH

[0078] Here, m is an integer and 1≦m≦M.

[0079] As can be seen, adjusting the vertical coordinate value of each character of the target text in the first font is equivalent to adjusting the spacing between adjacent lines of the target text.

[0080] If the second difference DH is a negative value, it means that the character height of the first font is greater than that of the original font, and adjusting the coordinate values ​​may cause characters to overlap, so it is necessary to reduce the font size of the target text displayed in the first font on the first terminal. In one example, the font size of the target text displayed in the first font on the first terminal is reduced based on the ratio H1 / H2, and the position (coordinate value) of the original target text in the first font is not changed. For example, if H1 / H2=R2 and the original font size of the target text is U1, the font size is adjusted to U2, where U2=R2*U1.

[0081] Example 3:

[0082] A typesetting direction of the target text is determined, and the target text is typeset in the first font on the first terminal based on the typesetting direction of the target text.

[0083] If the typesetting direction of the target text is horizontal, the font size of the target text in a first font is adjusted to a first font size, where the first font size is a font size where the character width of the target text in the first font is closest to the character width of the target text in the original font. After adjusting the font size of the target text to the first font size, a first difference is determined, where the first difference is a difference between the character width of the target text in the original font and the character width of the target text in the first font. If the first difference is a positive value, the abscissa value of the character of the target text is adjusted, and if the first difference is a negative value, a shrinking process is performed on the character of the target text.

[0084] In other words, when the typesetting direction of the target text is horizontal, the first terminal adjusts the font size of the target text in the first font to the first font size, and if the character width is still larger than the character width in the original font, reduces the font size by one point to reduce the characters, thereby avoiding a situation where characters overlap each other.

[0085] If the typesetting direction of the target text is vertical, the font size of the target text in the first font is adjusted to a second font size, where the second font size is the font size whose character height of the target text in the first font is closest to the character height of the target text in the original font. After adjusting the font size of the target text to the second font size, a second difference is determined, where the second difference is the difference between the character height of the target text in the original font and the character height of the target text in the first font. If the second difference is a positive value, the ordinate value of the character of the target text is adjusted, and if the second difference is a negative value, a shrinking process is performed on the character of the target text.

[0086] In other words, when the typesetting direction of the target text is vertical, the first terminal adjusts the font size of the target text in the first font to the second font size, and if the character height is still larger than the character height in the original font, reduces the font size by one point to reduce the characters, thereby avoiding a situation where characters overlap each other.

[0087] In Example 3, the character reduction process may be achieved by adjusting the font size.

[0088] After the first terminal typessets the target text displayed in the first font, the typesetting situation of the target text displayed in the first font on the first terminal is close to the typesetting situation of the target text displayed in the original font. As shown in FIG. 4, for the target text "The weather is good today, it's good", the total width of the content in the original font is wider when comparing the typesetting situation in the original font with the typesetting situation in the first font. Through the typesetting in step S108, the total width of the content displayed in the first font on the first terminal is close to the total width of the content in the original font. In this way, the content of the same line in the original font will not be broken because it has been changed to be displayed in the first font, and the problem of collaboration terminals being unable to synchronize collaboration due to typesetting differences can be avoided.

[0089] The beneficial effects of the embodiment of the present invention are as follows: for a collaboration document of online collaboration by multiple users, if a collaboration terminal does not support the original font of a target text in the collaboration document, the collaboration terminal can use a first font supported by the collaboration terminal to display the target text, and typeset the target text displayed on the collaboration terminal according to character size data corresponding to the original font, so that the collaboration terminal can maintain typesetting consistency with other collaboration terminals even when the original font is not available.

[0090] If the first terminal fails to acquire the character size data of the original font, the method may further include steps S902 to S904.

[0091] In step S902, determine whether the first terminal supports the target font. The target font is a font determined among the candidate fonts by the multiple collaboration terminals based on a preset negotiation mechanism when none of the multiple collaboration terminals supports the original font. The candidate font is a font supported by any of the collaboration terminals.

[0092] For example, a font supported by the collaboration terminal that first sends the font query request may be determined as the target font. The collaboration terminal that first sends the font query request is usually relatively idle and has higher efficiency than other collaboration terminals. As another example, a score for each candidate font may be determined, and the candidate font with the highest score may be determined as the target font. Here, the score of a candidate font is the number of collaboration terminals that support the candidate font.

[0093] In step S904, if the first terminal supports the target font, it displays the target text in the target font; if the first terminal does not support the target font, it obtains character size data of the target font from the third terminal, displays the target text in a second font supported by the first terminal, and typesets the target text displayed in the second font based on the character size data of the target font, the third terminal being a collaboration terminal supporting the target font. Here, the second font is a font that is most consistent with the target font among fonts supported by the first terminal. The process of determining the second font may be similar to the process of determining the first font described above. In particular, the second font may be the same as the first font.

[0094] The process in which the first terminal obtains character size data of the target font from the third terminal is similar to the above-mentioned process in which the first terminal obtains character size data of the original font from the second terminal.

[0095] The beneficial effects of the embodiment of the present invention are as follows: For a collaboration document of online multi-user collaboration, if all collaboration terminals do not support the original font of the target text in the collaboration document, a font can be determined as the target font based on a preset negotiation mechanism, and each collaboration terminal can uniformly use the target font to display the target text, so that each collaboration terminal can maintain typesetting consistency with other collaboration terminals even when the original font is not available.

[0096] If the first terminal supports the original font, the method may further include: the first terminal displays the target text in the original font, and transmits character size data of the original font to a fourth terminal, the fourth terminal being a collaboration terminal that does not support the original font.

[0097] In one example, if the first terminal supports the original font, when the first terminal receives a font assistance request from the fourth terminal, the first terminal transmits character size data corresponding to the original font to the fourth terminal. In one example, if the first terminal supports the original font, the first terminal may share the character size data of the original font among multiple collaboration terminals.

[0098] <Device Example> An embodiment of the present invention provides a text typesetting device adapted to multiple collaboration terminals of a collaboration document, the text typesetting device comprising: a first determination module for determining an original font to be used for a target text in the collaboration document; a second determination module for determining whether a first terminal of the plurality of collaboration terminals supports the original font; A first obtaining module for obtaining character size data of the original font when the first terminal does not support the original font; and a first typesetting module for typesetting the target text to be displayed in the first font based on the character size data of the original font if the character size data of the original font is successfully acquired.

[0099] In one example, the step of the first terminal acquiring character size data of the original font includes the step of the first terminal acquiring character size data of the original font shared among the multiple collaboration terminals by the second terminal.

[0100] In one example, the step of obtaining character size data of the original font by the first terminal includes a step of querying a local cache of the first terminal for character size data of the original font, or a step of obtaining character size data of the original font from a second terminal, the second terminal being a collaboration terminal that supports the original font among the multiple collaboration terminals.

[0101] In one example, the step of obtaining character size data of the original font by the first terminal includes the steps of querying a local cache of the first terminal for character size data of the original font, and if the character size data of the original font is not found in the local cache of the first terminal, obtaining the character size data of the original font from a second terminal, the second terminal being a collaboration terminal that supports the original font among the multiple collaboration terminals.

[0102] In one example, the first acquisition module includes: a first request module for broadcasting a font query request among a plurality of collaboration terminals to determine a second terminal; and a second request module for sending a font assistance request to the second terminal and obtaining character size data of the original font from the second terminal.

[0103] The first request module broadcasts the font query request among the multiple collaboration terminals to determine the second terminal. broadcasting the font query request among a plurality of collaboration terminals to determine collaboration terminals that support the original font as candidate terminals; If the number of candidate terminals is 1, determine the candidate terminal as the second terminal; If the number of candidate terminals is greater than one, determining a candidate terminal that satisfies a predetermined condition as the second terminal.

[0104] In one example, the first terminal further includes a third determination module, a second acquisition module, and a second typesetting module; The third determination module is used to determine whether the first terminal supports the target font when the first terminal fails to obtain character size data of the original font, and the target font is a font determined from among the candidate fonts by the multiple collaboration terminals based on a preset negotiation mechanism when none of the multiple collaboration terminals supports the original font, and the candidate font is a font supported by any of the collaboration terminals; the second obtaining module is used for obtaining character size data of the target font from the third terminal when the third determining module determines that the first terminal does not support the target font; The second typesetting module is used to display the target text in the target font if the third determination module determines that the first terminal supports the target font, and to display the target text in a second font supported by the first terminal if the third determination module determines that the first terminal does not support the target font, and to typeset the target text displayed in the second font supported by the first terminal based on character size data of the target font, and the third terminal is a collaboration terminal that supports the target font among the multiple collaboration terminals.

[0105] In one example, the first terminal If the first terminal supports the original font, further including a sending module for displaying the target text in the original font and sending character size data of the original font to the fourth terminal; The fourth terminal is a collaboration terminal that does not support the original font among the multiple collaboration terminals.

[0106] In one example, the first typesetting module typesets the target text to be displayed in a first font supported by the first terminal according to character size data of the original font; determining the composition direction of the subject text; If the typesetting direction of the target text is horizontal, a first difference is determined, which is a difference between a character width of the target text in the original font and a character width of the target text in the first font; if the first difference is a positive value, an abscissa value of a character of the target text is adjusted; if the first difference is a negative value, a shrinking process is performed on the character of the target text; If the typesetting direction of the target text is vertical, determining a second difference which is a difference between the character height of the target text in the original font and the character height of the target text in the first font, adjusting the ordinate value of the character of the target text if the second difference is a positive value, and performing a shrinking process on the character of the target text if the second difference is a negative value.

[0107] In one example, the first typesetting module typesets the target text to be displayed in a first font supported by the first terminal according to character size data of the original font; determining the composition direction of the subject text; performing a first enlargement / reduction process on characters of the target text in the first font so that a character width of the target text in the first font matches a character width of the target text in the original font, if the composition direction of the target text is horizontal; When the typesetting direction of the target text is vertical, a second enlargement / reduction process is performed on characters of the target text in the first font so that the character height of the target text in the first font matches the character height of the target text in the original font.

[0108] In one example, the first typesetting module typesets the target text to be displayed in a first font supported by the first terminal according to character size data of the original font; determining the composition direction of the subject text; If the typesetting direction of the target text is horizontal, adjust the font size of the target text in a first font to a first font size, which is a font size whose character width of the target text in the first font is closest to that of the target text in the original font; after adjusting the font size of the target text to the first font size, determine a first difference, which is a difference between the character width of the target text in the original font and the character width of the target text in the first font; if the first difference is a positive value, adjust the horizontal coordinate value of the character of the target text; if the first difference is a negative value, perform a shrinking process on the character of the target text; If the typesetting direction of the target text is vertical, adjusting the font size of the target text in the first font to a second font size which is a font size whose character height of the target text in the first font is closest to that of the target text in the original font, and after adjusting the font size of the target text to the second font size, determining a second difference which is a difference between the character height of the target text in the original font and the character height of the target text in the first font, adjusting the ordinate values ​​of the characters of the target text if the second difference is a positive value, and performing a reduction process on the characters of the target text if the second difference is a negative value.

[0109] FIG. 5 is a schematic diagram of a hardware structure of an electronic device according to an embodiment.

[0110] As shown in FIG. 5, the electronic device 800 includes a processor 801 and a memory 802, the memory 802 being used to store an executable computer program, and the processor 801 being used to execute the computer program to perform a text typesetting method according to any of the method embodiments described above.

[0111] The electronic device 800 may be a computer, a mobile phone, a tablet, or other device.

[0112] <Computer-readable storage medium> An embodiment of the present invention further provides a computer-readable storage medium, which stores a computer program, which, when executed by a processor, performs a method for typesetting text according to any of the method embodiments described above.

[0113] The invention may be a system, method, and / or computer program product that may include a computer readable storage medium having computer readable program instructions thereon for causing a processor to implement aspects of the invention.

[0114] A computer readable storage medium may be a tangible device capable of holding and storing instructions for use by an instruction execution device. A computer readable storage medium may be, for example, but not limited to, an electronic storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing. Further non-exclusive examples of computer readable storage media include portable computer diskettes, hard disks, random access memories (RAM), read only memories (ROM), erasable programmable read only memories (EPROM or flash memory), static random access memories (SRAM), portable compact disk read only memories (CD-ROM), digital versatile disks (DVD), memory disks, floppy disks, physically encoded devices such as punch cards or groove embossed structures having instructions recorded thereon, or any suitable combination of the foregoing. A computer-readable storage medium, as used in the present invention, is not to be understood as being a transitory signal in itself, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through a waveguide or other transmission medium (e.g., light pulses passing through a fiber optic cable), or electrical signals transmitted through wires.

[0115] The computer readable program instructions described in the present invention can be downloaded from the computer readable storage medium to each computing / processing device or to an external computer or storage device via a network, such as the Internet, a local area network, a wide area network, a wireless network, or a combination thereof. The network may include copper transmission cables, optical transmission fibers, wireless transmissions, routers, firewalls, switches, gateway computers, edge servers, or a combination thereof. A network adapter card or network interface of each computing / processing device receives the computer readable program instructions from the network and transfers the computer readable program instructions within each computing / processing device for storage in the computer readable storage medium.

[0116] The computer readable program instructions for carrying out the operations of the present invention may be either assembler instructions, instruction set architecture (ISA), machine instructions, machine-dependent instructions, microcode, firmware instructions, state setting data, or source and object code written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Smalltalk, C++, and conventional procedural programming languages ​​such as the "C" programming language and similar programming languages. The computer readable program instructions may be executed entirely on the user's computer, partially on the user's computer, as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the latter case, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN). Alternatively, the connection may be made to an external computer (e.g., through the Internet using an Internet service provider). In some embodiments, electronic circuitry, such as a programmable logic circuit, a field programmable gate array (FPGA), or a programmable logic array (PLA), may execute computer readable program instructions to personalize the electronic circuitry by utilizing state information of the computer readable program instructions to carry out aspects of the present invention.

[0117] Aspects of the present invention are described herein with reference to flowchart illustrations, block diagrams, or combinations thereof of methods, apparatus (systems), and computer program products according to embodiments of the present invention. It will be understood that each block of the flowchart illustrations, block diagrams, or combinations thereof, and combinations of blocks in such flowchart illustrations, block diagrams, or combinations thereof, can be implemented by computer readable program instructions.

[0118] These computer readable program instructions may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the instructions are executed by the computer or other programmable data processing apparatus to produce means for implementing the functions / roles specified in one or more blocks of the flowcharts, block diagrams, or combinations thereof. These computer readable program instructions may also be stored in a computer readable medium that can instruct a computer, programmable data processing apparatus, or other device, or combinations thereof, to function in a particular manner, such that the computer readable medium having the instructions stored therein includes an article of manufacture that includes instructions that implement aspects of the functions / roles specified in one or more blocks of the flowcharts, block diagrams, or combinations thereof.

[0119] Computer readable program instructions may also be loaded into a computer, other programmable data processing apparatus, or other device and cause a sequence of operational steps to be performed on the computer, other programmable apparatus, or other device to generate a computer-implemented process, such that the instructions executed on the computer or other programmable apparatus or other device implement the functions / roles specified in one or more blocks of the flowcharts, block diagrams, or combinations thereof.

[0120] The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible system, method, and computer program product implementations according to various embodiments of the present invention. In this regard, each block in the flowcharts or block diagrams may represent a module, segment, or portion of an instruction, which includes one or more executable instructions for implementing a specified logical function. In some alternative implementations, the functions described in the blocks may occur out of the order described in the figures. For example, two blocks shown in succession may in fact be executed substantially simultaneously, and sometimes the blocks may be executed in the reverse order depending on the functionality involved. It will also be noted that each block in the block diagrams and / or flowchart diagrams, and combinations of blocks in the block diagrams and / or flowchart diagrams, may be implemented by a dedicated hardware-based system that performs the specified functions or operations, or may embody a combination of dedicated hardware and computer instructions. The equivalents of hardware implementations, software implementations, and combinations of software and hardware implementations are well known to those skilled in the art.

[0121] Although various embodiments of the present invention have been described above, the above description is illustrative, not exhaustive, and is not limited to each disclosed embodiment. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments. The terms used in the present invention are selected to best describe the principles, practical applications, or technical improvements beyond the technology found in the market, and to enable other skilled in the art to understand the embodiments disclosed in the present invention. The scope of the present invention is limited by the appended claims.

Claims

1. A text typesetting method applied to a plurality of collaboration terminals of a collaboration document, comprising: determining an original font used for target text in the collaboration document; determining whether a first terminal of the plurality of collaboration terminals supports the original font; the first terminal acquiring character size data of the original font when the first terminal does not support the original font; when the first terminal has successfully acquired character size data of the original font, displaying the target text in a first font supported by the first terminal; and typesetting the target text displayed in the first font on the first terminal based on character size data of the original font. A method for typesetting text, comprising:

2. The step of acquiring character size data of the original font by the first terminal includes: The method includes a step of: the first terminal acquiring character size data of the original font shared among the plurality of collaboration terminals by a second terminal, the second terminal being one of the plurality of collaboration terminals; 2. A method for typesetting text according to claim 1.

3. The step of acquiring character size data of the original font by the first terminal includes: querying a local cache of the first terminal for character size data of the original font; or acquiring character size data of the original font from a second terminal, the second terminal being a collaboration terminal that supports the original font among the plurality of collaboration terminals; 2. A method for typesetting text according to claim 1.

4. The step of acquiring character size data of the original font by the first terminal includes: querying a local cache of the first terminal for character size data of the original font; and if character size data of the original font is not found in a local cache of the first terminal, acquiring character size data of the original font from a second terminal, the second terminal being a collaboration terminal that supports the original font among the plurality of collaboration terminals.

2. A method for typesetting text according to claim 1.

5. The step of acquiring character size data of the original font from the second terminal by the first terminal includes: the first terminal broadcasting a font query request among the plurality of collaboration terminals to determine the second terminal; The first terminal transmits a font assistance request to the second terminal, and obtains character size data of the original font from the second terminal.

5. A method for typesetting a text according to claim 3 or 4.

6. The step of the first terminal broadcasting a font query request among the plurality of collaboration terminals to determine the second terminal includes: broadcasting a font query request among a plurality of collaboration terminals to determine collaboration terminals that support the original font as candidate terminals; If the number of the candidate terminals is 1, determine the candidate terminal as the second terminal; If the number of the candidate terminals is greater than one, determining the candidate terminal that satisfies a predetermined condition as the second terminal.

6. A method for typesetting text according to claim 5.

7. The predetermined condition is: A condition that the communication quality between the candidate terminal and the first terminal is the best; the number of font support requests received by the candidate terminal is the smallest; the number of font query requests sent by the candidate terminal is the smallest; 7. A method for typesetting text according to claim 6.

8. When the first terminal fails to acquire character size data of the original font, determining whether the first terminal supports a target font, the target font being a font determined from among candidate fonts by the multiple collaboration terminals based on a preset negotiation mechanism when none of the multiple collaboration terminals supports the original font, the candidate font being a font supported by any of the collaboration terminals; If the first terminal supports the target font, the first terminal displays the target text in the target font; a step of, when the first terminal does not support the target font, acquiring character size data of the target font from a third terminal, and displaying the target text in a second font supported by the first terminal, the third terminal being a collaboration terminal among the plurality of collaboration terminals that supports the target font; and the first terminal further comprises: typesetting the target text to be displayed in the second font based on character size data of the target font.

2. A method for typesetting text according to claim 1.

9. When none of the plurality of collaboration terminals supports the original font, the plurality of collaboration terminals determine a target font from among the candidate fonts based on a preset negotiation mechanism; determining, as the target font, a font supported by a collaboration terminal that transmits a font inquiry request first among the plurality of collaboration terminals; determining a score for each of the candidate fonts, and determining the candidate font with the highest score as the target font, wherein the score for each of the candidate fonts is determined based on a number of collaboration terminals that support the candidate font; 9. A method for typesetting text according to claim 8.

10. If the first terminal supports the original font, displaying the target text in the original font; the first terminal transmits character size data of the original font to a fourth terminal, the fourth terminal being a collaboration terminal that does not support the original font among the plurality of collaboration terminals; 2. A method for typesetting text according to claim 1.

11. the character size data of the original font includes a character width of the original font and a character height of the original font; The step of typesetting the target text to be displayed in the first font on the basis of character size data of the original font in the first terminal includes: determining a typesetting direction of the target text; If the typesetting direction of the target text is horizontal, a first difference is determined as a difference between a character width of the target text in the original font and a character width of the target text in the first font, and if the first difference is a positive value, an abscissa value of a character of the target text is adjusted, and if the first difference is a negative value, a shrinking process is performed on the character of the target text; determining a second difference between a character height of the target text in the original font and a character height of the target text in the first font when the typesetting direction of the target text is vertical, adjusting an ordinate value of a character of the target text when the second difference is a positive value, and performing a shrinking process on the character of the target text when the second difference is a negative value; 2. A method for typesetting text according to claim 1.

12. the character size data of the original font includes a character width of the original font and a character height of the original font; The step of typesetting the target text to be displayed in the first font on the basis of character size data of the original font in the first terminal includes: determining a typesetting direction of the target text; performing a first scaling process on characters of the target text in the first font such that a character width of the target text in the first font coincides with a character width of the target text in the original font when the typesetting direction of the target text is horizontal; and performing a second scaling process on characters of the target text in the first font when the typesetting direction of the target text is vertical writing, so that a character height of the target text in the first font matches a character height of the target text in the original font.

2. A method for typesetting text according to claim 1.

13. the character size data of the original font includes a character width of the original font and a character height of the original font; The step of typesetting the target text to be displayed in the first font on the basis of character size data of the original font in the first terminal includes: determining a typesetting direction of the target text; If the typesetting direction of the target text is horizontal, adjust a font size of the target text in a first font to a first font size, which is a font size whose character width of the target text in the first font is closest to that of the target text in the original font; after adjusting the font size of the target text to the first font size, determine a first difference, which is a difference between the character width of the target text in the original font and the character width of the target text in the first font; if the first difference is a positive value, adjust the abscissa value of a character of the target text; if the first difference is a negative value, perform a shrinking process on the character of the target text; if the typesetting direction of the target text is vertical writing, adjusting a font size of the target text in a first font to a second font size which is a font size in which a character height of the target text in the first font is closest to a character height of the target text in the original font; after adjusting the font size of the target text to the second font size, determining a second difference which is a difference between the character height of the target text in the original font and the character height of the target text in the first font; if the second difference is a positive value, adjusting an ordinate value of a character of the target text; if the second difference is a negative value, performing a shrinking process on the character of the target text.

2. A method for typesetting text according to claim 1.

14. A text typesetting device applied to a plurality of collaboration terminals of a collaboration document, comprising: a first determination module for determining an original font used for target text in the collaboration document; a second determination module for determining whether a first terminal of the plurality of collaboration terminals supports the original font; an acquisition module for acquiring character size data of the original font when the first terminal does not support the original font; a typesetting module for displaying the target text in a first font supported by the first terminal when the character size data of the original font is successfully acquired, and typesetting the target text displayed in the first font based on the character size data of the original font; 1. A text typesetting device comprising:

15. An electronic device including a memory and a processor, the memory being adapted to store a computer program, and the processor being adapted to execute the computer program to perform the method according to any one of claims 1 to 12.

1. An electronic device comprising:

16. A computer-readable storage medium storing a computer program, which, when executed by a processor, performs the method according to any one of claims 1 to 12. A computer-readable storage medium comprising:

Citation Information

Patent Citations

  • Method and system for displaying webpage applied in mobile terminal

    CN102663137A

  • Processor for allocating characters

    JP2001005985A

  • Information processing system, information management device, and communication program

    JP2013210724A

  • Information processing apparatus, information processing system, information processing method, and program

    JP2014146128A

  • System and method for independent font substitution of string characters

    US20090109227A1