Text composition

The method addresses font inconsistency in online collaboration documents by determining and adjusting character sizes to ensure consistent typesetting across devices, enhancing document aesthetics and user experience.

JP7782113B2Active Publication Date: 2025-12-09BEIJING KINGSOFT OFFICE SOFTWARE INC +1
View PDF 6 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

The inconsistency in typesetting of online collaboration documents across different devices due to the lack of a specific font, which complicates font installation and dissemination, affecting document aesthetics and viewing experience.

Method used

A method and device for typesetting text in collaboration documents that determines the original font, checks if it is supported, acquires character size data if not supported, and displays the text in a compatible font based on the acquired data to maintain consistency.

Benefits of technology

Ensures typesetting consistency across collaboration terminals by using a compatible font and adjusting character sizes, even when the original font is not available, thereby maintaining document aesthetics and user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 0007782113000001
    Figure 0007782113000001
  • Figure 0007782113000002
    Figure 0007782113000002
  • Figure 0007782113000003
    Figure 0007782113000003
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] An increasing number of applications are incorporating online collaborative document features, such as the ability for multiple users to simultaneously edit and view online documents. When one or more users view the same online document on different devices, the lack of a specific font can result in significant differences in the typesetting of the document across devices, potentially affecting the document's aesthetics and the consistency of the viewing experience. The typical solution is to install a corresponding font in the current environment. However, this method requires searching for, downloading, and installing the font, and the font may be paid for, making it difficult to widely disseminate and apply. Therefore, a new text typesetting method is needed. Summary of the Invention

[0003] The 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 applied 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, if the first terminal does not support the original font, acquiring character size data of the original font; the first terminal, when the character size data of the original font is successfully acquired, displays the target text in a first font supported by the first terminal; The first terminal includes a step of typesetting the target text 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 to a plurality of collaboration terminals for 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, the 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 implement 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 embodiments of the present invention are as follows: For a collaboration document created by multiple users online, if a collaboration terminal does not support the original font of the target text in the collaboration document, the collaboration terminal can display the target text using a first font supported by the collaboration terminal, and typeset the target text based on the character size data corresponding to the original font. This allows the collaboration terminal to maintain typesetting consistency with other collaboration terminals even when the original font is not available. The text typesetting method provided in the embodiments of the present invention is applicable to multi-user editing of online documents.

[0009] Other features and advantages of embodiments of the present invention will become apparent from the following detailed description of exemplary embodiments of the present invention, taken in conjunction with the accompanying drawings. [Brief explanation 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; [Figure 2] 1 is a flowchart of a text typesetting method according to an embodiment of the present invention; [Figure 3] FIG. 10 is a schematic diagram of character size data according to an embodiment of the present invention. [Figure 4] 1 is an exemplary diagram of a method for typesetting text according to an embodiment of the present invention; [Figure 5] 1 is a schematic diagram of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION OF THE INVENTION

[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 should be considered part of this specification, where appropriate.

[0015] In all examples shown and discussed herein, any particular values ​​should be construed as merely exemplary and not limiting, and therefore 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, which includes multiple terminal devices that can communicate with each other via a network.

[0018] The terminal device may be, for example, an electronic device installed with an intelligent operating system (e.g., Android, IOS, Windows, Linux, etc.), including, but not limited to, a portable computer, a desktop computer, a mobile phone, a tablet, etc. The terminal device may include, 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 may include, but is not limited to, a central processing unit (CPU) or a microprocessor (MCU). The memory 1032 may include, but is not limited to, a read-only memory (ROM), a random access memory (RAM), a non-volatile memory such as a hard disk, etc. The interface device 1033 may include, 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 communication or wireless communication, and specific examples include 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. Furthermore, the configuration of the terminal device may include only some 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. After that, all selected collaborators and User A can view and collaboratively edit the collaboration document using their respective terminal devices. These terminal devices are collaboration terminals for the collaboration document.

[0020] In one embodiment of the present invention, an online multi-user collaboration function may be implemented based on a target application. Users can submit a collaboration document on the target application and view and collaboratively 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, log in to the account, and then use the online multi-user collaboration function. The target application running on the terminal device is a collaboration terminal application for 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, or a lite (lightweight) application. A native application is an application that can 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 downloading or installation, and can be directly searched for and used by the user, or scanned and used.

[0023] If the same account is registered in the target application on multiple terminal devices, each terminal device may be considered as one collaboration terminal. In other words, users with the same account can use two or more collaboration terminals to view and collaboratively edit the target text.

[0024] The online document collaboration system illustrated in FIG. 1 is merely illustrative and is not intended to limit the embodiments, applications, or uses of the present invention. Although multiple devices of a terminal device have been described, those skilled in the art will understand that the embodiments 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 embodiments of the present invention. How instructions control and operate a processor is well known in the art and will not be described in detail herein.

[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 of 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 portion of text in a 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 can be stored in 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, a font may be a font loaded into the operating system of a terminal device, a font loaded into a client (e.g., a browser or application) of the terminal device, a font stored on a server, or a font embedded in a document file. While a document file may incorporate a font, document files incorporating fonts typically have a relatively large amount of data. Furthermore, fonts loaded into the operating system of a terminal device, fonts loaded into a client of the terminal device, and fonts embedded in a document file are all fonts that the terminal device can support and may be collectively referred to as local fonts. Meanwhile, fonts stored on a server are referred to as server fonts or cloud fonts.

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

[0030] In an embodiment of the present invention, after determining the original font used in the target text, the first terminal checks whether the original font is included in all fonts supported by the first terminal. If the original font is not included in all fonts supported by the first terminal, the first terminal determines that the original font is not supported. 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), the first terminal determines that the original font is supported. Otherwise, the first terminal determines that the original font is not supported.

[0031] The fonts supported by the first terminal may be determined based on the 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 that font. Generally, various widely used font packages are pre-installed in the basic data packet of the terminal device's operating system or application, and one of the fonts is set as the default font. If a user wants to use a specific font, they need to download the corresponding font package 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, characters include, but are not limited to, letters and symbols. Characters include, but are not limited to, Chinese characters and alphabets. Symbols include, but are not limited to, punctuation marks, numeral 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 and character height of the original font, which are the width and height of a character in the target text in the original font state. For the same font, different characters can be designed to have the same or different sizes under the same font size. If all characters in the same font do not adopt the same size under the same font size, a mapping relationship between the character and the character width and height is established. In this way, the mapping relationship can be used as 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, when one of the plurality of collaboration terminals supports the original font, the collaboration terminal displays the target text in the original font and measures 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, when the first terminal does not support the original font, 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 referred to as the second terminal. The second terminal supports the original font. The process of determining the second terminal from among the 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. The next time 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 by querying the 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 by querying 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, obtaining 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 the next time it needs to use the font, it may directly read the character size data of the original font from the local cache.

[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 for a collaboration document, it broadcasts notification information saying "join collaboration." In response, when a terminal ends collaboration and is no longer a collaboration terminal for the collaboration document, it broadcasts notification information saying "end collaboration." In this way, collaboration terminals for a 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 saying "join collaboration" and the number of received notification information saying "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 query request among multiple collaboration terminals to determine the second terminal.

[0045] The step of the first terminal broadcasting the font query request among the plurality of 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 between it and the first terminal. For example, the candidate terminal with the shortest network delay between it and the first terminal may be determined as the candidate terminal with the best communication quality.

[0050] Condition b: The candidate terminal that has received the fewest font support requests. Since the candidate terminal that has received the fewest font support requests is relatively idle, 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, selecting it as the second terminal is advantageous for improving overall efficiency.

[0052] In one example, when a first terminal discovers that it does not support the original font, i.e., that the original font is not available locally on the first terminal, 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 first response information in response to the font query request sent from another collaboration terminal, it may determine that collaboration terminal as a second terminal.

[0053] In step S204, a font support 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 support 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 support request. For example, the second terminal performs a character measurement operation on the original font upon receiving the font support request to obtain the character size data of the original font.

[0055] In step S108, if the first terminal has successfully acquired the character size data of the original font, it 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: if the typesetting direction of the target text is horizontal, a 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; the smaller the absolute value of the first difference, 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. Furthermore, 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 with 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 scaling 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. Also, when the typesetting direction of the target text is vertical, a second scaling 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, scaling of the characters 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 be obtaining character size data corresponding to the 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 composition 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 horizontal coordinate 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] When the layout direction of the target text is vertical writing, 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. When the second difference is a positive value, the vertical coordinate value of the characters of the target text is adjusted. When the second difference is a negative value, a reduction process is performed on the characters of the target text.

[0066] In Example 2, the reduction process of the characters may be realized by adjusting the font size.

[0067] Hereinafter, the case where the layout direction of the target text is horizontal writing will be described as an example.

[0068] As shown in FIG. 3(a), the character width of each character of the target text in the original font is approximately W1. As shown in FIG. 3(b), the character width of each character of 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] When 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 it is necessary to adjust the coordinate value of the horizontal axis of each character of the target text in the first font.

[0070] As shown in FIG. 4, the target text is one-line content and contains 10 characters "Good morning. The weather is nice today". Under the original font, the coordinate values of the horizontal axis of the 10 characters are X1, X2,..., X , 10 , n , , , 10 , n , and after layout, the coordinate values of the horizontal axis of the 10 characters are X1’, X2’,..., X 10 ’. Thus, the following formula is obtained. 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. Adjusting the coordinate values ​​may result in overlapping characters. Therefore, the font size of the target text displayed in the first font on the first terminal needs to be reduced without changing the original position (coordinate value) of the 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, then the font size of the content is adjusted to U2, where U2 = R1 * U1. Here, font sizes in this specification are in points, which are a measurement method for 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 Figure 3(a), the character height of each character in the original font is approximately H1. As shown in Figure 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, and the ordinate values ​​of the characters in each line are the same. The ordinate values ​​of the characters in the first to Mth lines are Y1, Y2, ..., Y M After typesetting, the vertical coordinate values ​​of the characters from the 1st line to the Mth line are Y1', Y2', ..., Y M ', we obtain the following equation: 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 from this, adjusting the vertical coordinate value of each character in 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 the character height of the original font, and adjusting the coordinate values ​​may cause characters to overlap, so the font size of the target text displayed in the first font on the first terminal needs to be reduced. 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, without changing the position (coordinate values) of the original target text in the first font. 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 the 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, a first difference is determined, where the first difference 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 horizontal coordinate 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 reduced.

[0084] That is, 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 that 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, the character of the target text is reduced.

[0086] That is, when the typesetting direction of the target text is vertical writing, after the first terminal adjusts the font size of the target text in the first font to the second font size, if the character height is still larger than the character height in the original font, the font size is decreased by 1 point to shrink the characters and avoid the situation where the characters overlap each other.

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

[0088] After the first terminal typesets the target text displayed in the first font, the typesetting situation of the target text displayed in the first font in the first terminal becomes close to the typesetting situation of the target text displayed in the original font. As shown in FIG. 4, for the target text "Good morning. The weather is nice today", when comparing the typesetting situation in the original font with the typesetting situation in the first font, the total width of this content in the original font is wider. Through the typesetting in step S108, the total width of this content displayed in the first font on the first terminal becomes close to the total width of this content in the original font. In this way, since the content in the same line in the original font is changed to be displayed in the first font and thus there is no line break, and further, the problem that the collaboration terminal cannot synchronize the collaboration due to the difference in typesetting can be avoided.

[0089] The beneficial effects of the embodiments of the present invention are as follows. For a collaboration document with collaboration by multiple users online, when a certain collaboration terminal does not support the original font of the target text in the collaboration document, the target text is displayed using the first font supported by the collaboration terminal, and based on the character size data corresponding to the original font, the target text displayed on the collaboration terminal can be typeset. Thereby, even when there is no original font, the collaboration terminal can maintain the consistency in typesetting with other collaboration terminals.

[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, it is determined whether the first terminal supports the target font. The target font is a font determined from among candidate fonts based on a preset negotiation mechanism by the multiple collaboration terminals 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 sent the font query request may be determined as the target font. The collaboration terminal that first sent 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, where the third terminal is a collaboration terminal that supports the target font. Here, the second font is a font that most closely matches 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 by which the first terminal obtains character size data of the target font from the third terminal is similar to the process by which the first terminal obtains character size data of the original font from the second terminal described above.

[0095] The beneficial effects of the embodiment of the present invention are as follows: For a collaboration document of online collaboration by multiple users, if all collaboration terminals do not support the original font of the target text in the collaboration document, one 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, thereby allowing each collaboration terminal to 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 step of: the first terminal displays the target text in the original font and transmitting 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 support request from the fourth terminal, it 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 for 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; 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 multiple collaboration terminals by the second terminal.

[0100] In one example, the step of acquiring character size data of the original font by the first terminal includes a step of querying a local cache of the first terminal for the character size data of the original font, or a step of 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.

[0101] In one example, the step of acquiring 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, acquiring 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 plurality of collaboration terminals.

[0102] In one example, the first acquisition module: 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 plurality of collaboration terminals to determine the second terminal. 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 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 formatting module; the third determination module is used to determine whether the first terminal supports the target font when the first terminal fails to acquire character size data of the original font, and the target font is 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, and the candidate font is a font supported by any of the collaboration terminals; the second obtaining module is used to obtain 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 among the multiple collaboration terminals that supports the target font.

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

[0106] In one example, the first typesetting module may typeset the target text to be displayed in a first font supported by the first terminal based on character size data of the original font: determining the typesetting direction of the subject text; If the typesetting direction of the target text is horizontal, determine a first difference, 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, 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, determining a second difference 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, adjusting the ordinate values ​​of the characters of the target text if the second difference is a positive value, and performing a shrinking process on the characters of the target text if the second difference is a negative value.

[0107] In one example, the first typesetting module may typeset the target text to be displayed in a first font supported by the first terminal based on character size data of the original font: determining the typesetting direction of the subject text; If the composition direction of the target text is horizontal, a first scaling process is performed on 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; When the typesetting direction of the target text is vertical, a second scaling 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.

[0108] In one example, the first typesetting module may typeset the target text to be displayed in a first font supported by the first terminal based on character size data of the original font: determining the typesetting 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 that is the 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 that 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, 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 that is the 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; after adjusting the font size of the target text to the second font size, determining a second difference that 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, adjusting the ordinate values ​​of the characters of the target text; and if the second difference is a negative value, performing a shrinking process on the characters of the target text.

[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 is used to store an executable computer program, and the processor 801 is used to execute the computer program to implement the text typesetting method according to any of the above method embodiments.

[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, and when the computer program is executed by a processor, performs a text typesetting method according to any of the above method embodiments.

[0113] The present 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 present 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 specific, non-exclusive examples of computer-readable storage media include portable computer diskettes, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), static random access memory (SRAM), portable compact disc read-only memory (CD-ROM), digital versatile disks (DVDs), memory disks, floppy disks, physically encoded devices such as instruction-recorded punch cards or groove-embossed structures, or any suitable combination of the foregoing. Computer-readable storage media, as used herein, is not understood to be transitory signals per se, 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 fiber optic cable), or electrical signals transmitted through wires.

[0115] The computer-readable program instructions described herein can be downloaded from a computer-readable storage medium to each computing / processing device or to an external computer or external 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 fiber transmissions, wireless transmissions, routers, firewalls, switches, gateway computers, edge servers, or a combination thereof. A network adapter card or network interface in 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 on a computer-readable storage medium.

[0116] Computer-readable program instructions for carrying out the operations of the present invention may be either assembler instructions, instruction set architecture (ISA), machine language 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 and 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 standalone 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., over 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 implement 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 invention. It will be understood that each block of the flowchart illustrations, block diagrams, or combinations thereof, and combinations of blocks in the 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, when executed by the computer or other programmable data processing apparatus, 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 direct 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 instructions stored therein includes an article of manufacture containing 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 a flowchart or block diagram may represent a module, segment, or portion of an instruction, which comprises 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 concurrently, or 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 function or operation, 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 and 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 have been selected to best explain the principles, practical applications, or technical improvements beyond those found in the marketplace of the present embodiments, and to enable others 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; If the first terminal does not support the original font, acquiring character size data of the original font; the first terminal displays the target text in a first font supported by the first terminal if the character size data of the original font is successfully acquired; the first terminal typesets the target text to be displayed in the first font based on character size data of the original font; If the first terminal fails to acquire the character size data of the original font, determining whether the first terminal supports a target font, where the target font is a font determined from among candidate fonts based on a preset negotiation mechanism by the multiple collaboration terminals 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; If the first terminal supports the target font, it displays the target text in the target font; or a step in which, when the first terminal does not support the target font, the first terminal acquires character size data of the target font from a third terminal and displays 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 typesets the target text to be displayed in the second font based on character size data of the target font; The first font is a font supported by the first terminal that most closely matches character size data of the original font; The second font is the font supported by the first terminal that most closely matches the target font. A method for typesetting text, characterized in that:

2. The step of acquiring character size data of the original font by the first terminal includes: the first terminal acquires 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. The method of claim 1, wherein the text is typeset in a format that is more suitable for the text than the format that is more suitable for the text.

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. The method of claim 1, wherein the text is typeset in a format that is more suitable for the text than the format that is more suitable for the text.

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 the character size data of the original font is not found in a local cache of the first terminal, acquiring 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 plurality of collaboration terminals.

2. The method of claim 1, wherein the text is typeset in a format that is more suitable for the text than the format that is more suitable for the text.

5. The step of the first terminal acquiring character size data of the original font from the second terminal includes: the first terminal broadcasting a font query request among the plurality of collaboration terminals to determine the second terminal; the first terminal sending a font support request to the second terminal and obtaining character size data of the original font from the second terminal; 5. A method for typesetting text according to claim 3 or claim 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 condition that the candidate terminal receives the fewest number of font support requests; the candidate terminal has sent the fewest number of font query requests; 7. A method for typesetting text according to claim 6.

8. When none of the plurality of collaboration terminals supports the original font, the plurality of collaboration terminals determine a target font from among candidate fonts based on a preset negotiation mechanism; determining, as the target font, a font supported by a collaboration terminal that first transmitted a font inquiry request 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 the number of collaboration terminals that support the candidate font; 2. The method of claim 1, wherein the text is typeset in a format that is more suitable for the text than the format that is more suitable for the text.

9. If the first terminal supports the original font, displaying the target text in the original font; the first terminal transmitting character size data of the original font to a fourth terminal, the fourth terminal being a collaboration terminal among the plurality of collaboration terminals that does not support the original font; 2. The method of claim 1, wherein the text is typeset in a format that is more suitable for the text than the format that is more suitable for the text.

10. 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 on the first terminal includes: determining a typesetting direction of the target text; If the typesetting direction of the target text is horizontal, determine a first difference, 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, 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, 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, adjusting ordinate values ​​of characters of the target text if the second difference is a positive value, and performing a shrinking process on the characters of the target text if the second difference is a negative value; 2. The method of claim 1, wherein the text is typeset in a format that is more suitable for the text than the format that is more suitable for the text.

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 on the first terminal includes: determining a typesetting direction of the target text; when the typesetting direction of the target text is horizontal, performing a first scaling 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; and when the typesetting direction of the target text is vertical writing, performing a second scaling process on characters of the target text in the first font 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. The method of claim 1, wherein the text is typeset in a format that is more suitable for the text than the format that is more suitable for the text.

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 on the first terminal includes: determining a typesetting direction of the target 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 in the target text in the first font is closest to the character width in 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 in the target text in the original font and the character width in the target text in the first font; if the first difference is a positive value, adjust the abscissa values ​​of the characters in the target text; if the first difference is a negative value, perform a shrinking process on the characters in the target text; and 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 whose character height 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 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 ordinate values ​​of characters of the target text; and if the second difference is a negative value, performing a shrinking process on the characters of the target text.

2. The method of claim 1, wherein the text is typeset in a format that is more suitable for the text than the format that is more suitable for the text.

13. A text typesetting device applied to a plurality of collaboration terminals for 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; a third determination module, used to determine whether the first terminal supports a target font when the first terminal fails to acquire character size data of the original font, the target font being a font determined from among candidate fonts based on a negotiation mechanism preset by the multiple collaboration terminals when none of the multiple collaboration terminals supports the original font, the candidate font being a font supported by any of the collaboration terminals; a second obtaining module, used for obtaining character size data of the target font from a third terminal when the third determining module determines that the first terminal does not support the target font; a second typesetting module, which 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, or 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, wherein the third terminal is a collaboration terminal that supports the target font among the plurality of collaboration terminals; The first font is a font supported by the first terminal that most closely matches character size data of the original font; The second font is the font supported by the first terminal that most closely matches the target font. A text typesetting device characterized by:

14. An electronic device including a memory and a processor, wherein the memory is used to store a computer program, and the processor is used to execute the computer program to perform the method according to any one of claims 1 to 12. An electronic device characterized by:

15. A computer-readable storage medium storing a computer program, which, when executed by a processor, performs the method of 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

  • Document editing device to check whether the font applied to the document is a supported font and operating method thereof

    KR1020210060808A