CN112052647A - Document editing method and device, electronic equipment and readable storage medium - Google Patents

Document editing method and device, electronic equipment and readable storage medium Download PDF

Info

Publication number
CN112052647A
CN112052647A CN201910486586.XA CN201910486586A CN112052647A CN 112052647 A CN112052647 A CN 112052647A CN 201910486586 A CN201910486586 A CN 201910486586A CN 112052647 A CN112052647 A CN 112052647A
Authority
CN
China
Prior art keywords
font
character
screenshot
target
determining
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.)
Pending
Application number
CN201910486586.XA
Other languages
Chinese (zh)
Inventor
朱静
张作兵
邓斌
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Kingsoft Office Software Inc
Zhuhai Kingsoft Office Software Co Ltd
Original Assignee
Beijing Kingsoft Office Software Inc
Zhuhai Kingsoft Office Software Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Kingsoft Office Software Inc, Zhuhai Kingsoft Office Software Co Ltd filed Critical Beijing Kingsoft Office Software Inc
Priority to CN201910486586.XA priority Critical patent/CN112052647A/en
Publication of CN112052647A publication Critical patent/CN112052647A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0484Interaction techniques based on graphical user interfaces [GUI] for the control of specific functions or operations, e.g. selecting or manipulating an object, an image or a displayed text element, setting a parameter value or selecting a range

Abstract

The embodiment of the invention provides a document editing method and device, electronic equipment and a readable storage medium. The method comprises the following steps: when a character insertion instruction is received, determining the font of the character before the position of the character to be inserted as a first font; when the font corresponding to the first font in the font library does not have the font of the character to be inserted, acquiring a screenshot of the character; determining each font corresponding to the character in fonts corresponding to non-first fonts in a font library as a target font, and rendering each target font into a target bitmap; calculating the similarity between each target bitmap and the screenshot; and displaying the character to be inserted by utilizing the font corresponding to the target bitmap with the highest similarity. In this way, when the character to be inserted cannot be displayed by using the font at the cursor, the character to be inserted can be displayed by using the font most similar to the character before the cursor. Therefore, the font difference between the character to be inserted and the character in front of the cursor is reduced, and good visual experience is provided for the user.

Description

Document editing method and device, electronic equipment and readable storage medium
Technical Field
The present invention relates to the field of document processing technologies, and in particular, to a document editing method and apparatus, an electronic device, and a readable storage medium.
Background
Often, a user needs to edit a document during work and learning. When a character needs to be inserted into the document, the font of the character is set to be the font consistent with the font at the cursor. For example, when the font at the cursor is an clerk, the font of the character is set as an clerk.
The inventor has found in the course of implementing the present invention that when the character cannot be displayed with an clerical font, the character is displayed with a default font song. Thus, the difference between the inserted character font and the original character font in the document is large, and good visual experience cannot be provided for users.
Disclosure of Invention
The embodiment of the invention aims to provide a document editing method, a document editing device, electronic equipment and a readable storage medium, so that the font difference between a character to be inserted and a character before a cursor can be reduced, and good visual experience is provided for a user. The specific technical scheme is as follows:
in a first aspect, an embodiment of the present invention provides a document editing method, where the method may include:
when a character insertion instruction is received, determining the font of the character before the position of the character to be inserted as a first font;
when the font corresponding to the first font in the font library does not have the font of the character to be inserted, acquiring a screenshot of the character;
determining each font corresponding to the character in fonts corresponding to non-first fonts in a font library as a target font, and rendering each target font into a target bitmap;
calculating the similarity between each target bitmap and the screenshot;
and displaying the character to be inserted by utilizing the font corresponding to the target bitmap with the highest similarity.
Optionally, before the step of obtaining the screenshot of the text when there is no glyph of the character to be inserted in the glyph corresponding to the first font in the font library, the method may further include:
determining a ten-thousand-national code corresponding to a character to be inserted;
determining whether a first font in a font library has a mapping relation with the Wan national code;
if not, determining that the font of the character to be inserted does not exist in the font corresponding to the first font.
Optionally, the step of calculating the similarity between each target bitmap and the screenshot may include:
and comparing the pixel value of the target bitmap with the pixel value of the screenshot to obtain the similarity between the target bitmap and the screenshot.
Optionally, when there is no glyph of the character to be inserted in the glyph corresponding to the first font in the font library, the step of obtaining a screenshot of the character may include:
and when the font of the character to be inserted does not exist in the font corresponding to the first font in the font library, acquiring the screenshot of each character in the preset number of characters before the position.
Optionally, the step of displaying the character to be inserted by using the font corresponding to the target bitmap with the highest similarity may include:
determining the number of times of appearance of a font corresponding to the target bitmap with the highest similarity;
and displaying the character to be inserted by utilizing the font with the largest occurrence number.
In a second aspect, an embodiment of the present invention further provides a document editing apparatus, where the apparatus may include:
the first determining module is used for determining the font of the character before the position of the character to be inserted as a first font when the character inserting instruction is received;
the acquisition module is used for acquiring a screenshot of the character when the font of the character to be inserted does not exist in the font corresponding to the first font in the font library;
the second determining module is used for determining each font corresponding to the character in the fonts corresponding to the non-first fonts in the font library as a target font and rendering each target font as a target bitmap;
the calculation module is used for calculating the similarity between each target bitmap and the screenshot;
and the display module is used for displaying the character to be inserted by utilizing the font corresponding to the target bitmap with the highest similarity.
Optionally, in the embodiment of the present invention, the method may further include:
the third determining module is used for determining the ten-thousand-national code corresponding to the character to be inserted before the screenshot of the character is obtained;
the fourth determining module is used for determining whether the first font in the font library has a mapping relation with the Wan national code;
and the fifth determining module is used for determining that the font of the character to be inserted does not exist in the font corresponding to the first font when the first font does not establish the mapping relation with the Wan national code.
Optionally, in this embodiment of the present invention, the calculation module may specifically be configured to:
and comparing the pixel value of the target bitmap with the pixel value of the screenshot to obtain the similarity between the target bitmap and the screenshot.
Optionally, in an embodiment of the present invention, the obtaining module may specifically be configured to:
and when the font of the character to be inserted does not exist in the font corresponding to the first font in the font library, acquiring the screenshot of each character in the preset number of characters before the position.
Optionally, in an embodiment of the present invention, the display module may specifically be configured to:
determining the number of times of appearance of a font corresponding to the target bitmap with the highest similarity;
and displaying the character to be inserted by utilizing the font with the largest occurrence number.
In a third aspect, an embodiment of the present invention further provides an electronic device, including a processor, a communication interface, a memory, and a communication bus, where the processor, the communication interface, and the memory complete mutual communication through the communication bus;
a memory for storing a computer program;
a processor adapted to perform the method steps of any of the first aspect when executing a program stored in the memory.
In a fourth aspect, the present invention further provides a readable storage medium, in which a computer program is stored, and when the computer program is executed by a processor, the method steps described in any one of the first aspect are implemented.
In a fifth aspect, embodiments of the present invention also provide a computer program product, which when run on an electronic device, causes the electronic device to perform the method steps of any one of the first aspect.
In the embodiment of the invention, when a character insertion instruction is received, the font of the character before the position of the character to be inserted can be determined as the first font. And when the font corresponding to the first font is found by the font library, the font of the character to be inserted does not exist, the screenshot of the character can be obtained. Moreover, each font corresponding to the character in the fonts corresponding to the non-first fonts in the font library can be determined as a target font, and each target font is rendered into a target bitmap. Thereafter, the similarity of each target bitmap to the screenshot may be calculated. Then, the font corresponding to the target bitmap with the highest similarity can be used for displaying the character to be inserted. In this way, when the character to be inserted cannot be displayed by using the font at the cursor, the character to be inserted can be displayed by using the font most similar to the character before the cursor. Therefore, the font difference between the character to be inserted and the character in front of the cursor is reduced, and good visual experience is provided for the user.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
FIG. 1 is a flowchart of a document editing method according to an embodiment of the present invention;
FIG. 2 is a schematic structural diagram of a document editing apparatus according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In order to solve technical problems in the related art, embodiments of the present invention provide a document editing method, apparatus, electronic device, and readable storage medium.
The document editing method provided by the embodiment of the invention is applied to the electronic equipment, and the electronic equipment can be provided with document editing software, so that a user can insert characters into a document through the document editing software. Although not limited thereto.
The document editing software includes, but is not limited to: word document editing software, PPT (PowerPoint) document editing software, and WPS (WPS software) document editing software. Additionally, the electronic devices include, but are not limited to, smart phones and smart wearable devices.
Referring to fig. 1, a document editing method provided by an embodiment of the present invention may include the following steps:
s101: when a character insertion instruction is received, determining the font of the character before the position of the character to be inserted as a first font;
it is to be understood that the electronic device may receive character insertion instructions. And after receiving the character insertion instruction, the electronic device may determine the font at the position where the character is inserted, that is, may determine the font at the position where the cursor is currently located. The font at the current position of the cursor can be marked as the second font. For example, the second font may be an clerical.
Then, the electronic device may determine whether a glyph of the character to be inserted exists in glyphs in the font library that have a mapping relationship with the second font. If the second font does not exist, the second font indicates that the character to be inserted cannot be displayed, namely, the clerical script cannot be used for displaying the character to be inserted. Wherein, the font of a character is recorded with the drawing track of the character.
In this case, the electronic device may also determine the font of the text preceding the position of the character to be inserted. The font can be marked as a first font, so that the font to be used by the character to be inserted can be determined through the first font, and the character to be inserted is not displayed by utilizing a default font, so that the font difference between the character to be inserted and the character before the cursor is reduced. For example, the first font may be a regular font.
Of course, it is also reasonable that the electronic device may directly determine the font of the text before the position of the character to be inserted after receiving the character insertion instruction.
It is reasonable to determine the font of a character before the position of the character to be inserted, or determine the fonts of a preset number of characters (for example, 5 characters) before the position. Wherein the number of the preset number is greater than or equal to 2.
S102: when the font corresponding to the first font in the font library does not have the font of the character to be inserted, acquiring a screenshot of the character;
after determining the font (i.e., the first font) of the text before the position of the character to be inserted, the electronic device may determine whether the font of the character to be inserted exists in the fonts in the font library that have a mapping relationship with the first font. Specifically, the electronic device may first determine the ten thousand codes corresponding to the character to be inserted. It may then be determined whether the first font in the font library has a mapping relationship with the ten thousand codes. If the first font does not establish a mapping relationship with the ten-thousand-national code, it can be determined that the font of the character to be inserted does not exist in the font which establishes the mapping relationship with the first font, that is, it can be determined that the font of the character to be inserted does not exist in the font corresponding to the first font. Wherein, the mapping relation between the ten thousand state code of the character and the font of the character exists in the word stock.
When the font of the character to be inserted does not exist in the font corresponding to the first font, the first font indicates that the character to be inserted cannot be displayed. In this case, a screenshot of the text before the position with the inserted character can be obtained.
S103: determining each font corresponding to the character in fonts corresponding to non-first fonts in a font library as a target font, and rendering each target font into a target bitmap;
and determining whether the non-first font in the font library has a mapping relation with the ten-thousand state code of the character. For example, it may be determined that a mapping relationship is established between a third font in the font library and the ten thousand national codes, indicating that the text may be displayed using the third font. In this way, all fonts in the font library that can be used to display the text can be determined.
Then, the target glyphs corresponding to all fonts used to display the text can be determined. Then, each target font is rendered, so that a target bitmap of the character corresponding to each target font is obtained.
For example, the third font, the fourth font, and the fifth font may be utilized in the font library to display the text. Then, the target font of the character corresponding to the third font can be obtained, and the target font of the character corresponding to the fourth font and the target font of the character corresponding to the fifth font can be obtained. And rendering each target font to obtain a target bitmap corresponding to each target font. The third font can be a regular Chinese font, the fourth font can be a new Song font, and the fifth font can be a black body.
S104: calculating the similarity between each target bitmap and the screenshot;
after the target bitmaps are obtained, the similarity of each target bitmap to the screenshot may be calculated. The similarity between the target bitmap and the screenshot can be calculated by using a method for calculating the image similarity in the related technology. Specifically, the pixel value of the target bitmap may be compared with the pixel value of the screenshot, so as to obtain the similarity between the target bitmap and the screenshot, which is not limited to this.
S105: and displaying the character to be inserted by utilizing the font corresponding to the target bitmap with the highest similarity.
For example, when the similarity between the target bitmap corresponding to the third font and the screenshot is 86%, the similarity between the target bitmap corresponding to the fourth font and the screenshot is 71%, and the similarity between the target bitmap corresponding to the fifth font and the screenshot is 66%, the third font may be used to display the character to be inserted.
In addition, it can be understood that when the characters before the determined position of the character to be inserted are a preset number of characters, a screenshot of each character can be obtained for each character. And obtaining the target font corresponding to the font which is not the first font and can be used for displaying the character and corresponds to each character. And obtaining a target bitmap corresponding to each target glyph. Then, the target bitmap with the highest similarity corresponding to each character can be determined according to the target bitmap corresponding to each character. Furthermore, the closest font corresponding to each character can be determined according to the font corresponding to the target bitmap with the highest similarity.
After determining the closest font corresponding to each character, the number of times of appearance of the determined font may be determined, that is, the number of times of appearance of the font corresponding to the target bitmap with the highest similarity may be determined. Then, the character to be inserted may be displayed using the font that appears most frequently.
For example, when the preset number of numerical values is 5, the number of times of occurrence of the determined font regular script is 3, and the number of times of occurrence of the determined font new song style is 2, the character to be inserted may be displayed by using the regular script.
In the embodiment of the invention, when a character insertion instruction is received, the font of the character before the position of the character to be inserted can be determined as the first font. And when the font corresponding to the first font is found by the font library, the font of the character to be inserted does not exist, the screenshot of the character can be obtained. Moreover, each font corresponding to the character in the fonts corresponding to the non-first fonts in the font library can be determined as a target font, and each target font is rendered into a target bitmap. Thereafter, the similarity of each target bitmap to the screenshot may be calculated. Then, the font corresponding to the target bitmap with the highest similarity can be used for displaying the character to be inserted. In this way, when the character to be inserted cannot be displayed by using the font at the cursor, the character to be inserted can be displayed by using the font most similar to the character before the cursor. Therefore, the font difference between the character to be inserted and the character in front of the cursor is reduced, and good visual experience is provided for the user.
In summary, with the document editing apparatus provided in the embodiments of the present invention, the character to be inserted can be displayed by using the font most similar to the character before the cursor. Therefore, the font difference between the character to be inserted and the character in front of the cursor is reduced, and good visual experience is provided for the user.
Corresponding to the above method embodiment, an embodiment of the present invention further provides a document editing apparatus, and referring to fig. 2, the apparatus may include:
a first determining module 201, configured to determine, when a character insertion instruction is received, a font of a text before a position where a character is to be inserted as a first font;
an obtaining module 202, configured to obtain a screenshot of a character when there is no glyph of a character to be inserted in a glyph corresponding to a first font in a font library;
the second determining module 203 is configured to determine each font corresponding to a character in fonts corresponding to non-first fonts in the font library as a target font, and render each target font into a target bitmap;
a calculating module 204, configured to calculate a similarity between each target bitmap and the screenshot;
the display module 205 is configured to display the character to be inserted by using the font corresponding to the target bitmap with the highest similarity.
By applying the device provided by the embodiment of the invention, when the character inserting instruction is received, the font of the character before the position of the character to be inserted can be determined as the first font. And when the font corresponding to the first font is found by the font library, the font of the character to be inserted does not exist, the screenshot of the character can be obtained. Moreover, each font corresponding to the character in the fonts corresponding to the non-first fonts in the font library can be determined as a target font, and each target font is rendered into a target bitmap. Thereafter, the similarity of each target bitmap to the screenshot may be calculated. Then, the font corresponding to the target bitmap with the highest similarity can be used for displaying the character to be inserted. In this way, when the character to be inserted cannot be displayed by using the font at the cursor, the character to be inserted can be displayed by using the font most similar to the character before the cursor. Therefore, the font difference between the character to be inserted and the character in front of the cursor is reduced, and good visual experience is provided for the user.
Optionally, in the embodiment of the present invention, the method may further include:
the third determining module is used for determining the ten-thousand-national code corresponding to the character to be inserted before the screenshot of the character is obtained;
the fourth determining module is used for determining whether the first font in the font library has a mapping relation with the Wan national code;
and the fifth determining module is used for determining that the font of the character to be inserted does not exist in the font corresponding to the first font when the first font does not establish the mapping relation with the Wan national code.
Optionally, in this embodiment of the present invention, the calculation module 205 may specifically be configured to:
and comparing the pixel value of the target bitmap with the pixel value of the screenshot to obtain the similarity between the target bitmap and the screenshot.
Optionally, in this embodiment of the present invention, the obtaining module 202 may specifically be configured to:
and when the font of the character to be inserted does not exist in the font corresponding to the first font in the font library, acquiring the screenshot of each character in the preset number of characters before the position.
Optionally, in this embodiment of the present invention, the display module 205 may specifically be configured to:
determining the number of times of appearance of a font corresponding to the target bitmap with the highest similarity;
and displaying the character to be inserted by utilizing the font with the largest occurrence number.
Corresponding to the above method embodiment, an embodiment of the present invention further provides an electronic device, referring to fig. 3, including a processor 301, a communication interface 302, a memory 303, and a communication bus 304, where the processor 301, the communication interface 302, and the memory 303 complete communication with each other through the communication bus 304;
a memory 303 for storing a computer program;
the processor 301 is configured to implement the method steps of any of the above-described document editing methods when executing the program stored in the memory 303.
In the embodiment of the invention, when the character insertion instruction is received, the electronic device may determine the font of the text before the position of the character to be inserted as the first font. And when the font corresponding to the first font is found by the font library, the font of the character to be inserted does not exist, the screenshot of the character can be obtained. Moreover, each font corresponding to the character in the fonts corresponding to the non-first fonts in the font library can be determined as a target font, and each target font is rendered into a target bitmap. Thereafter, the similarity of each target bitmap to the screenshot may be calculated. Then, the font corresponding to the target bitmap with the highest similarity can be used for displaying the character to be inserted. In this way, when the character to be inserted cannot be displayed by using the font at the cursor, the character to be inserted can be displayed by using the font most similar to the character before the cursor. Therefore, the font difference between the character to be inserted and the character in front of the cursor is reduced, and good visual experience is provided for the user.
Corresponding to the above method embodiment, an embodiment of the present invention further provides a readable storage medium, in which a computer program is stored, and the computer program, when executed by a processor, implements the method steps of any of the above document editing methods.
After the computer program stored in the readable storage medium provided by the embodiment of the present invention is executed by the processor of the electronic device, when a character insertion instruction is received, the electronic device may determine a font of a text before a position of a character to be inserted as a first font. And when the font corresponding to the first font is found by the font library, the font of the character to be inserted does not exist, the screenshot of the character can be obtained. Moreover, each font corresponding to the character in the fonts corresponding to the non-first fonts in the font library can be determined as a target font, and each target font is rendered into a target bitmap. Thereafter, the similarity of each target bitmap to the screenshot may be calculated. Then, the font corresponding to the target bitmap with the highest similarity can be used for displaying the character to be inserted. In this way, when the character to be inserted cannot be displayed by using the font at the cursor, the character to be inserted can be displayed by using the font most similar to the character before the cursor. Therefore, the font difference between the character to be inserted and the character in front of the cursor is reduced, and good visual experience is provided for the user.
Corresponding to the above method embodiment, an embodiment of the present invention further provides a computer program product, which when run on an electronic device, causes the electronic device to perform: method steps of any of the above document editing methods.
After the computer program product provided by the embodiment of the invention is executed by a processor of the electronic device, when a character insertion instruction is received, the electronic device can determine the font of the character before the position of the character to be inserted as the first font. And when the font corresponding to the first font is found by the font library, the font of the character to be inserted does not exist, the screenshot of the character can be obtained. Moreover, each font corresponding to the character in the fonts corresponding to the non-first fonts in the font library can be determined as a target font, and each target font is rendered into a target bitmap. Thereafter, the similarity of each target bitmap to the screenshot may be calculated. Then, the font corresponding to the target bitmap with the highest similarity can be used for displaying the character to be inserted. In this way, when the character to be inserted cannot be displayed by using the font at the cursor, the character to be inserted can be displayed by using the font most similar to the character before the cursor. Therefore, the font difference between the character to be inserted and the character in front of the cursor is reduced, and good visual experience is provided for the user.
The communication bus mentioned in the electronic device may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface is used for communication between the electronic equipment and other equipment.
The Memory may include a Random Access Memory (RAM) or a Non-Volatile Memory (NVM), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but also Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the invention to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website site, computer, server, or data center to another website site, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that incorporates one or more of the available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., Solid State Disk (SSD)), among others.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the apparatus, the electronic device, the readable storage medium, and the computer program product embodiments, since they are substantially similar to the method embodiments, the description is relatively simple, and in relation to the description, reference may be made to some of the description of the method embodiments.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.

Claims (10)

1. A method of document editing, the method comprising:
when a character insertion instruction is received, determining the font of the character before the position of the character to be inserted as a first font;
when the font of the character to be inserted does not exist in the font corresponding to the first font in the font library, acquiring a screenshot of the character;
determining each font corresponding to the character in fonts which are not corresponding to the first font in the font library as a target font, and rendering each target font into a target bitmap;
calculating the similarity between each target bitmap and the screenshot;
and displaying the character to be inserted by utilizing the font corresponding to the target bitmap with the highest similarity.
2. The method according to claim 1, wherein before the step of obtaining the screenshot of the text when the glyph of the character to be inserted does not exist in the glyphs corresponding to the first font in the font library, the method further comprises:
determining the corresponding ten-thousand-national code of the character to be inserted;
determining whether the first font in the font library is in a mapping relation with the Wan national code;
and if not, determining that the font of the character to be inserted does not exist in the font corresponding to the first font.
3. The method of claim 1, wherein the step of calculating the similarity of each of the target bitmaps to the screenshot comprises:
and comparing the pixel value of the target bitmap with the pixel value of the screenshot to obtain the similarity between the target bitmap and the screenshot.
4. The method according to claim 1, wherein the step of obtaining the screenshot of the text when the font of the character to be inserted does not exist in the font corresponding to the first font in the font library comprises:
and when the font of the character to be inserted does not exist in the font corresponding to the first font in the font library, acquiring the screenshot of each character in the characters in the preset number in front of the position.
5. The method according to claim 4, wherein the step of displaying the character to be inserted by using the font corresponding to the target bitmap with the highest similarity comprises:
determining the number of times of appearance of the font corresponding to the target bitmap with the highest similarity;
and displaying the character to be inserted by utilizing the font with the largest occurrence number.
6. A document editing apparatus, characterized in that the apparatus comprises:
the first determining module is used for determining the font of the character before the position of the character to be inserted as a first font when the character inserting instruction is received;
an obtaining module, configured to obtain a screenshot of the character when the font of the character to be inserted does not exist in a font corresponding to the first font in a font library;
a second determining module, configured to determine, as a target glyph, each glyph that corresponds to the text in glyphs that are not corresponding to the first font in the font library, and render each target glyph into a target bitmap;
the calculation module is used for calculating the similarity between each target bitmap and the screenshot;
and the display module is used for displaying the character to be inserted by utilizing the font corresponding to the target bitmap with the highest similarity.
7. The apparatus of claim 6, further comprising:
a third determining module, configured to determine a ten-thousand-national code corresponding to the character to be inserted before obtaining the screenshot of the character;
a fourth determining module, configured to determine whether a mapping relationship between the first font in the font library and the ten-thousand-country code is established;
and the fifth determining module is used for determining that the font of the character to be inserted does not exist in the font corresponding to the first font when the first font does not establish the mapping relation with the Wan national code.
8. The apparatus of claim 6, wherein the computing module is specifically configured to:
and comparing the pixel value of the target bitmap with the pixel value of the screenshot to obtain the similarity between the target bitmap and the screenshot.
9. An electronic device is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor and the communication interface are used for realizing mutual communication by the memory through the communication bus;
a memory for storing a computer program;
a processor for implementing the method steps of any one of claims 1 to 5 when executing a program stored in the memory.
10. A readable storage medium, characterized in that a computer program is stored in the readable storage medium, which computer program, when being executed by a processor, carries out the method steps of any one of claims 1-5.
CN201910486586.XA 2019-06-05 2019-06-05 Document editing method and device, electronic equipment and readable storage medium Pending CN112052647A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910486586.XA CN112052647A (en) 2019-06-05 2019-06-05 Document editing method and device, electronic equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910486586.XA CN112052647A (en) 2019-06-05 2019-06-05 Document editing method and device, electronic equipment and readable storage medium

Publications (1)

Publication Number Publication Date
CN112052647A true CN112052647A (en) 2020-12-08

Family

ID=73609315

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910486586.XA Pending CN112052647A (en) 2019-06-05 2019-06-05 Document editing method and device, electronic equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN112052647A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113051235A (en) * 2021-04-22 2021-06-29 平安普惠企业管理有限公司 Document loading method and device, terminal and storage medium
CN116776828A (en) * 2023-08-28 2023-09-19 福昕鲲鹏(北京)信息科技有限公司 Text rendering method, device, equipment and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101025733A (en) * 2006-02-20 2007-08-29 佳能株式会社 Information processing apparatus and control method thereof
CN102375883A (en) * 2010-08-02 2012-03-14 塞拉特姆股份有限公司 Font matching
CN103400127A (en) * 2013-08-05 2013-11-20 苏州鼎富软件科技有限公司 Picture and text identifying method
CN107844463A (en) * 2016-09-19 2018-03-27 奥多比公司 The font of view-based access control model similitude is replaced
CN107943760A (en) * 2017-11-22 2018-04-20 万兴科技股份有限公司 Font optimization method, device, terminal device and the storage medium of PDF document editor
CN109784146A (en) * 2018-12-05 2019-05-21 广州企图腾科技有限公司 A kind of font type recognition methods, electronic equipment, storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101025733A (en) * 2006-02-20 2007-08-29 佳能株式会社 Information processing apparatus and control method thereof
CN102375883A (en) * 2010-08-02 2012-03-14 塞拉特姆股份有限公司 Font matching
CN103400127A (en) * 2013-08-05 2013-11-20 苏州鼎富软件科技有限公司 Picture and text identifying method
CN107844463A (en) * 2016-09-19 2018-03-27 奥多比公司 The font of view-based access control model similitude is replaced
CN107943760A (en) * 2017-11-22 2018-04-20 万兴科技股份有限公司 Font optimization method, device, terminal device and the storage medium of PDF document editor
CN109784146A (en) * 2018-12-05 2019-05-21 广州企图腾科技有限公司 A kind of font type recognition methods, electronic equipment, storage medium

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113051235A (en) * 2021-04-22 2021-06-29 平安普惠企业管理有限公司 Document loading method and device, terminal and storage medium
CN116776828A (en) * 2023-08-28 2023-09-19 福昕鲲鹏(北京)信息科技有限公司 Text rendering method, device, equipment and storage medium
CN116776828B (en) * 2023-08-28 2023-12-19 福昕鲲鹏(北京)信息科技有限公司 Text rendering method, device, equipment and storage medium

Similar Documents

Publication Publication Date Title
CN109801347B (en) Method, device, equipment and medium for generating editable image template
US20190228058A1 (en) Intelligent Verification of Presentation of a User Interface
CN111368562B (en) Method and device for translating characters in picture, electronic equipment and storage medium
CN111124564A (en) Method and device for displaying user interface
CN112052647A (en) Document editing method and device, electronic equipment and readable storage medium
CN114218890A (en) Page rendering method and device, electronic equipment and storage medium
CN109656652B (en) Webpage chart drawing method, device, computer equipment and storage medium
JP2019522847A (en) Method, device and terminal device for extracting data
CN112233669A (en) Speech content prompting method and system
CN113392660A (en) Page translation method and device, electronic equipment and storage medium
CN111428452B (en) Annotation data storage method and device
CN109977423B (en) Method and device for processing word, electronic equipment and readable storage medium
CN113886748A (en) Method, device and equipment for generating editing information and outputting information of webpage content
CN111475156B (en) Page code generation method and device, electronic equipment and storage medium
CN113076165A (en) Page checking method and device
CN112861504A (en) Text interaction method, device, equipment, storage medium and program product
CN112800373A (en) Webpage resource data generation method and device, computer equipment and storage medium
CN112487759A (en) Document page number setting method and device, electronic equipment and storage medium
CN112001988A (en) Animation effect generation method and device
CN111259662B (en) Method and device for processing text
CN112307391A (en) Method and device for displaying vector graphics on webpage, electronic equipment and storage medium
CN111338941B (en) Information processing method and device, electronic equipment and storage medium
CN112783395B (en) Method, device, electronic equipment and medium for displaying form field
CN112181240B (en) Information display method and device
CN114442897B (en) Text processing method and device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination