WO2023024376A1 - 文本的排版 - Google Patents
文本的排版 Download PDFInfo
- Publication number
- WO2023024376A1 WO2023024376A1 PCT/CN2021/142042 CN2021142042W WO2023024376A1 WO 2023024376 A1 WO2023024376 A1 WO 2023024376A1 CN 2021142042 W CN2021142042 W CN 2021142042W WO 2023024376 A1 WO2023024376 A1 WO 2023024376A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- font
- original
- character
- target text
- width
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Ceased
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/10—Text processing
- G06F40/103—Formatting, i.e. changing of presentation of documents
- G06F40/109—Font handling; Temporal or kinetic typography
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/10—Text processing
- G06F40/103—Formatting, i.e. changing of presentation of documents
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/10—Text processing
- G06F40/103—Formatting, i.e. changing of presentation of documents
- G06F40/106—Display of layout of documents; Previewing
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/10—Text processing
- G06F40/166—Editing, e.g. inserting or deleting
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Definitions
- the present disclosure relates to the field of computer technology, and more specifically, to a method and device for text typesetting, electronic equipment, and a storage medium.
- An object of the embodiments of the present disclosure is to provide a new technical solution for text typesetting, so as to maintain the consistency between document typesetting and original typesetting in the case of missing fonts.
- a text typesetting method includes: determining the original font used by the target text; determining whether the local application supports the original font; if the local application does not support the original font, acquiring character measurement data of the original font; displaying the target text in the first font supported by the local application; and performing typesetting on the displayed target text according to the character measurement data of the original font.
- a text typesetting method includes: receiving the font identification of the original font of the target text sent by the terminal device; querying the character measurement data of the original font according to the font identification of the original font; sending the character measurement data of the original font to the terminal A device for the terminal device to typesetting the target text displayed in the first font supported by the local application of the terminal device according to the character measurement data of the original font.
- a text typesetting device includes: a first determination module, configured to determine the original font used by the target text; a second determination module, configured to determine whether the local application supports the original font; an acquisition module, configured to determine if the local application does not support the original font.
- the typesetting module is configured to use the first font supported by the local application of the terminal device to display the target according to the character measurement data of the original font
- the text is typeset.
- a text typesetting device includes: a receiving module, configured to receive the font identifier of the original font of the target text sent by the terminal device; a query module, configured to query the character measurement data of the original font according to the font identifier of the original font; a sending module , used to send the character measurement data of the original font to the terminal device, so that the terminal device can display the target text with the first font supported by its local application and perform the target text according to the character measurement data of the original font Typesetting.
- an electronic device including a memory and a processor.
- the memory is used to store the computer program; the processor is used to execute the computer program, so as to realize the method according to the first aspect or the second aspect of the present disclosure.
- a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the method according to the first aspect of the present disclosure or the present invention is implemented.
- the disclosed method of the second aspect is also provided.
- An advantageous effect of the embodiments of the present disclosure is that if the local application does not support the original font of the target document, the local application uses the first font it supports to display the target text and typeset the target text according to the character measurement data corresponding to the original font, so that Local applications can still maintain the consistency of document typesetting and original typesetting in the absence of original fonts.
- FIG. 1 is a schematic diagram of a document processing system provided by an embodiment of the present disclosure
- Fig. 2 is a method flowchart of a text typesetting method provided by an embodiment of the present disclosure
- FIG. 3(a) and FIG. 3(b) are schematic diagrams of character measurement data provided by embodiments of the present disclosure.
- Fig. 4 is an example diagram of a text typesetting method provided by an embodiment of the present disclosure.
- FIG. 5 is a flow chart of a text typesetting method provided by an embodiment of the present disclosure.
- FIG. 6 is a schematic diagram of a hardware structure of an electronic device according to an embodiment of the present disclosure.
- Fig. 7 is a schematic diagram of a hardware structure of a server according to an embodiment of the present disclosure.
- Fig. 1 is a block diagram of a document processing system provided by an embodiment of this specification.
- the document processing system includes a server 101 and a terminal device 103 , and the server 101 and the terminal device 103 can communicate through a network 102 .
- the configuration of the server 101 may include, but not limited to, a processor 1011 , a memory 1012 , an interface device 1013 , a communication device 1014 , an input device 1015 , and an output device 1016 .
- the processor 1011 may include, but is not limited to, a central processing unit CPU, a microprocessor MCU, and the like.
- the memory 1012 may include, but is not limited to, ROM (Read Only Memory), RAM (Random Access Memory), nonvolatile memory such as a hard disk, and the like.
- the interface device 1013 may include, but not limited to, a USB interface, a serial interface, a parallel interface, and the like.
- the communication device 1014 is capable of, for example, wired communication or wireless communication, which may specifically include WiFi communication, Bluetooth communication, 2G/3G/4G/5G communication, and the like.
- the input device 1015 includes, but is not limited to, a keyboard, a mouse, a touch screen, a microphone, and the like.
- the output device 1016 includes, but is not limited to, a display screen, a speaker, and the like.
- the configuration of the server 101 may also include only some of the above-mentioned devices.
- the terminal device 103 may be, for example, an electronic device installed with a smart operating system (such as Android, IOS, Windows, Linux, etc.), including but not limited to a portable computer, a desktop computer, a mobile phone, a tablet computer, and the like.
- the configuration of the terminal device 103 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 processor) 1035, a display device 1036, an input device 1037, a speaker 1038, a microphone 1039, and camera 1030.
- the processor 1031 includes, but is not limited to, a central processing unit CPU, a microprocessor MCU, and the like.
- the memory 1032 includes, but is not limited to, ROM (Read Only Memory), RAM (Random Access Memory), nonvolatile memory such as a hard disk, and the like.
- the interface device 1033 includes, but is not limited to, a USB interface, a serial interface, a parallel interface, and the like.
- the communication device 1034 is capable of, for example, wired communication or wireless communication, which may specifically include WiFi communication, Bluetooth communication, 2G/3G/4G/5G communication, and the like.
- GPU 1035 is used for image processing.
- the display device 1036 includes, but is not limited to, a liquid crystal screen, a touch screen, and the like.
- the input device 1037 includes, but is not limited to, a keyboard, a mouse, a touch screen, and the like.
- the configuration of the terminal device 103 may also include only some of the above-mentioned devices.
- the user can open the target text through the terminal device 103 and perform typesetting and editing on the target text.
- the local application is, for example, document editing software, instant messaging software, office software, browser, and the like.
- the user pre-registers an account on the local application, and the user can use the typesetting method provided by the embodiment of the present disclosure after logging into the account.
- the local application is an application that can run on the terminal device, such as a native application, a web application, a hybrid application, a light application, and the like.
- Native applications refer to applications that can run directly on the current operating system.
- a web application refers to a web application that needs to be run in a browser.
- a hybrid application can be a combination of a native application and a web application, usually a native application with an embedded browser.
- a light application is an application that can be used without downloading and installing. Users can search and use it immediately or directly scan the code to use it.
- FIG. 1 The document processing system shown in FIG. 1 is merely illustrative and in no way implies any limitation on the embodiments of the present description, their application or use.
- a server may only involve a processor, a memory, and a communication device
- a terminal device may only involve a processor, a memory, a communication device, an input device, and a display screen.
- Those skilled in the art can design instructions according to the solutions disclosed in the embodiments of this specification. How the instruction controls the processor to operate is a well-known technology in the art, so it will not be described in detail here.
- the embodiment of the present disclosure provides a text typesetting method.
- the method includes steps S102-S108. Steps S102-S108 can be implemented by a terminal device.
- Step S102 determining the original font used by the target text.
- the target text may be any part of text in the document.
- the terminal device obtains the original font information of the target text from the document, so as to determine the original font used by the target text.
- the original font information can be stored in the document data of the document.
- the font may include the font loaded in the operating system of the terminal device, the font loaded in the client (such as a browser or application terminal, etc.) of the terminal device, or the font stored in the server, or it may be Fonts carried in document files.
- the document file can carry fonts, but the document files carrying fonts usually have a relatively large amount of data.
- the fonts loaded in the operating system of the terminal device, the fonts loaded in the client of the terminal device, and the fonts carried in the document file all belong to the fonts that can be supported by the local application of the terminal device, and can be collectively referred to as local fonts.
- the fonts stored in the server can be called server fonts or cloud fonts.
- Step S104 determine whether the local application supports the original font.
- the original font used by the target text After the original font used by the target text is determined, it is checked whether the original font is included in all fonts supported by the local application, and if not, it is determined that the original font is not supported by the local application.
- the fonts supported by a local application can be determined according to its installed font package. In an example, if the local application installs a font package of a certain font, it means that the local application supports the font. Generally speaking, the basic data package of the local application will have a variety of widely used font packages pre-installed and one of the fonts can be set as the default font. If the user wants to use some special fonts, you need to Download the corresponding font package separately. For example, if the original font is loaded in the operating system or the local application of the terminal device, or the original font is stored in the target text, it is considered that the local application supports the original font; otherwise, the local application does not support the original font.
- Step S106 if the local application does not support the original font, acquire character measurement data of the original font.
- characters referred to in the embodiments of the present disclosure include words and symbols, and symbols include but not limited to punctuation marks, numeral symbols, mathematical symbols, special symbols, etc., and words include but not limited to Chinese characters, letters, and the like.
- the character measurement data of the font includes the height and width of the character.
- the character measurement data of the 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 the characters in the target text in the state of the original font.
- the sizes of different characters may be designed to be the same or different. If all the characters of the same font do not use the same size under the same font size, then establish a mapping relationship between the characters under the font size and the width and height of the characters. In this way, the mapping relationship can be used as the character measurement data of the corresponding font, and the width and height of each character at the corresponding font size can be found out according to the mapping relationship.
- the character measurement data also includes a rise and fall value of the character.
- Fig. 3(a) and Fig. 3(b) for the same Chinese character "Zao", two different fonts have different widths and heights, and different ascending and descending values under the same font size. Both the width and height of the font shown in Fig. 3(b) are smaller than that of Fig. 3(a).
- the elevation value of the font shown in Fig. 3(a) is 0, that is, the font has no elevation relative to the baseline.
- the elevation value of the font shown in Fig. 3(b) is a positive value, that is, the font has an elevation relative to the baseline. If the font's lift value is a negative value, it means that the font has a drop relative to the baseline.
- the character measurement data may also include other features used to describe the position and/or size of the character, which is not limited herein.
- the character measurement data of the font may be obtained by measuring the characters (eg, may specifically be image models of the characters).
- the target text is displayed in a certain font in advance, and the character measurement data of the target text in the font is measured, so as to obtain the character measurement data of the font.
- the server may pre-store character measurement data of various fonts and font sizes.
- the terminal device obtains the character measurement data of the original font, which may be to query the character measurement data corresponding to the original font in a local cache of the terminal device.
- the terminal device obtains the character measurement data of the original font, which may be: firstly query the character measurement data of the original font in the local cache of the terminal device, and if the character measurement data of the original font cannot be queried in the local cache to get character measurements for the original font from the server.
- the terminal device can store it in the local cache, so that when the font needs to be used next time, it can directly read the font from the local cache Character measurement data for .
- Step S108 displaying the target text in the first font supported by the local application and typesetting the target text according to the character measurement data of the original font.
- the terminal device displays the target text in the first font according to the original font size of the target text, and typesets the target text displayed in the first font according to the character measurement data of the original font.
- the method may further include a step of confirming the first font.
- the terminal device selects the first font that matches the original font from all the fonts supported by the local application. An example is given below:
- Example 1 of determining the first font selecting the first font matching the original font from all the fonts supported by the local application may include steps S202-S206.
- Step S202 obtaining a list of replacement fonts of the original font.
- the matching degree between other fonts and the font is detected in advance, and the font whose matching degree reaches the matching degree threshold is selected as the replacement font of the font.
- the matching degree between two fonts may be determined according to the character measurement data of the two fonts.
- a replacement font list can be established according to its replacement font, and the replacement fonts in the replacement font list are sorted according to the matching degree from high to low.
- the terminal device can obtain the replacement font list of each font from the server.
- font A is an example to illustrate how to determine the matching degree between font B and font A:
- the character C may be a single character, or a string composed of multiple characters.
- the matching degree between font B and font A is determined according to the absolute value of the first difference, wherein the greater the absolute value of the first difference, the lower the matching degree between font B and font A, and the first difference The smaller the absolute value of , the higher the match between font B and font A.
- the matching degree between font B and font A is determined according to the absolute value of the second difference, wherein the greater the absolute value of the second difference, the lower the matching degree between font B and font A, and the second difference The smaller the absolute value of , the higher the match between font B and font A.
- the sum of the absolute value of the first difference and the absolute value of the second difference is calculated, and the matching degree between font B and font A is determined according to the sum, wherein the larger the sum, the greater the sum of font B and font A.
- Step S204 determining candidate fonts from the replacement fonts in the replacement font list, where the candidate fonts are fonts supported by the local application.
- Step S206 determining the candidate font with the highest matching degree with the original font as the first font.
- the candidate fonts supported by the local application are screened out from the substitute fonts in the substitute font list, and then the candidate font that best matches the original font is selected from the candidate fonts supported by the local application (for example, in the aforementioned
- the top candidate font in the replacement font list sorted from high to low) is used as the first font.
- Using the candidate fonts supported by the local application in the replacement font list to determine the first font does not require the terminal device to perform complicated calculations, which is more convenient and faster.
- Example 2 of determining the first font selecting the first font matching the original font from all fonts supported by the local application may include steps S302-S304.
- Step S302 determining the character type of the target text.
- the character types include the first type and the second type.
- the first type means that the characters of the target text are square characters such as Chinese characters, and the width and height of different Chinese characters are basically the same.
- the second type refers to that the characters of the target text include letters, Roman characters, Mongolian, or Arabic characters or a mixture of multiple languages, and the width and height of these characters may be inconsistent.
- Step S304 according to the preset rule associated with the character type of the target text, select the first font matching the original font from all the fonts supported by the local application.
- the first font is determined according to a rule corresponding to the character type of the target text.
- the following uses examples 3, 4, 5 and 6 to illustrate.
- Example 3 of determining the first font selecting the first font matching the original font from all fonts supported by the local application may include steps S402-S406.
- Step S402. Obtain character measurement data of a candidate font, where the candidate font is a font supported by the local application.
- Step S404 determining the typesetting direction of the target text.
- Step S406 if the typesetting direction of the target text is horizontal typesetting, determine the candidate font whose character width is closest to that of the original font as the first font.
- the typesetting direction of the target text is vertical typesetting, the candidate font whose character height is closest to that of the original font is determined as the first font.
- the typesetting direction of the target text is horizontal typesetting, calculate the difference between the character width of the characters in the target text under the original font and the character width under the candidate font as the first difference, the absolute value of the first difference The smaller the value, the closer the character width of the candidate font is to the character width of the original font, and the candidate font with the smallest absolute value of the first difference is selected as the first font.
- the typesetting direction of the target text is vertical typesetting
- Example 3 is applicable to the case where the character type of the target text is the first type and/or the second type. That is to say, if the target text contains only Chinese characters, or if the target text contains letters and Roman characters, the method of Example 3 can be applied to determine the first font.
- Example 4 of determining the first font selecting the first font matching the original font from all the fonts supported by the local application may include steps S502-S508.
- Step S502 acquiring font attributes of the original font and font attributes of the candidate font, where the candidate font is a font supported by the local application.
- the font properties of a font refer to the inherent properties of the font itself, which can reflect the style of the font.
- the font properties of the font may include one or more of font thickness, blackening, and slant.
- the blackening degree of the font includes two attribute values of “with blackening” and “without blackening”.
- two attribute values including “with tilt” and “without tilt” are included.
- the font attributes of “Song Type” are: the thickness is “thin”, the blackening level is “no blackening”, The inclination degree is “no inclination”; the font properties of “Chinese thin black” are: the thickness is “thin”, the blackening degree is “increased black”, and the inclination degree is “no inclination”; The font properties are: the thickness is “thick”, the blackening is “blackening”, and the inclination is “no inclination”.
- the font properties of “Times New Roman” are: Thickness is “Thin”, Blackening is “No Blackening”, Slant is “No Slant” ";
- the font properties of "Forte” are: the thickness is “thick”, the blackening is “blackening”, and the inclination is “slanting”.
- Step S504 determining a candidate font whose font attribute is the same as that of the original font as the target font, and obtaining character measurement data of the target font.
- the font properties of the font only include the thickness of the font. If the candidate font and the original font are both "thick”, or both “regular”, or both “thin”, then the candidate font and the original font are considered properties are the same.
- the font properties of a font include font thickness, blackening, and slant. If the candidate font and the original font have the same attribute values in the three aspects of thickness, blackening, and slant, the candidate font is considered to be The attributes of the candidate font and the original font are the same.
- Step S506 determining the typesetting direction of the target text.
- Step S508 if the typesetting direction of the target text is horizontal typesetting, determine the target font whose character width is closest to that of the original font as the first font.
- the typesetting direction of the target text is vertical typesetting, the target font whose character height is closest to that of the original font is determined as the first font.
- step S508 may be similar to the aforementioned step S406, and will not be described in detail here.
- Example 4 is applicable to the case where the character type of the target text is the first type and/or the second type. That is to say, if the target text contains only Chinese characters, or if the target text contains letters and Roman characters, the method of Example 4 can be applied to determine the first font.
- the candidate fonts whose font attributes are different from those of the original font are filtered out, and the candidate fonts whose font attributes are the same as those of the original font are reserved as the target fonts, and based on the characters of the original font
- the measurement data confirms the first font in the target font, so that the style of the selected first font is basically consistent with the style of the original font, so that the target text displayed with the first font supported by the local application is consistent with the original font
- the rendering style of the target text is more similar.
- Example 5 of determining the first font, according to the preset rules associated with the character type of the target text, select the first font that matches the original font from all the fonts supported by the local application which may be: the terminal device selects the candidate font The font ID of the font is sent to the server for the server to determine the first font from the candidate fonts according to the font attributes of the original font and the width of the preset character string under the original font; then, the server sends the font ID of the first font to the terminal For the device, the terminal device receives the font identifier of the first font from the server.
- the font identifier may be a name or number used to identify the font.
- the server obtains the font attribute of the original font and the width of the preset character string under the original font, and determines the first font from the candidate fonts according to the font attribute of the original font and the width of the preset character string under the original font.
- the candidate font is a font supported by the local application
- the preset character string includes a plurality of different preset characters.
- the preset characters in the preset character string should be representative characters in either of character width or character height. For example, select any Chinese character and "w”, “z”, and “i” with representative widths in English to form a preset string, where "w", "z", and “i” represent three different widths English characters, the preset character string can be " ⁇ WwZzIi".
- Examples 5 and 6 are applicable to the case where the character type of the target text is the second type. That is to say, in the case that the target text includes characters such as letters, Roman characters, Mongolian, or Arabic, or is a mixture of multiple languages, the methods of Examples 5 and 6 can be applied to determine the first font. For example, when the character type of the target text is alphabetic or multilingual (for example, the target text contains both Chinese content and English content, or the target text contains both Chinese content and Japanese content), Example 5 can be applied 6. The way to determine the first font. Determining the first font based on the width of the preset character string is suitable for the case where different characters have different character widths, and the amount of calculation is small, which is more efficient and faster.
- candidate fonts include default fonts and non-default fonts supported by the native application. Default fonts are preset for local applications, and the default fonts will be set when the terminal device installs the application. Users can modify the default fonts according to their personal preferences.
- Determining the first font from the candidate fonts according to the font attributes of the original font and the width of the preset character string under the original font may include steps S602-S604.
- Step S602 if the font attributes of the default font supported by the local application and the original font are the same, and the width of the preset character string under the default font and the width of the preset character string under the original font are similar to the preset standard, the default The font is determined as the first font. Otherwise, execute step S604.
- determining whether the similarity between the width of the preset character string in the default font and the width of the preset character string in the original font meets a preset standard may include steps S6022-S6026.
- Step S6022 Determine the difference between the width of the preset character string in the default font and the width of the preset character string in the original font as the fourth difference.
- Step S6024 Determine the ratio of the absolute value of the fourth difference to the width of the preset character string in the original font as the first ratio.
- Step S6026 if the first ratio is less than or equal to the preset first threshold, determine that the similarity between the width of the preset character string in the default font and the width of the preset character string in the original font meets the preset standard. If the first ratio is greater than the preset first threshold, it is determined that the similarity between the width of the preset character string in the default font and the width of the preset character string in the original font does not meet the preset standard.
- the width and height of the preset character string under the default font and the width and height of the preset character string under the original font are similar to the preset standard, which may include: the preset character string under the default font
- the ratio of the width of the character string to the width of the preset character string under the original font is between 0.95 and 1.05, that is, the first ratio is between 0 and 0.05.
- Step S604 using candidate fonts having the same font attributes as the original fonts as target fonts, and determining a first font from the target fonts.
- step S604 among all candidate fonts (including default fonts and non-default fonts), select a candidate font with the same font attribute as the original font as the target font,
- the typesetting of the target text presented to the user by the local application is similar to the original typesetting of the target text, and only fine-tuning is required during typesetting.
- the default font is given priority as the first font to replace the original font.
- the font properties of the default font and the original font are not the same, or the width of the preset character string under the default font is not similar to the width of the preset character string under the original font, it does not meet the preset standard, then from the original font
- the first font is determined among the candidate fonts whose font attributes are the same. In this way, the preference of the user is taken into account, and the amount of computation is reduced, and the processing time is saved.
- the implementation methods of determining the degree of similarity and matching between the candidate font, the target font and the original font can also be applied to determining the replacement font in the replacement font list.
- step S108 the terminal device displays the target text in the first font supported by the local application and typesets the target text displayed in the first font according to the character measurement data of the original font.
- Typesetting example 1 first determine the typesetting direction of the target text, and typesetting the target text displayed on the terminal device in the first font according to the typesetting direction of the target text.
- the typesetting direction of the target text is horizontal typesetting
- the first scaling process is performed on the characters of the target text so that the character width of the target text is consistent with the character width of the original font.
- the second scaling process is performed on the characters of the target text so that the character height of the target text is consistent with the character height of the original font.
- Example 1 the scaling of characters can be achieved by adjusting the font size.
- step S108 typesetting the target text displayed on the terminal device according to the character measurement data corresponding to the original font may be: acquiring the character measurement data corresponding to the first font, and measuring the text according to the character measurement data corresponding to the original font The data and the character measurement data corresponding to the first font typesetting the target text displayed on the terminal device.
- Typesetting example 2 firstly determine the typesetting direction of the target text, and typesetting the target text displayed on the terminal device in the first font according to the typesetting direction of the target text.
- the typesetting direction of the target text is horizontal typesetting, a first difference is determined, and the first difference is the difference between the character width of the original font and the character width of the first font. In the case that the first difference is a positive value, the abscissa value of the character of the target text is adjusted. If the first difference is a negative value, the characters of the target text are reduced.
- the typesetting direction of the target text is vertical typesetting, a second difference is determined, and the second difference is the difference between the character height of the original font and the character height of the first font. If the second difference is a positive value, the ordinate value of the character of the target text is adjusted. If the second difference is a negative value, the characters of the target text are reduced.
- the reduction of characters can be realized by adjusting the font size.
- the character width of each character in the original font is about W1.
- the character width of each character in the first font is about W2.
- the first difference DW is a positive value, it means that the character width of the first font is smaller than the character width of the original font, and the coordinate value of the abscissa of each character of the target text in the first font needs to be adjusted.
- the target text is a line of content, including 10 characters of "good morning, today's weather is really nice".
- the coordinate values of the abscissa of 10 characters are X 1 , X 2 ,...,X 10
- the coordinate values of the abscissa of 10 characters are X 1 ', X 2 ',...,X 10 ', then:
- n is an integer, 1 ⁇ n ⁇ 10.
- adjusting the coordinate value of the abscissa of each character in the line of content under the first font is equivalent to adjusting the spacing between adjacent characters in the line of content.
- the terminal device needs to be reduced to The font size of the target text displayed in the first font.
- the font size described herein is a dot system, which is a method of measuring printed fonts well known to those skilled in the art, such as 5 points, 12 points, etc.
- the character height of each character in the original font is H1.
- the character height of each character in the first font is H2.
- Calculate the difference DH ( H1 ⁇ H2) between H1 and H2 as the second difference.
- the second difference DH is a positive value, it means that the character height of the first font is smaller than the character height of the original font, and the coordinate value of the ordinate of each character under the first font is adjusted.
- the ordinate values of the characters in each line are the same, and the ordinate values of the characters from the first line to the Mth line are Y 1 , Y 2 ,...,Y M , after typesetting, the ordinate values of the characters from line 1 to line M are respectively Y 1 ', Y 2 ',...,Y M ', then:
- n is an integer, 1 ⁇ m ⁇ M.
- adjusting the coordinate value of the ordinate of each character of the target text in the first font is equivalent to adjusting the line spacing between adjacent lines of the target text.
- the terminal device needs to be reduced to The font size of the target text displayed in the first font.
- Typesetting example 3 first determine the typesetting direction of the target text, and typesetting the target text displayed on the terminal device in the first font according to the typesetting direction of the target text.
- the typesetting direction of the target text is horizontal typesetting, adjust the font size of the target text to the first font size, and the first font size is the font size whose character width is closest to the character width of the original font; determine the first difference value, the first difference The value is the difference between the character width of the original font and the character width of the first font; if the first difference is a positive value, adjust the abscissa value of the character of the target text; if the first difference is a negative value Next, shrink the characters of the target text.
- the font size of the target text is adjusted to the second font size, and the second font size is the font size whose character height is the closest to the character height of the original font; determine the second difference, the second The difference is the difference between the character height of the original font and the character height of the first font; if the second difference is positive, adjust the ordinate value of the character of the target text; if the second difference is negative In the case, the characters of the target text are reduced.
- the terminal device adjusts the font size of the target text under the first font to the first font size, if the character width is still greater than the character width under the original font, then Decrease the font size by one to make the characters smaller and avoid characters overlapping each other.
- the terminal device adjusts the font size of the target text in the first font to the second font size, if the character height is still greater than the character height in the original font, then Decrease the font size by one to make the characters smaller and avoid characters overlapping each other.
- the reduction of characters can be realized by adjusting the font size.
- the typesetting of the displayed target text is closer to the typesetting of the target text displayed in the original font.
- the original font is compared with the first font, and the total width of this content under the original font is wider.
- the total width of the content displayed by the terminal device using the first font is closer to the total width of the content in the original font. In this way, it can be ensured that the content of the same line under the original font will not be divided into lines because it is displayed in the first font.
- Typesetting example 4 Typesetting the target text according to the character measurement data of the original font may include steps S1085-S1087.
- Step S1085 segment the target text into words.
- Step S1086 accumulating the difference between the width of each character in the word in the first font and the width in the original font to obtain an adjustment amount.
- Step S1087 calculating the ratio of the adjustment amount to the number of character gaps in the word as a second ratio, and adjusting the gaps between characters in the word according to the second ratio so that the gaps between characters in the word are the same.
- the difference between the width of each character under the first font and the width under the original font is O 1 , O 2 ,...,O T in turn, and the accumulation is O 1 , O 2 ,...,O T.
- the adjustment amount is obtained, and the second ratio between the adjustment amount and the number of character gaps is calculated. If the second ratio is a positive value, it means that the adjustment amount is a positive value and the gap between the characters in the word should be reduced, then the gap between the characters in the word is subtracted from the second ratio.
- the second ratio is a negative value, it means that the adjustment amount is a negative value and should increase the gap between the characters in the word, then the gap between the characters in the word is subtracted from the second ratio, that is, the absolute value of the second ratio is added. value.
- the fourth typesetting example can be performed after any of the above-mentioned typesetting examples.
- the local application first typesets the width and height of the characters of the target text, and then adjusts the height and height values of the characters of the target text according to the character height and height values corresponding to the original font.
- An advantageous effect of the embodiments of the present disclosure is that if the local application of the terminal device does not support the original font of the target text, the local application uses the first font it supports to display the target text and typeset the target text according to the character measurement data of the original font , so that the local application can still maintain the consistency of the document typesetting and the original typesetting in the case of missing the original font.
- the embodiment of the present disclosure provides a text typesetting method.
- the method includes steps S702-S706. Steps S702-S706 can be implemented by the server.
- Step S702 receiving the font identifier of the original font of the target text sent by the terminal device.
- Step S704 query the character measurement data of the original font according to the font identifier of the original font.
- Step S706 sending the character measurement data of the original font to the terminal device, so that the terminal device can typesetting the target text displayed in the first font supported by its local application according to the character measurement data of the original font.
- font attributes of various fonts and character measurement data of various fonts at various font sizes are pre-stored in the server.
- Character measurements for a font may include the height and width of the characters.
- a font's character measurements may also include a character's rise and fall values.
- the font properties of a font refer to the inherent properties of the font itself, which can reflect the style of the font.
- the font attributes of the font may include one or more of font thickness, blackening, and slant.
- the method before the terminal device displays the target text in the first font supported by its local application, the method further includes: obtaining a replacement font list of the original font according to the font identifier of the original font.
- a candidate font is determined from the replacement fonts in the replacement font list, where the candidate font is a font supported by a local application of the terminal device.
- the candidate font that best matches the original font in the replacement font list is determined as the first font.
- the method before the terminal device displays the target text in the first font supported by its local application, the method further includes: sending the font attribute of the original font and the width of the preset character string under the original font to the terminal device, to For the terminal device to determine the first font from the candidate fonts according to the font attributes of the original font and the width of the preset character string under the original font.
- the candidate font is a font supported by a local application of the terminal device
- the preset character string includes a plurality of different preset characters.
- the method before the terminal device displays the target text with the first font supported by its local application, the method further includes: determining the first font from the candidate fonts according to the font attributes of the original font and the width of the preset character string under the original font A font, sending the font identifier of the first font to the terminal device.
- the candidate font is a font supported by a local application of the terminal device
- the preset character string includes a plurality of different preset characters.
- candidate fonts include default fonts and non-default fonts supported by the native application.
- the first font is determined from the candidate fonts according to the font attributes of the original font and the width of the preset character string under the original font, including: if the font attributes of the default font and the original font are the same, and the preset character string under the default font It is assumed that the width of the character string is similar to the width of the preset character string under the original font to meet the preset standard, and the default font is determined as the first font. Otherwise, a candidate font having the same font attribute as the original font is used as the target font, and the first font is determined from the target font.
- determining whether the similarity between the width of the preset character string under the default font and the width of the preset character string under the original font meets the preset standard includes: determining that the width of the preset character string under the default font is the same as The difference between the widths of the preset character strings in the original font is used as the fourth difference. A ratio of the absolute value of the fourth difference to the width of the preset character string in the original font is determined as the first ratio. In the case that the first ratio is less than or equal to the preset first threshold, it is determined that the width of the preset character string in the default font is similar to the width of the preset character string in the original font conforming to the preset standard. If the first ratio is greater than the preset first threshold, it is determined that the similarity between the width of the preset character string in the default font and the width of the preset character string in the original font does not meet the preset standard.
- determining the first font from the target fonts includes: determining the target font whose width is the closest to the original font as the first font; The target font is determined as the first font.
- An advantageous effect of the embodiments of the present disclosure is that if the local application of the terminal device does not support the original font of the target text, the server provides the character measurement data of the original font to the terminal device, so that the terminal device can use the character measurement data corresponding to the original font Typesetting the target text displayed in the first font supported by the local application, so that the local application can still maintain the consistency between the document typesetting and the original typesetting when the original font is missing.
- An embodiment of the present disclosure provides a text typesetting device, including the following modules:
- the first determining module is configured to determine the original font used by the target text.
- the second determining module is used for determining whether the local application supports the original font.
- the obtaining module is used to obtain the character measurement data of the original font when the local application does not support the original font.
- a typesetting module configured to typeset the target text displayed in the first font supported by the local application of the terminal device according to the character measurement data of the original font.
- obtaining the character measurement data of the original font includes any of the following: querying the character measurement data of the original font in the local cache of the terminal device; querying the character measurement data of the original font in the local cache of the terminal device In the case of character measurement data, the character measurement data of the original font is obtained from the server and stored in the local cache.
- the method further includes: selecting a first font matching the original font from all fonts supported by the local application; using the selected first font A font displays the target text.
- selecting a first font matching the original font from all fonts supported by the local application includes: obtaining a list of replacement fonts for the original font.
- a candidate font is determined from the replacement fonts in the replacement font list, and the candidate font is a font supported by the local application. Determining the candidate font with the highest matching degree with the original font as the first font.
- displaying the target text in the first font supported by the local application includes: determining a character type of the target text. Selecting a first font matching the original font from all fonts supported by the local application according to preset rules associated with the character type of the target text; displaying the target text with the selected first font .
- the original font's character measurement data includes the original font's character width and the original font's character height.
- Selecting the first font that matches the original font from all the fonts supported by the local application includes: acquiring character measurement data of the candidate font, where the candidate font is a font supported by the local application. Determines the typesetting direction of the target text. When the typesetting direction of the target text is horizontal typesetting, the candidate font whose character width is closest to that of the original font is determined as the first font. When the typesetting direction of the target text is vertical typesetting, the candidate font whose character height is closest to that of the original font is determined as the first font.
- the original font's character measurement data includes the original font's character width and the original font's character height.
- Selecting the first font that matches the original font from all the fonts supported by the local application includes: acquiring font attributes of the original font and font attributes of the candidate font, where the candidate font is a font supported by the local application.
- a candidate font whose font attribute is the same as that of the original font is determined as the target font, and character measurement data of the target font is obtained.
- the typesetting direction of the target text is horizontal typesetting
- the target font whose character width is closest to that of the original font is determined as the first font.
- the typesetting direction of the target text is vertical typesetting, the target font whose character height is closest to that of the original font is determined as the first font.
- the first font that matches the original font is selected from all fonts supported by the local application.
- a font including: sending the font identification of the candidate font to the server, so that the server can determine the first font from the candidate fonts according to the font attributes of the original font and the width of the preset character string under the original font, and receive the first font from the server The font ID of the font. Or, acquire the font attribute of the original font and the width of the preset character string under the original font from the server, and determine the first font from the candidate fonts according to the font attribute of the original font and the width of the preset character string under the original font.
- the candidate font is a font supported by the local application
- the preset character string includes a plurality of different preset characters.
- candidate fonts include default fonts and non-default fonts supported by the native application.
- determining whether the similarity between the width of the preset character string under the default font and the width of the preset character string under the original font meets the preset standard includes: determining that the width of the preset character string under the default font is the same as The difference between the widths of the preset character strings in the original font is used as the fourth difference. A ratio of the absolute value of the fourth difference to the width of the preset character string in the original font is determined as the first ratio. In the case that the first ratio is less than or equal to the preset first threshold, it is determined that the width of the preset character string in the default font is similar to the width of the preset character string in the original font conforming to the preset standard.
- determining the first font from the target fonts includes: determining the target font whose width is the closest to the original font as the first font; The target font is determined as the first font.
- the original font's character measurement data includes the original font's character width and the original font's character height.
- Typesetting the target text according to the character measurement data of the original font including: determining the typesetting direction of the target text.
- the typesetting direction of the target text is horizontal typesetting
- determine the first difference the first difference is the difference between the character width of the character of the target text under the original font and the character width under the first font value; if the first difference is a positive value, adjust the abscissa value of the character of the target text displayed in the first font. If the first difference is a negative value, the characters of the target text displayed in the first font are reduced.
- the typesetting direction of the target text is vertical typesetting
- determine the second difference the second difference being the character height of the characters of the target text under the original font and the character height under the first font difference. If the second difference is a positive value, adjust the ordinate value of the character of the target text displayed in the first font. If the second difference is a negative value, the characters of the target text displayed in the first font are reduced.
- the original font's character measurement data includes the original font's character width.
- Typesetting the target text according to the character measurement data of the original font including: segmenting the target text into words. The difference between the width of each character in the word under the first font and the width under the original font is added to obtain an adjustment amount. The ratio of the adjustment amount to the number of character gaps in the word is calculated as a second ratio, and the gaps between characters in the word are adjusted according to the second ratio so that the gaps between characters in the word are the same.
- An embodiment of the present disclosure provides a text typesetting device, including the following modules:
- the receiving module is configured to receive the font identification of the original font of the target text sent by the terminal device.
- the query module is used to query the character measurement data of the original font according to the font identifier of the original font.
- a sending module configured to send the character measurement data of the original font to the terminal device, so that the terminal device typeset the target text displayed in the first font supported by the local application of the terminal device according to the character measurement data of the original font .
- displaying the target text in the first font supported by the local application on the terminal device includes: obtaining a replacement font list of the original font according to the font identifier of the original font.
- a candidate font is determined from the replacement fonts in the replacement font list, and the candidate font is a font supported by the local application.
- the candidate font ranked first in the replacement font list is determined as the first font.
- the method further includes: sending the font attributes of the original font and the width of the preset character string under the original font to the terminal device, so that the terminal device The width of the character string determines the first font from the candidate fonts. Or, determine the first font from the candidate fonts according to the font attribute of the original font and the width of the preset character string under the original font, and send the font identifier of the first font to the terminal device.
- the candidate font is a font supported by the local application
- the preset character string includes a plurality of different preset characters.
- candidate fonts include default fonts and non-default fonts supported by the native application.
- determining whether the similarity between the width of the preset character string under the default font and the width of the preset character string under the original font meets the preset standard includes: determining that the width of the preset character string under the default font is the same as The difference between the widths of the preset character strings in the original font is used as the fourth difference. A ratio of the absolute value of the fourth difference to the width of the preset character string in the original font is determined as the first ratio. In the case that the first ratio is less than or equal to the preset first threshold, it is determined that the width of the preset character string in the default font is similar to the width of the preset character string in the original font conforming to the preset standard.
- determining the first font from the target fonts includes: determining the target font closest to the width of the preset character string and the original font as the first font. Alternatively, the target font with the smallest width of the preset character string is determined as the first font.
- Fig. 6 is a schematic diagram of a hardware structure of an electronic device according to an embodiment.
- 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, so as to implement any of the above method embodiments.
- the typesetting method of the text is used to implement any of the above method embodiments.
- the electronic device 800 may be a computer, a mobile phone, a tablet computer and other devices.
- the electronic device is the aforementioned terminal device.
- Fig. 7 is a schematic diagram of a hardware structure of a server according to an embodiment.
- the server 900 includes a processor 901 and a memory 902, the memory 902 is used to store an executable computer program, and the processor 901 is used to execute the computer program to realize the text of any of the above method embodiments typesetting method.
- An embodiment of the present disclosure also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the text typesetting method according to any of the above method embodiments is implemented.
- the present disclosure can be a system, method and/or computer program product.
- a computer program product may include a computer readable storage medium having computer readable program instructions thereon for causing a processor to implement various aspects of the present disclosure.
- a computer readable storage medium may be a tangible device that can retain and store instructions for use by an instruction execution device.
- a computer readable storage medium may be, for example, but is not limited to, an electrical 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.
- 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), compact disc read only memory (CD-ROM), digital versatile disc (DVD), memory stick, floppy disk, mechanically encoded device, such as a printer with instructions stored thereon A hole card or a raised structure in a groove, and any suitable combination of the above.
- RAM random access memory
- ROM read-only memory
- EPROM erasable programmable read-only memory
- flash memory static random access memory
- SRAM static random access memory
- CD-ROM compact disc read only memory
- DVD digital versatile disc
- memory stick floppy disk
- mechanically encoded device such as a printer with instructions stored thereon
- a hole card or a raised structure in a groove and any suitable combination of the above.
- computer-readable storage media are not to be construed as transient signals per se, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through waveguides or other transmission media (e.g., pulses of light through fiber optic cables), or transmitted electrical signals.
- the computer-readable program instructions described herein may be downloaded from a computer-readable storage medium to a respective computing/processing device, or downloaded to an external computer or external storage device over a network, such as the Internet, a local area network, a wide area network, and/or a wireless network.
- the network may include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers, and/or edge servers.
- a network adapter card or a network interface in each computing/processing device receives computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in a computer-readable storage medium in each computing/processing device .
- Computer program instructions for performing the operations of the present disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, state setting data, or Source or object code written in any combination, including object-oriented programming languages—such as Smalltalk, C++, etc., and conventional procedural programming languages—such as the “C” language or similar programming languages.
- Computer readable program instructions may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer, or entirely on the remote computer or server implement.
- the remote computer can be connected to the user computer through any kind of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (such as via the Internet using an Internet service provider). connect).
- LAN local area network
- WAN wide area network
- an electronic circuit such as a programmable logic circuit, field programmable gate array (FPGA), or programmable logic array (PLA)
- FPGA field programmable gate array
- PDA programmable logic array
- 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 when executed by the processor of the computer or other programmable data processing apparatus , producing an apparatus for realizing the functions/actions specified in one or more blocks in the flowchart and/or block diagram.
- These computer-readable program instructions can also be stored in a computer-readable storage medium, and these instructions cause computers, programmable data processing devices and/or other devices to work in a specific way, so that the computer-readable medium storing instructions includes An article of manufacture comprising instructions for implementing various aspects of the functions/acts specified in one or more blocks in flowcharts and/or block diagrams.
- each block in a flowchart or block diagram may represent a module, a portion of a program segment, or an instruction that includes one or more Executable instructions.
- the functions noted in the block may occur out of the order noted in the figures. For example, two blocks in succession may, in fact, be executed substantially concurrently, or they may sometimes be executed in the reverse order, depending upon the functionality involved.
- each block of the block diagrams and/or flowchart illustrations, and combinations of blocks in the block diagrams and/or flowchart illustrations can be implemented by a dedicated hardware-based system that performs the specified function or action , or may be implemented by a combination of dedicated hardware and computer instructions. It is well known to those skilled in the art that implementation by means of hardware, implementation by means of software, and implementation by a combination of software and hardware are all equivalent.
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Health & Medical Sciences (AREA)
- Artificial Intelligence (AREA)
- Audiology, Speech & Language Pathology (AREA)
- Computational Linguistics (AREA)
- General Health & Medical Sciences (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Document Processing Apparatus (AREA)
- Controls And Circuits For Display Device (AREA)
Abstract
Description
Claims (19)
- 一种文本的排版方法,应用于运行于终端设备的本地应用,其特征在于,包括:确定目标文本使用的原始字体;确定本地应用是否支持所述原始字体;在所述本地应用不支持所述原始字体的情况下,获取所述原始字体的字符测量数据;以所述本地应用支持的第一字体显示所述目标文本;并根据所述原始字体的字符测量数据对显示的所述目标文本进行排版。
- 根据权利要求1所述的方法,其特征在于,所述获取所述原始字体的字符测量数据,包括以下任一:在所述终端设备的本地缓存中查询所述原始字体的字符测量数据;在所述终端设备的本地缓存中查询不到所述原始字体的字符测量数据的情况下,从服务器处获取所述原始字体的字符测量数据。
- 根据权利要求1所述的方法,其特征在于,以所述本地应用支持的第一字体显示所述目标文本,包括:从所述本地应用支持的所有字体中选择出与所述原始字体相匹配的第一字体;以选择出的所述第一字体显示所述目标文本。
- 根据权利要求3所述的方法,其特征在于,所述从所述本地应用支持的所有字体中选择出与所述原始字体相匹配的第一字体,包括:获取所述原始字体的替换字体列表;从所述替换字体列表的替换字体中确定候选字体,所述候选字体是所述本地应用支持的字体;将所述候选字体中与所述原始字体的匹配度最高的确定为所述第一字体。
- 根据权利要求1所述的方法,其特征在于,以所述本地应用支持的第一字体显示所述目标文本,包括:确定所述目标文本的字符类型;根据与所述目标文本的字符类型相关联的预设规则,从所述本地应用支持的所有字体中选择出与所述原始字体相匹配的第一字体;以选择出的所述第一字体显示所述目标文本。
- 根据权利要求3或5所述的方法,其特征在于,所述原始字体的字符测量数据包括所述原始字体的字符宽度和所述原始字体的字符高度;所述从所述本地应用支持的所有字体中选择出与所述原始字体相匹配的第一字体,包括:获取候选字体的字符测量数据,所述候选字体是所述本地应用支持的字体;确定所述目标文本的排版方向;在所述目标文本的排版方向为横向排版的情况下,将字符宽度与所述原始字体的字符宽度最接近的候选字体确定为所述第一字体;在所述目标文本的排版方向为竖向排版的情况下,将字符高度与所述原始字体的字符高度最接近的候选字体确定为所述第一字体。
- 根据权利要求3或5所述的方法,其特征在于,所述原始字体的字符测量数据包括所述原始字体的字符宽度和所述原始字体的字符高度;所述从所述本地应用支持的所有字体中选择出与所述原始字体相匹配的第一字体,包括:获取所述原始字体的字体属性和候选字体的字体属性,所述候选字体是所述本地应用支持的字体;将字体属性与所述原始字体的字体属性相同的候选字体确定为目标字体,获取所述目标字体的字符测量数据;确定所述目标文本的排版方向;在所述目标文本的排版方向为横向排版的情况下,将字符宽度与所述原始字体的字符宽度最接近的目标字体确定为所述第一字体;在所述目标文本的排版方向为竖向排版的情况下,将字符高度与所述原始字体的字符高度最接近的目标字体确定为所述第一字体。
- 根据权利要求5所述的方法,其特征在于,在所述目标文本的字符类型是字母类型或者多语言混合类型的情况下,所述根据与所述目标文本的字符类型相关联的预设规则,从所述本地应用支持的所有字体中选择出与所述原始字体相匹配的第一字体,包括:将候选字体的字体标识发送给服务器,以供服务器根据所述原始字体的字体属性和所述原始字体下的预设字符串的宽度从所述候选字体中确定所述第一字体,并从所述服务器接收所述第一字体的字体标识;或者,从服务器处获取所述原始字体的字体属性和所述原始字体下的预设字符串的宽度,并根据所述原始字体的字体属性和所述原始字体下的预设字符串的宽度从所述候选字体中确定所述第一字体;其中,所述候选字体是所述本地应用支持的字体,所述预设字符串中包括多个不同的预设字符。
- 根据权利要求8所述的方法,其特征在于,所述候选字体包括所述本地应用支持的默认字体和非默认字体;所述根据所述原始字体的字体属性和所述原始字体下的预设字符串的宽度从所述候选字体中确定所述第一字体,包括:如果所述默认字体和所述原始字体的字体属性相同、并且所述默认字体下的预设字符串的宽度与所述原始字体下的预设字符串的宽度的近似程度符合预设标准,将所述默认字体确定为所述第一字体;否则,将与所述原始字体的字体属性相同的候选字体作为目标字体,并从所述目标字体中确定所述第一字体。
- 根据权利要求9所述的方法,其特征在于,确定所述默认字体下的预设字符串的宽度与所述原始字体下的预设字符串的宽度的近似程度是否符合预设标准,包括:确定所述默认字体下的预设字符串的宽度与所述原始字体下的预设字符串的宽度的差值作为第四差值;确定所述第四差值的绝对值与所述原始字体下的预设字符串的宽度的比值作为第一比值;在所述第一比值小于等于预设的第一阈值的情况下,确定所述默认字体下的预设字符串的宽度与所述原始字体下的预设字符串的宽度的近似程度符合预设标准。
- 根据权利要求9所述的方法,其特征在于,所述从所述目标字体中确定所述第一字体,包括:将所述预设字符串的宽度与所述原始字体下的最接近的所述目标字体确定为所述第一字体;或者,将所述预设字符串的宽度最小的目标字体确定为所述第一字体。
- 根据权利要求1所述的方法,其特征在于,所述原始字体的字符测量数据包括所述原始字体的字符宽度和所述原始字体的字符高度;所述根据所述原始字体的字符测量数据对显示的所述目标文本进行排版,包括:确定所述目标文本的排版方向;在所述目标文本的排版方向为横向排版的情况下,确定第一差值,所述第一差值为所述目标文本的字符在所述原始字体下的字符宽度和在所述第一字体下的字符宽度之间的差值;在所述第一差值为正值的情况下,调整以所述第一字体显示的所述目标文本的字符的横坐标值;在所述第一差值为负值的情况下,对以所述第一字体显示的所述目标文本的字符进行缩小处理;在所述目标文本的排版方向为竖向排版的情况下,确定第二差值,所述第二差值为所述目标文本的字符在所述原始字体下的字符高度和在所述第一字体下的字符高度之间的差值;在所述第二差值为正值的情况下,调整以所述第一字体显示的所述目标文本的字符的纵坐标值;在所述第二差值为负值的情况下,对以所述第一字体显示的所述目标文本的字符进行缩小处理。
- 根据权利要求1或者12所述的方法,其特征在于,所述原始字体的字符测量数据包括所述原始字体的字符宽度;所述根据所述原始字体的字符测量数据对所述目标文本进行排版,包括:将所述目标文本切分成词;累加所述词中的每个字符在所述第一字体下的宽度与在所述原始字体下的宽度之间的差值,得到调节量;计算所述调节量与所述词中的字符间隙数量的比值作为第二比值,根据所述第二比值调节所述词中的字符的间隙以使得所述词中的字符的间隙相同。
- 一种文本的排版方法,应用于服务器,其特征在于,包括:接收终端设备发送的目标文本的原始字体的字体标识;根据所述原始字体的字体标识查询出所述原始字体的字符测量数据;将所述原始字体的字符测量数据发送给所述终端设备,以供所述终端设备根据所述原始字体的字符测量数据对以所述终端设备的本地应用支持的第一字体显示的所述目标文本进行排版。
- 一种文本的排版装置,其特征在于,包括:第一确定模块,用于确定目标文本使用的原始字体;第二确定模块,用于确定本地应用是否支持所述原始字体;获取模块,用于在所述本地应用不支持所述原始字体的情况下,获取所述原始字体的字符测量数据;排版模块,用于根据所述原始字体的字符测量数据对以终端设备的本地应用支持的第一字体显示的所述目标文本进行排版。
- 一种文本的排版装置,其特征在于,包括:接收模块,用于接收终端设备发送的目标文本的原始字体的字体标识;查询模块,用于根据所述原始字体的字体标识查询出所述原始字体的字符测量数据;发送模块,用于将所述原始字体的字符测量数据发送给终端设备,以供所述终端设备根据所述原始字体的字符测量数据对以所述终端设备的本地应用支持的第一字体显示的所述目标文本进行排版。
- 一种电子设备,包括存储器和处理器,所述存储器用于存储计算机程序;所述处理器用于执行所述计算机程序,以实现根据权利要求1-13中任意一项所述的方法。
- 一种服务器,包括存储器和处理器,所述存储器用于存储计算机程序;所述处理器用于执行所述计算机程序,以实现根据权利要求14所述的方法。
- 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质上存储计 算机程序,所述计算机程序在被处理器执行时实现根据权利要求1-14中任意一项所述的方法。
Priority Applications (3)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2024513144A JP2024534170A (ja) | 2021-08-26 | 2021-12-28 | テキストの組版 |
| EP21954891.4A EP4379596A4 (en) | 2021-08-26 | 2021-12-28 | TEXT COMPOSITION |
| US18/686,835 US20250131181A1 (en) | 2021-08-26 | 2021-12-28 | Text typesetting |
Applications Claiming Priority (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202110988381.9A CN113642289B (zh) | 2021-08-26 | 2021-08-26 | 文本的排版方法和装置、电子设备、服务器及存储介质 |
| CN202110988381.9 | 2021-08-26 |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2023024376A1 true WO2023024376A1 (zh) | 2023-03-02 |
Family
ID=78424011
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/CN2021/142042 Ceased WO2023024376A1 (zh) | 2021-08-26 | 2021-12-28 | 文本的排版 |
Country Status (5)
| Country | Link |
|---|---|
| US (1) | US20250131181A1 (zh) |
| EP (1) | EP4379596A4 (zh) |
| JP (1) | JP2024534170A (zh) |
| CN (1) | CN113642289B (zh) |
| WO (1) | WO2023024376A1 (zh) |
Families Citing this family (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN113642289B (zh) * | 2021-08-26 | 2024-10-22 | 珠海金山办公软件有限公司 | 文本的排版方法和装置、电子设备、服务器及存储介质 |
Citations (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20130332824A1 (en) * | 2012-06-11 | 2013-12-12 | Beijing Founder Apabi Technology Ltd. | Embedded font processing method and device |
| CN109992749A (zh) * | 2017-12-29 | 2019-07-09 | 珠海金山办公软件有限公司 | 一种文字显示方法、装置、电子设备及可读存储介质 |
| CN113051235A (zh) * | 2021-04-22 | 2021-06-29 | 平安普惠企业管理有限公司 | 文档加载方法、装置、终端和存储介质 |
| CN113283217A (zh) * | 2021-05-28 | 2021-08-20 | 珠海金山办公软件有限公司 | 文档转换方法、装置、电子设备及存储介质 |
| CN113642290A (zh) * | 2021-08-26 | 2021-11-12 | 珠海金山办公软件有限公司 | 文本的排版方法和装置、电子设备及存储介质 |
| CN113642289A (zh) * | 2021-08-26 | 2021-11-12 | 珠海金山办公软件有限公司 | 文本的排版方法和装置、电子设备、服务器及存储介质 |
Family Cites Families (32)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP4275808B2 (ja) * | 1999-06-25 | 2009-06-10 | 大日本印刷株式会社 | 文字の割付処理装置 |
| JP2005501310A (ja) * | 2001-05-02 | 2005-01-13 | ビットストリーム インコーポレーティッド | スケーリング方法及び/又は特定方向で情報媒体を表示する方法及びシステム |
| WO2004031883A2 (en) * | 2002-10-07 | 2004-04-15 | Varilang Soft Ltd. | A method for manipulation of objects within electronic graphic documents |
| US7982737B2 (en) * | 2007-10-31 | 2011-07-19 | Adobe System Incorporated | System and method for independent font substitution of string characters |
| US8381101B2 (en) * | 2009-11-16 | 2013-02-19 | Apple Inc. | Supporting platform-independent typesetting for documents |
| US8615709B2 (en) * | 2010-04-29 | 2013-12-24 | Monotype Imaging Inc. | Initiating font subsets |
| US9519625B2 (en) * | 2010-05-06 | 2016-12-13 | Celartem, Inc. | Accurate font activation |
| JP5645481B2 (ja) * | 2010-05-28 | 2014-12-24 | キヤノン株式会社 | 装置、方法、及びプログラム |
| US8947438B2 (en) * | 2011-08-01 | 2015-02-03 | Microsoft Corporation | Reducing font instructions |
| CN102663137B (zh) * | 2012-05-03 | 2016-06-29 | 北京奇虎科技有限公司 | 一种应用于移动终端中显示网页的方法及系统 |
| KR101437843B1 (ko) * | 2012-09-27 | 2014-09-04 | 주식회사 인프라웨어 | 전자문서 레이아웃 유지를 위한 폰트처리 방법, 그리고 이를 위한 폰트처리 프로그램을 기록한 컴퓨터로 판독가능한 기록매체 |
| CN103699520A (zh) * | 2012-09-27 | 2014-04-02 | 茵弗维尔株式会社 | 用于维持电子文档布局的字体处理方法 |
| US20140280693A1 (en) * | 2013-03-13 | 2014-09-18 | Celartem, Inc. | Font delivery service |
| CN103345493B (zh) * | 2013-06-27 | 2016-12-07 | 广州市动景计算机科技有限公司 | 用于移动终端上的文本内容显示的方法、装置及系统 |
| CN103425631A (zh) * | 2013-07-19 | 2013-12-04 | 百度在线网络技术(北京)有限公司 | 用于获取文档文件中目标文字的字体文件的方法及装置 |
| US20150074522A1 (en) * | 2013-09-12 | 2015-03-12 | Monotype Imaging Inc. | Font Management for Editing Electronic Documents |
| US10055386B2 (en) * | 2014-04-18 | 2018-08-21 | Emc Corporation | Using server side font preparation to achieve WYSIWYG and cross platform fidelity on web based word processor |
| US10115215B2 (en) * | 2015-04-17 | 2018-10-30 | Monotype Imaging Inc. | Pairing fonts for presentation |
| US20170249292A1 (en) * | 2016-02-29 | 2017-08-31 | Microsoft Technology Licensing, Llc | Conditional determination of lookups in glyph processing |
| US20170344519A1 (en) * | 2016-05-27 | 2017-11-30 | Microsoft Technology Licensing, Llc | Multi-level font substitution control |
| JP6812141B2 (ja) * | 2016-05-31 | 2021-01-13 | キヤノン株式会社 | 情報処理装置、情報処理方法およびプログラム |
| US10664695B2 (en) * | 2016-10-26 | 2020-05-26 | Myscript | System and method for managing digital ink typesetting |
| CN106844481B (zh) * | 2016-12-23 | 2021-01-05 | 北京信息科技大学 | 字体相似度及字体替换方法 |
| CN108172200B (zh) * | 2018-01-25 | 2021-02-05 | 腾讯科技(深圳)有限公司 | 一种应用中文本显示的方法及终端设备 |
| KR102300444B1 (ko) * | 2019-11-19 | 2021-09-09 | 주식회사 한글과컴퓨터 | 문서에 적용되어 있는 글꼴이 지원되는 글꼴인지 확인이 가능한 문서 편집 장치 및 그 동작 방법 |
| CN111507063A (zh) * | 2020-02-27 | 2020-08-07 | 平安科技(深圳)有限公司 | 文本处理方法、装置、设备及计算机可读存储介质 |
| CN111832253A (zh) * | 2020-07-03 | 2020-10-27 | Oppo广东移动通信有限公司 | 字体调节方法、装置、存储介质及电子设备 |
| AU2021203578A1 (en) * | 2021-06-01 | 2022-12-15 | Canva Pty Ltd | Systems and methods for converting embedded font text data |
| US20250328325A1 (en) * | 2024-04-18 | 2025-10-23 | Nvidia Corporation | Optimizing compilation of program code |
| CN120340010B (zh) * | 2025-04-02 | 2025-11-14 | 山东路网智能科技有限公司 | 融合多传感器数据的高速公路车牌图像识别加密算法系统 |
| CN120612700A (zh) * | 2025-05-16 | 2025-09-09 | 内蒙古工业大学 | 一种基于文本行识别的蒙古文文本行和词对齐语料库构建方法 |
| CN120523868B (zh) * | 2025-07-22 | 2025-09-19 | 四川省地震应急服务中心 | 结合地震灾情数据库的空间可视化展示方法及系统 |
-
2021
- 2021-08-26 CN CN202110988381.9A patent/CN113642289B/zh active Active
- 2021-12-28 JP JP2024513144A patent/JP2024534170A/ja active Pending
- 2021-12-28 US US18/686,835 patent/US20250131181A1/en active Pending
- 2021-12-28 EP EP21954891.4A patent/EP4379596A4/en active Pending
- 2021-12-28 WO PCT/CN2021/142042 patent/WO2023024376A1/zh not_active Ceased
Patent Citations (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20130332824A1 (en) * | 2012-06-11 | 2013-12-12 | Beijing Founder Apabi Technology Ltd. | Embedded font processing method and device |
| CN109992749A (zh) * | 2017-12-29 | 2019-07-09 | 珠海金山办公软件有限公司 | 一种文字显示方法、装置、电子设备及可读存储介质 |
| CN113051235A (zh) * | 2021-04-22 | 2021-06-29 | 平安普惠企业管理有限公司 | 文档加载方法、装置、终端和存储介质 |
| CN113283217A (zh) * | 2021-05-28 | 2021-08-20 | 珠海金山办公软件有限公司 | 文档转换方法、装置、电子设备及存储介质 |
| CN113642290A (zh) * | 2021-08-26 | 2021-11-12 | 珠海金山办公软件有限公司 | 文本的排版方法和装置、电子设备及存储介质 |
| CN113642289A (zh) * | 2021-08-26 | 2021-11-12 | 珠海金山办公软件有限公司 | 文本的排版方法和装置、电子设备、服务器及存储介质 |
Non-Patent Citations (1)
| Title |
|---|
| See also references of EP4379596A4 * |
Also Published As
| Publication number | Publication date |
|---|---|
| JP2024534170A (ja) | 2024-09-18 |
| CN113642289B (zh) | 2024-10-22 |
| EP4379596A1 (en) | 2024-06-05 |
| US20250131181A1 (en) | 2025-04-24 |
| CN113642289A (zh) | 2021-11-12 |
| EP4379596A4 (en) | 2025-07-30 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US10699166B2 (en) | Font attributes for font recognition and similarity | |
| US10102182B2 (en) | Indicators of text continuity | |
| US9824304B2 (en) | Determination of font similarity | |
| US20180239995A1 (en) | Font Recognition using Text Localization | |
| US20080079730A1 (en) | Character-level font linking | |
| AU2017204297A1 (en) | Visual similarity based font replacement for desktop and web applications | |
| US11030388B2 (en) | Live text glyph modifications | |
| KR20200141539A (ko) | 고정 서식 문서에서의 동아시아 레이아웃 특징들의 검출 및 재구성 | |
| BR112014017832B1 (pt) | método de detecção de fórmula para identificar uma fórmula matemática, sistema para detectar uma fór-mula que aparece em um documento de formato fixo e mídia legível por computador | |
| US20150324340A1 (en) | Method for generating reflow-content electronic book and website system thereof | |
| KR20150095658A (ko) | 수정 동안 콘텐츠의 영역의 레이아웃 유지 기법 | |
| CN113515928A (zh) | 电子文本生成方法、装置、设备及介质 | |
| JP7782113B2 (ja) | テキストの組版 | |
| US10366142B2 (en) | Identifier based glyph search | |
| JP2019169137A (ja) | タイトル推定器 | |
| WO2023024376A1 (zh) | 文本的排版 | |
| US11809806B2 (en) | Glyph accessibility system | |
| US20250218083A1 (en) | Systems and methods for creating editable documents | |
| JP5715172B2 (ja) | 文書表示装置、文書表示方法及び文書表示プログラム | |
| CN113743438B (zh) | 文本检测用数据集生成方法、装置和系统 | |
| KR20220060851A (ko) | 글자체를 제공하는 방법 및 디바이스 | |
| CN105760354B (zh) | 电子图书中笔记数据重定位方法与装置 | |
| US20250322148A1 (en) | Systems and methods for extracting tables from documents | |
| CN113377380B (zh) | 用户界面组件部署方法和装置 | |
| AU2015203352B2 (en) | Indicators of text continuity |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| 121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 21954891 Country of ref document: EP Kind code of ref document: A1 |
|
| WWE | Wipo information: entry into national phase |
Ref document number: 18686835 Country of ref document: US Ref document number: 2024513144 Country of ref document: JP |
|
| WWE | Wipo information: entry into national phase |
Ref document number: 2021954891 Country of ref document: EP |
|
| ENP | Entry into the national phase |
Ref document number: 2021954891 Country of ref document: EP Effective date: 20240228 |
|
| NENP | Non-entry into the national phase |
Ref country code: DE |
|
| WWP | Wipo information: published in national office |
Ref document number: 18686835 Country of ref document: US |