CN111369441A - Word processing method, medium, device and apparatus - Google Patents

Word processing method, medium, device and apparatus Download PDF

Info

Publication number
CN111369441A
CN111369441A CN202010156117.4A CN202010156117A CN111369441A CN 111369441 A CN111369441 A CN 111369441A CN 202010156117 A CN202010156117 A CN 202010156117A CN 111369441 A CN111369441 A CN 111369441A
Authority
CN
China
Prior art keywords
character
zoomed
processed
path control
word
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.)
Granted
Application number
CN202010156117.4A
Other languages
Chinese (zh)
Other versions
CN111369441B (en
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.)
Gaoding Xiamen Technology Co Ltd
Original Assignee
Gaoding Xiamen Technology 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 Gaoding Xiamen Technology Co Ltd filed Critical Gaoding Xiamen Technology Co Ltd
Priority to CN202010156117.4A priority Critical patent/CN111369441B/en
Publication of CN111369441A publication Critical patent/CN111369441A/en
Application granted granted Critical
Publication of CN111369441B publication Critical patent/CN111369441B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformation in the plane of the image
    • G06T3/40Scaling the whole image or part thereof

Abstract

The invention discloses a word processing method and a word processing device, wherein the method comprises the following steps: acquiring path information of each character to be processed, calculating a corresponding bounding box according to path control points in the path information, calculating a corresponding character center according to the bounding box, defining a local coordinate system taking the character center as a coordinate center, zooming the path control points of each character to be processed according to zooming multiples, and calculating the path control points in a world coordinate system according to the path control points of each zoomed character in the corresponding local coordinate system; calculating a bounding box corresponding to each zoomed character according to the path control point under the world coordinate system, and calculating the center of each zoomed character and the width of the character according to the bounding box; obtaining each final zoomed character according to the center and the width of the character; therefore, the invention randomly scales each character path information according to the scaling multiple, thereby improving the character processing efficiency and improving the user experience.

Description

Word processing method, medium, device and apparatus
Technical Field
The present invention relates to the field of word processing technologies, and in particular, to a word processing method, a computer-readable storage medium, a computer device, and a word processing apparatus.
Background
In the related art, in order to achieve a certain artistic effect in the application process of the characters, the characters generally need to be zoomed, the zoom size of the characters cannot be randomly changed according to the requirements at present, and the zoom process is complex and easily affects the zoom efficiency, so that the user experience is reduced.
Disclosure of Invention
The present invention is directed to solving, at least to some extent, one of the technical problems in the art described above. Therefore, an object of the present invention is to provide a method for processing words, in which each word is randomly scaled according to the path information of each word, so as to improve the word processing efficiency and improve the user experience.
A second object of the invention is to propose a computer-readable storage medium.
A third object of the invention is to propose a computer device.
A fourth object of the present invention is to provide a word processing apparatus.
In order to achieve the above object, an embodiment of a first aspect of the present invention provides a method for processing a word, including: acquiring path information of each character to be processed, wherein the path information comprises path control points; calculating a corresponding bounding box of each character to be processed according to the path control point of each character to be processed, and calculating the center of each corresponding character to be processed according to the bounding box of each character to be processed; moving the coordinate center of a world coordinate system to the center of each character to be processed, and defining a local coordinate system corresponding to each character to be processed; obtaining the zoom factor of each character to be processed, zooming the path control point of each character to be processed according to the zoom factor of each character to be processed to obtain the path control point of each zoomed character in the corresponding local coordinate system, and calculating the path control point of each zoomed character in the world coordinate system according to the path control point of each zoomed character in the corresponding local coordinate system; calculating a bounding box corresponding to each zoomed character according to the path control point of each zoomed character under the world coordinate system, calculating the center of each zoomed character according to the bounding box of each zoomed character, and calculating the width of each zoomed character according to the bounding box of each zoomed character; and obtaining each final zoomed character according to the center of each zoomed character and the width of each zoomed character.
According to the word processing method provided by the embodiment of the invention, path information of each word to be processed is obtained firstly, wherein the path information comprises path control points; then, calculating a corresponding bounding box of each character to be processed according to the path control point of each character to be processed, and calculating the center of each corresponding character to be processed according to the bounding box of each character to be processed; then moving the coordinate center of the world coordinate system to the center of each character to be processed, and defining a local coordinate system corresponding to each character to be processed; then, obtaining the zoom multiple of each character to be processed, zooming the path control point of each character to be processed according to the zoom multiple of each character to be processed to obtain the path control point of each zoomed character under the corresponding local coordinate system, and calculating the path control point of each zoomed character under the world coordinate system according to the path control point of each zoomed character under the corresponding local coordinate system; then calculating a bounding box corresponding to each zoomed character according to a path control point of each zoomed character under a world coordinate system, calculating the center of each zoomed character corresponding to each zoomed character according to the bounding box of each zoomed character, and calculating the width of each zoomed character corresponding to each zoomed character according to the bounding box of each zoomed character; finally, each zoomed character is obtained according to the center of each zoomed character and the width of each zoomed character; therefore, the invention randomly scales each character path information according to the scaling multiple, thereby improving the character processing efficiency and improving the user experience.
In addition, the word processing method proposed by the above embodiment of the present invention may further have the following additional technical features:
optionally, obtaining each final zoomed character according to the center of each zoomed character and the width of each zoomed character, including: acquiring the word space of each zoomed character; sequentially arranging each zoomed character according to the center of each zoomed character and the width of each zoomed character; and adjusting the distance between the bounding boxes of each zoomed character according to the character spacing to obtain the final each zoomed character.
Optionally, the bounding box for each word to be processed is calculated according to the following formula:
Figure BDA0002404100560000021
Figure BDA0002404100560000022
Figure BDA0002404100560000023
Figure BDA0002404100560000024
wherein, PixAbscissa, P, of ith path control point representing the word to be processediyThe coordinate of the vertical axis of the ith path control point representing the word to be processed,
Figure BDA0002404100560000025
the maximum horizontal axis coordinate of the bounding box is expressed, the maximum horizontal axis coordinate in all path control points of the characters to be processed is taken,
Figure BDA0002404100560000026
the maximum ordinate of the bounding box is shown, the maximum ordinate of all path control points of the word to be processed is taken,
Figure BDA0002404100560000027
the minimum horizontal axis coordinate of the bounding box is expressed, the minimum horizontal axis coordinate in all path control points of the character to be processed is taken,
Figure BDA0002404100560000028
and (3) representing the minimum vertical axis coordinate of the bounding box, and taking the minimum vertical axis coordinate of all path control points of the characters to be processed.
Optionally, the center of each word to be processed is calculated according to the following formula:
Figure BDA0002404100560000031
Figure BDA0002404100560000032
wherein, PcxCoordinate of the horizontal axis, P, representing the centre of the word to be processedcyThe vertical axis coordinate of the center of the word to be processed is shown.
Optionally, the path control point of each zoomed character in the world coordinate system is calculated according to the following formula:
Pnix=(Pix-Pcx)×S
Pniy=(Piy-Pcy)×S
Pnniy=Pnix+Pcx
Pnniy=Pniy+Pcy
wherein, PnixThe horizontal axis coordinate, P, of the ith path control point in the corresponding local coordinate systemniyThe vertical axis coordinate of the ith path control point of the zoomed character in the corresponding local coordinate system is shown, S is the zoom multiple, P isnniyCoordinate of the horizontal axis, P, representing the ith path control point of the scaled text in the world coordinate systemnniyAnd the vertical axis coordinate of the ith path control point of the zoomed character in the world coordinate system is shown.
Optionally, the bounding box for each scaled word is calculated according to the following formula:
Figure BDA0002404100560000035
Figure BDA0002404100560000036
Figure BDA0002404100560000037
Figure BDA0002404100560000038
wherein the content of the first and second substances,
Figure BDA0002404100560000034
the maximum horizontal axis coordinate of the bounding box representing the zoomed characters is taken as the maximum horizontal axis coordinate of all path control points of the zoomed characters in the world coordinate system,
Figure BDA0002404100560000033
the maximum vertical axis coordinate of the bounding box of the zoomed characters is taken, the maximum vertical axis coordinate of all path control points of the zoomed characters under the world coordinate system is taken,
Figure BDA0002404100560000039
the minimum horizontal axis coordinate of the bounding box representing the zoomed characters is taken as the minimum horizontal axis coordinate of all path control points of the zoomed characters in the world coordinate system,
Figure BDA00024041005600000310
and taking the minimum vertical axis coordinate of all path control points of the zoomed characters in the world coordinate system.
Optionally, the center of each scaled text and the width of each scaled text are calculated according to the following formulas:
Figure BDA0002404100560000041
Figure BDA0002404100560000042
Figure BDA0002404100560000043
wherein, PncxCoordinate of horizontal axis, P, representing center of zoomed characterncyOrdinate, P, representing the centre of the scaled textnwRepresenting the width of the scaled text.
In order to achieve the above object, a second embodiment of the present invention provides a computer-readable storage medium, on which a word processing program is stored, and the word processing program, when executed by a processor, implements the word processing method as described above.
According to the computer-readable storage medium of the embodiment of the invention, the word processing program is stored, so that the processor can realize the word processing method when executing the word processing program, thereby improving the word processing efficiency and improving the user experience.
In order to achieve the above object, a third embodiment of the present invention provides a computer device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and when the processor executes the computer program, the word processing method as described above is implemented.
According to the computer equipment provided by the embodiment of the invention, the computer program capable of running on the processor is stored through the memory, so that the processor can realize the word processing method when executing the computer program, thereby improving the word processing efficiency and improving the user experience.
In order to achieve the above object, a fourth aspect of the present invention provides a word processing apparatus, including: the device comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is used for acquiring path information of each character to be processed, and the path information comprises path control points; the first calculation module is used for calculating the corresponding bounding box of each character to be processed according to the path control point of each character to be processed and calculating the center of each corresponding character to be processed according to the bounding box of each character to be processed; the defining module is used for moving the coordinate center of the world coordinate system to the center of each character to be processed and defining a local coordinate system corresponding to each character to be processed; the zooming module is used for obtaining the zooming multiple of each character to be processed, zooming the path control point of each character to be processed according to the zooming multiple of each character to be processed so as to obtain the path control point of each zoomed character under the corresponding local coordinate system, and calculating the path control point of each zoomed character under the world coordinate system according to the path control point of each zoomed character under the corresponding local coordinate system; the second calculation module is used for calculating a bounding box corresponding to each zoomed character according to the path control point of each zoomed character under the world coordinate system, calculating the center of each corresponding zoomed character according to the bounding box of each zoomed character, and calculating the width of each corresponding zoomed character according to the bounding box of each zoomed character; and the processing module is used for acquiring each final zoomed character according to the center of each zoomed character and the width of each zoomed character.
According to the word processing device provided by the embodiment of the invention, the path information of each word to be processed is obtained through the obtaining module, the corresponding bounding box of each word to be processed is calculated according to the path control point in the path information of each word to be processed through the first calculating module, the center of each corresponding word to be processed is calculated according to the bounding box of each word to be processed, the coordinate center of the world coordinate system is moved to the center of each word to be processed through the defining module, the local coordinate system corresponding to each word to be processed is defined, the zoom factor of each word to be processed is obtained through the zooming module, the path control point of each word to be processed is zoomed according to the zoom factor of each word to be processed, the path control point of each zoomed word to be zoomed under the corresponding local coordinate system is obtained, and the corresponding path control point of each zoomed is calculated according to the path control point of each zoomed under the corresponding local coordinate system The method comprises the steps that path control points of characters in a world coordinate system are calculated through a second calculation module according to the path control points of the zoomed characters in the world coordinate system, a bounding box corresponding to each zoomed character is calculated according to the bounding box of each zoomed character, the center of each zoomed character is calculated according to the bounding box of each zoomed character, the width of each zoomed character is calculated according to the bounding box of each zoomed character, and finally each zoomed character is obtained through a processing module according to the center of each zoomed character and the width of each zoomed character; therefore, the invention randomly scales each character path information according to the scaling multiple, thereby improving the character processing efficiency and improving the user experience.
Drawings
FIG. 1 is a flow chart illustrating a method for processing a word according to an embodiment of the present invention;
FIG. 2 is a diagram illustrating path information of a word to be processed according to an embodiment of the present invention;
FIG. 3 is a diagram illustrating a word to be processed according to an embodiment of the present invention;
FIG. 4 is a schematic illustration of processed text according to an embodiment of the invention;
FIG. 5 is a schematic illustration of processed text according to an embodiment of the invention;
FIG. 6 is a schematic diagram of processed text according to one embodiment of the invention;
FIG. 7 is a block diagram of a word processing device according to one embodiment of the invention.
Detailed Description
Reference will now be made in detail to embodiments of the present invention, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the drawings are illustrative and intended to be illustrative of the invention and are not to be construed as limiting the invention.
In order to better understand the above technical solutions, exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the invention are shown in the drawings, it should be understood that the invention can be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the invention to those skilled in the art.
In order to better understand the technical solution, the technical solution will be described in detail with reference to the drawings and the specific embodiments.
FIG. 1 is a flow chart illustrating a method for processing a word according to an embodiment of the present invention; as shown in fig. 1, the word processing method according to the embodiment of the present invention includes the following steps:
step 101, obtaining path information of each word to be processed, wherein the path information comprises path control points.
As an embodiment, the path information of each word to be processed comprises a plurality of sections of closed paths, and each section of closed path is formed by connecting a plurality of sections of straight lines and/or quadratic Bezier curves end to end.
As a specific embodiment, as shown in FIG. 2, a certain character has two closed paths, the first path is composed of a straight line 1-2, a quadratic Bezier curve 2-3-4, a straight line 4-5 and a quadratic Bezier curve 5-6-1, and the clockwise connection is an outer contour; the second section of path is composed of a quadratic Bezier curve 7-8-9, a straight line 9-10 and a straight line 10-7 which are connected in a counterclockwise mode and are inner contours, wherein points 1-10 are path control points.
It should be noted that the character string is composed of a plurality of words, and for each word of the character string input by the user, corresponding path information can be found in the font file (e.g., ttf format).
And 102, calculating a corresponding bounding box of each character to be processed according to the path control point of each character to be processed, and calculating the center of each corresponding character to be processed according to the bounding box of each character to be processed.
That is, after the path information of the word to be processed is acquired, the bounding box of the word to be processed is calculated according to the path control point in the path information, and the word center of the word to be processed is calculated according to the bounding box of the word to be processed.
It should be noted that after the path information of the word to be processed is obtained, path control points of all outer contours of the word to be processed can be obtained through the path information, and a bounding box of the word to be processed is calculated according to the path control points of all outer contours of the word to be processed; or acquiring all path control points (including an outer contour and an inner contour) of the character to be processed through the path information, and calculating the bounding box of the character to be processed according to all the path control points of the character to be processed.
As a specific example, the bounding box for each word to be processed is calculated according to the following formula:
Figure BDA0002404100560000061
Figure BDA0002404100560000062
Figure BDA0002404100560000063
Figure BDA0002404100560000064
wherein, PixAbscissa, P, of ith path control point representing the word to be processediyThe coordinate of the vertical axis of the ith path control point representing the word to be processed,
Figure BDA0002404100560000065
the maximum horizontal axis coordinate of the bounding box is expressed, the maximum horizontal axis coordinate in all path control points of the characters to be processed is taken,
Figure BDA0002404100560000066
the maximum ordinate of the bounding box is shown, the maximum ordinate of all path control points of the word to be processed is taken,
Figure BDA0002404100560000073
the minimum horizontal axis coordinate of the bounding box is expressed, the minimum horizontal axis coordinate in all path control points of the character to be processed is taken,
Figure BDA0002404100560000074
and (3) representing the minimum vertical axis coordinate of the bounding box, and taking the minimum vertical axis coordinate of all path control points of the characters to be processed.
It should be noted that, in the above formula, the value range of i is a positive integer greater than 1; and is composed of
Figure BDA0002404100560000075
And
Figure BDA0002404100560000076
coordinates of the composition:
Figure BDA0002404100560000077
and
Figure BDA0002404100560000078
four vertex coordinates of the bounding box.
As a specific example, the center of each word to be processed is calculated according to the following formula:
Figure BDA0002404100560000071
Figure BDA0002404100560000072
wherein, PcxCoordinate of the horizontal axis, P, representing the centre of the word to be processedcyThe vertical axis coordinate of the center of the word to be processed is shown.
And 103, moving the coordinate center of the world coordinate system to the center of each character to be processed, and defining a local coordinate system corresponding to each character to be processed.
That is, the coordinate center of the original world coordinate system is moved to the center of the word to be processed, and a new local coordinate system taking the center of the word to be processed as the coordinate center is defined; thus, each word to be processed defines a local coordinate system corresponding to the word to be processed.
And 104, acquiring the zoom multiple of each character to be processed, zooming the path control point of each character to be processed according to the zoom multiple of each character to be processed to acquire the path control point of each zoomed character in the corresponding local coordinate system, and calculating the path control point of each zoomed character in the world coordinate system according to the path control point of each zoomed character in the corresponding local coordinate system.
It should be noted that, the user can input the zoom factor of the word to be processed in a user-defined manner according to the zoom requirement; that is to say, the zoom factor is the adjustable amount input by the user, and the corresponding word to be processed is zoomed according to the zoom factor of each word to be processed.
As a specific embodiment, the path control point of each scaled character in the world coordinate system is calculated according to the following formula:
Pnix=(Pix-Pcx)×S
Pniy=(Piy-Pcy)×S
Pnniy=Pnix+Pcx
Pnniy=Pniy+Pcy
wherein, PnixThe horizontal axis coordinate, P, of the ith path control point in the corresponding local coordinate systemniyThe vertical axis coordinate of the ith path control point of the zoomed character in the corresponding local coordinate system is shown, S is the zoom multiple, P isnniyCoordinate of the horizontal axis, P, representing the ith path control point of the scaled text in the world coordinate systemnniyAnd the vertical axis coordinate of the ith path control point of the zoomed character in the world coordinate system is shown.
That is, before the word to be processed is zoomed, the coordinate system is transformed, a local coordinate system with the center of the word to be processed as the origin of coordinates is defined, and after the word to be processed is zoomed, the coordinate system is restored to the original coordinate system (world coordinate system).
And 105, calculating a bounding box corresponding to each zoomed character according to the path control point of each zoomed character in the world coordinate system, calculating the center of each zoomed character according to the bounding box of each zoomed character, and calculating the width of each zoomed character according to the bounding box of each zoomed character.
As a specific example, the bounding box for each scaled word is calculated according to the following formula:
Figure BDA0002404100560000087
Figure BDA0002404100560000088
Figure BDA0002404100560000089
Figure BDA00024041005600000810
wherein the content of the first and second substances,
Figure BDA0002404100560000083
the maximum horizontal axis coordinate of the bounding box representing the zoomed characters is taken as the maximum horizontal axis coordinate of all path control points of the zoomed characters in the world coordinate system,
Figure BDA0002404100560000084
the maximum vertical axis coordinate of the bounding box of the zoomed characters is taken, the maximum vertical axis coordinate of all path control points of the zoomed characters under the world coordinate system is taken,
Figure BDA0002404100560000085
the minimum horizontal axis coordinate of the bounding box representing the zoomed characters is taken as the minimum horizontal axis coordinate of all path control points of the zoomed characters in the world coordinate system,
Figure BDA0002404100560000086
and taking the minimum vertical axis coordinate of all path control points of the zoomed characters in the world coordinate system.
As a specific example, the center of each scaled word and the width of each scaled word are calculated according to the following formulas:
Figure BDA0002404100560000081
Figure BDA0002404100560000082
Figure BDA0002404100560000091
wherein, PncxCoordinate of horizontal axis, P, representing center of zoomed characterncyOrdinate, P, representing the centre of the scaled textnwRepresenting the width of the scaled text.
And step 106, acquiring each final zoomed character according to the center of each zoomed character and the width of each zoomed character.
It should be noted that each zoomed character can be obtained according to the path control point of each zoomed character in the world coordinate system, and then the space between the obtained plurality of zoomed characters is re-planned according to the center of each zoomed character and the width of each zoomed character, so as to obtain the final position of each zoomed character.
As a specific embodiment, obtaining each final zoomed character according to the center of each zoomed character and the width of each zoomed character includes: acquiring the word space of each zoomed character; sequentially arranging each zoomed character according to the sequence of the original characters according to the center of each zoomed character and the width of each zoomed character; and adjusting the distance between the bounding boxes of each zoomed character according to the character spacing to obtain the final each zoomed character.
It should be noted that, the user can input the word space of the word to be processed in a user-defined manner according to the requirement; that is, the word space is an adjustable amount input by the user, and the distance between the bounding boxes of each scaled character is adjusted according to the word space to obtain the final each scaled character.
As a specific embodiment, fig. 3 is a schematic diagram of characters to be processed, each character in fig. 3 is processed by the above method, and different processing results are obtained according to different processing requirements, where fig. 4 to 6 are schematic diagrams of characters processed according to different requirements.
In summary, according to the word processing method of the embodiment of the present invention, path information of each word to be processed is first obtained, where the path information includes a path control point; then, calculating a corresponding bounding box of each character to be processed according to the path control point of each character to be processed, and calculating the center of each corresponding character to be processed according to the bounding box of each character to be processed; then moving the coordinate center of the world coordinate system to the center of each character to be processed, and defining a local coordinate system corresponding to each character to be processed; then, obtaining the zoom multiple of each character to be processed, zooming the path control point of each character to be processed according to the zoom multiple of each character to be processed to obtain the path control point of each zoomed character under the corresponding local coordinate system, and calculating the path control point of each zoomed character under the world coordinate system according to the path control point of each zoomed character under the corresponding local coordinate system; then calculating a bounding box corresponding to each zoomed character according to a path control point of each zoomed character under a world coordinate system, calculating the center of each zoomed character corresponding to each zoomed character according to the bounding box of each zoomed character, and calculating the width of each zoomed character corresponding to each zoomed character according to the bounding box of each zoomed character; finally, each zoomed character is obtained according to the center of each zoomed character and the width of each zoomed character; therefore, the invention randomly scales each character path information according to the scaling multiple, thereby improving the character processing efficiency and improving the user experience.
In addition, an embodiment of the present invention further provides a computer-readable storage medium, on which a word processing program is stored, and the word processing program, when executed by a processor, implements the word processing method as described above.
According to the computer-readable storage medium of the embodiment of the invention, the word processing program is stored, so that the processor can realize the word processing method when executing the word processing program, thereby improving the word processing efficiency and improving the user experience.
In addition, an embodiment of the present invention further provides a computer device, which includes a memory, a processor, and a computer program stored on the memory and executable on the processor, where when the processor executes the computer program, the word processing method is implemented as described above.
According to the computer equipment provided by the embodiment of the invention, the computer program capable of running on the processor is stored through the memory, so that the processor can realize the word processing method when executing the computer program, thereby improving the word processing efficiency and improving the user experience.
FIG. 7 is a block diagram of a word processing device according to one embodiment of the present invention; as shown in fig. 7, the word processing device of the present embodiment includes: an acquisition module 201, a first calculation module 202, a definition module 203, a scaling module 204, a second calculation module 205 and a processing module 206.
The obtaining module 201 is configured to obtain path information of each word to be processed, where the path information includes a path control point; the first calculating module 202 is configured to calculate a bounding box of each corresponding word to be processed according to the path control point of each word to be processed, and calculate a center of each corresponding word to be processed according to the bounding box of each word to be processed; the defining module 203 is used for moving the coordinate center of the world coordinate system to the center of each character to be processed and defining a local coordinate system corresponding to each character to be processed; the scaling module 204 is configured to obtain a scaling multiple of each to-be-processed word, scale the path control point of each to-be-processed word according to the scaling multiple of each to-be-processed word, so as to obtain a path control point of each scaled word in the corresponding local coordinate system, and calculate a path control point of each scaled word in the world coordinate system according to the path control point of each scaled word in the corresponding local coordinate system; the second calculating module 205 is configured to calculate a bounding box corresponding to each zoomed character according to a path control point of each zoomed character in the world coordinate system, calculate a center of each zoomed character according to the bounding box of each zoomed character, and calculate a width of each zoomed character according to the bounding box of each zoomed character; the processing module 206 is configured to obtain each final zoomed character according to the center of each zoomed character and the width of each zoomed character.
Further, the processing module 206 is further configured to obtain a word space of each scaled word; sequentially arranging each zoomed character according to the center of each zoomed character and the width of each zoomed character; and adjusting the distance between the bounding boxes of each zoomed character according to the character spacing to obtain the final each zoomed character.
Further, the bounding box for each word to be processed is calculated according to the following formula:
Figure BDA0002404100560000113
Figure BDA0002404100560000114
Figure BDA0002404100560000115
Figure BDA0002404100560000116
wherein, PixAbscissa, P, of ith path control point representing the word to be processediyThe coordinate of the vertical axis of the ith path control point representing the word to be processed,
Figure BDA0002404100560000117
the maximum horizontal axis coordinate of the bounding box is expressed, the maximum horizontal axis coordinate in all path control points of the characters to be processed is taken,
Figure BDA0002404100560000118
the maximum ordinate of the bounding box is shown, the maximum ordinate of all path control points of the word to be processed is taken,
Figure BDA0002404100560000119
the minimum horizontal axis coordinate of the bounding box is expressed, the minimum horizontal axis coordinate in all path control points of the character to be processed is taken,
Figure BDA00024041005600001110
and (3) representing the minimum vertical axis coordinate of the bounding box, and taking the minimum vertical axis coordinate of all path control points of the characters to be processed.
Further, the center of each word to be processed is calculated according to the following formula:
Figure BDA0002404100560000111
Figure BDA0002404100560000112
wherein, PcxCoordinate of the horizontal axis, P, representing the centre of the word to be processedcyThe vertical axis coordinate of the center of the word to be processed is shown.
Further, calculating a path control point of each zoomed character under the world coordinate system according to the following formula:
Pnix=(Pix-Pcx)×S
Pniy=(Piy-Pcy)×S
Pnniy=Pnix+Pcx
Pnniy=Pniy+Pcy
wherein, PnixThe horizontal axis coordinate, P, of the ith path control point in the corresponding local coordinate systemniyThe vertical axis coordinate of the ith path control point of the zoomed character in the corresponding local coordinate system is shown, S is the zoom multiple, P isnniyCoordinate of the horizontal axis, P, representing the ith path control point of the scaled text in the world coordinate systemnniyAnd the vertical axis coordinate of the ith path control point of the zoomed character in the world coordinate system is shown.
Further, the bounding box for each scaled word is calculated according to the following formula:
Figure BDA0002404100560000123
Figure BDA0002404100560000124
Figure BDA0002404100560000125
Figure BDA0002404100560000126
wherein the content of the first and second substances,
Figure BDA0002404100560000127
the maximum horizontal axis coordinate of the bounding box representing the zoomed characters is taken as all the coordinates of the zoomed characters under the world coordinate systemThe largest abscissa coordinate among the path control points,
Figure BDA0002404100560000128
the maximum vertical axis coordinate of the bounding box of the zoomed characters is taken, the maximum vertical axis coordinate of all path control points of the zoomed characters under the world coordinate system is taken,
Figure BDA0002404100560000129
the minimum horizontal axis coordinate of the bounding box representing the zoomed characters is taken as the minimum horizontal axis coordinate of all path control points of the zoomed characters in the world coordinate system,
Figure BDA00024041005600001210
and taking the minimum vertical axis coordinate of all path control points of the zoomed characters in the world coordinate system.
Further, the center of each scaled letter and the width of each scaled letter are calculated according to the following formulas:
Figure BDA0002404100560000121
Figure BDA0002404100560000122
Figure BDA00024041005600001211
wherein, PncxCoordinate of horizontal axis, P, representing center of zoomed characterncyOrdinate, P, representing the centre of the scaled textnwRepresenting the width of the scaled text.
It should be noted that the foregoing explanations on the embodiments of the word processing method are also applicable to the word processing device of the present embodiment, and are not repeated herein.
To sum up, according to the word processing apparatus in the embodiment of the present invention, the obtaining module obtains the path information of each word to be processed, the first calculating module calculates the bounding box of each corresponding word to be processed according to the path control point in the path information of each word to be processed, and calculates the center of each corresponding word to be processed according to the bounding box of each word to be processed, the defining module moves the coordinate center of the world coordinate system to the center of each word to be processed, and defines the local coordinate system corresponding to each word to be processed, the scaling module obtains the scaling factor of each word to be processed, and scales the path control point of each word to be processed according to the scaling factor of each word to be processed, so as to obtain the path control point of each scaled word in the corresponding local coordinate system, and calculates each corresponding path control point according to the path control point of each scaled word in the corresponding local coordinate system The method comprises the steps that path control points of zoomed characters under a world coordinate system are obtained, then a bounding box corresponding to each zoomed character is calculated through a second calculation module according to the path control points of each zoomed character under the world coordinate system, the center of each zoomed character is calculated according to the bounding box of each zoomed character, the width of each zoomed character is calculated according to the bounding box of each zoomed character, and finally each zoomed character is obtained through a processing module according to the center of each zoomed character and the width of each zoomed character; therefore, the invention randomly scales each character path information according to the scaling multiple, thereby improving the character processing efficiency and improving the user experience.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
It should be noted that in the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention may be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by one and the same item of hardware. The usage of the words first, second and third, etcetera do not indicate any ordering. These words may be interpreted as names.
While preferred embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all such alterations and modifications as fall within the scope of the invention.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present invention without departing from the spirit and scope of the invention. Thus, if such modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include such modifications and variations.
In the description of the present invention, it is to be understood that the terms "first", "second" and the like are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implying any number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of the present invention, "a plurality" means two or more unless specifically defined otherwise.
In the present invention, unless otherwise expressly stated or limited, the terms "mounted," "connected," "secured," and the like are to be construed broadly and can, for example, be fixedly connected, detachably connected, or integrally formed; can be mechanically or electrically connected; either directly or indirectly through intervening media, either internally or in any other relationship. The specific meanings of the above terms in the present invention can be understood by those skilled in the art according to specific situations.
In the present invention, unless otherwise expressly stated or limited, the first feature "on" or "under" the second feature may be directly contacting the first and second features or indirectly contacting the first and second features through an intermediate. Also, a first feature "on," "over," and "above" a second feature may be directly or diagonally above the second feature, or may simply indicate that the first feature is at a higher level than the second feature. A first feature being "under," "below," and "beneath" a second feature may be directly under or obliquely under the first feature, or may simply mean that the first feature is at a lesser elevation than the second feature.
In the description herein, references to the description of the term "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., mean that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, the schematic representations of the terms used above should not be understood to necessarily refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, various embodiments or examples and features of different embodiments or examples described in this specification can be combined and combined by one skilled in the art without contradiction.
Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention, and that variations, modifications, substitutions and alterations can be made to the above embodiments by those of ordinary skill in the art within the scope of the present invention.

Claims (10)

1. A method of word processing, comprising the steps of:
acquiring path information of each character to be processed, wherein the path information comprises path control points;
calculating a corresponding bounding box of each character to be processed according to the path control point of each character to be processed, and calculating the center of each corresponding character to be processed according to the bounding box of each character to be processed;
moving the coordinate center of a world coordinate system to the center of each character to be processed, and defining a local coordinate system corresponding to each character to be processed;
obtaining the zoom factor of each character to be processed, zooming the path control point of each character to be processed according to the zoom factor of each character to be processed to obtain the path control point of each zoomed character in the corresponding local coordinate system, and calculating the path control point of each zoomed character in the world coordinate system according to the path control point of each zoomed character in the corresponding local coordinate system;
calculating a bounding box corresponding to each zoomed character according to the path control point of each zoomed character under the world coordinate system, calculating the center of each zoomed character according to the bounding box of each zoomed character, and calculating the width of each zoomed character according to the bounding box of each zoomed character;
and obtaining each final zoomed character according to the center of each zoomed character and the width of each zoomed character.
2. The word processing method of claim 1 wherein obtaining each final scaled word based on the center of each scaled word and the width of each scaled word comprises:
acquiring the word space of each zoomed character;
sequentially arranging each zoomed character according to the center of each zoomed character and the width of each zoomed character;
and adjusting the distance between the bounding boxes of each zoomed character according to the character spacing to obtain the final each zoomed character.
3. The word processing method of claim 1, wherein the bounding box for each word to be processed is calculated according to the formula:
Figure FDA0002404100550000011
Figure FDA0002404100550000012
Figure FDA0002404100550000013
Figure FDA0002404100550000014
wherein, PixAbscissa, P, of ith path control point representing the word to be processediyThe coordinate of the vertical axis of the ith path control point representing the word to be processed,
Figure FDA0002404100550000021
the maximum horizontal axis coordinate of the bounding box is expressed, the maximum horizontal axis coordinate in all path control points of the characters to be processed is taken,
Figure FDA0002404100550000022
the maximum ordinate of the bounding box is shown, the maximum ordinate of all path control points of the word to be processed is taken,
Figure FDA0002404100550000023
the minimum horizontal axis coordinate of the bounding box is expressed, the minimum horizontal axis coordinate in all path control points of the character to be processed is taken,
Figure FDA0002404100550000024
and (3) representing the minimum vertical axis coordinate of the bounding box, and taking the minimum vertical axis coordinate of all path control points of the characters to be processed.
4. The word processing method of claim 3, wherein the center of each word to be processed is calculated according to the following formula:
Figure FDA0002404100550000025
Figure FDA0002404100550000026
wherein, PcxCoordinate of the horizontal axis, P, representing the centre of the word to be processedcyThe vertical axis coordinate of the center of the word to be processed is shown.
5. The word processing method of claim 4, wherein the path control point of each scaled word in the world coordinate system is calculated according to the following formula:
Pnix=(Pix-Pcx)×S
Pniy=(Piy-Pcy)×S
Pnniy=Pnix+Pcx
Pnniy=Pniy+Pcy
wherein, PnixThe horizontal axis coordinate, P, of the ith path control point in the corresponding local coordinate systemniyThe vertical axis coordinate of the ith path control point of the zoomed character in the corresponding local coordinate system is shown, S is the zoom multiple, P isnniyCoordinate of the horizontal axis, P, representing the ith path control point of the scaled text in the world coordinate systemnniyAnd the vertical axis coordinate of the ith path control point of the zoomed character in the world coordinate system is shown.
6. The word processing method of claim 5, wherein the bounding box for each scaled word is calculated according to the following formula:
Figure FDA0002404100550000027
Figure FDA0002404100550000028
Figure FDA0002404100550000029
Figure FDA0002404100550000031
wherein the content of the first and second substances,
Figure FDA0002404100550000032
the maximum horizontal axis coordinate of the bounding box representing the zoomed characters is taken as the maximum horizontal axis coordinate of all path control points of the zoomed characters in the world coordinate system,
Figure FDA0002404100550000033
the maximum vertical axis coordinate of the bounding box of the zoomed characters is taken, the maximum vertical axis coordinate of all path control points of the zoomed characters under the world coordinate system is taken,
Figure FDA0002404100550000034
the minimum horizontal axis coordinate of the bounding box representing the zoomed characters is taken as the minimum horizontal axis coordinate of all path control points of the zoomed characters in the world coordinate system,
Figure FDA0002404100550000035
and taking the minimum vertical axis coordinate of all path control points of the zoomed characters in the world coordinate system.
7. The word processing method of claim 6, wherein the center of each scaled word and the width of each scaled word are calculated according to the following formulas:
Figure FDA0002404100550000036
Figure FDA0002404100550000037
Figure FDA0002404100550000038
wherein, PncxCoordinate of horizontal axis, P, representing center of zoomed characterncyOrdinate, P, representing the centre of the scaled textnwRepresenting the width of the scaled text.
8. A computer-readable storage medium having stored thereon a word processing program which, when executed by a processor, implements a word processing method according to any one of claims 1-7.
9. A computer device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor, when executing the computer program, implements the word processing method of any of claims 1-7.
10. A word processing device, comprising:
the device comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is used for acquiring path information of each character to be processed, and the path information comprises path control points;
the first calculation module is used for calculating the corresponding bounding box of each character to be processed according to the path control point of each character to be processed and calculating the center of each corresponding character to be processed according to the bounding box of each character to be processed;
the defining module is used for moving the coordinate center of the world coordinate system to the center of each character to be processed and defining a local coordinate system corresponding to each character to be processed;
the zooming module is used for obtaining the zooming multiple of each character to be processed, zooming the path control point of each character to be processed according to the zooming multiple of each character to be processed so as to obtain the path control point of each zoomed character under the corresponding local coordinate system, and calculating the path control point of each zoomed character under the world coordinate system according to the path control point of each zoomed character under the corresponding local coordinate system;
the second calculation module is used for calculating a bounding box corresponding to each zoomed character according to the path control point of each zoomed character under the world coordinate system, calculating the center of each corresponding zoomed character according to the bounding box of each zoomed character, and calculating the width of each corresponding zoomed character according to the bounding box of each zoomed character;
and the processing module is used for acquiring each final zoomed character according to the center of each zoomed character and the width of each zoomed character.
CN202010156117.4A 2020-03-09 2020-03-09 Word processing method, medium, device and apparatus Active CN111369441B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010156117.4A CN111369441B (en) 2020-03-09 2020-03-09 Word processing method, medium, device and apparatus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010156117.4A CN111369441B (en) 2020-03-09 2020-03-09 Word processing method, medium, device and apparatus

Publications (2)

Publication Number Publication Date
CN111369441A true CN111369441A (en) 2020-07-03
CN111369441B CN111369441B (en) 2022-11-15

Family

ID=71208648

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010156117.4A Active CN111369441B (en) 2020-03-09 2020-03-09 Word processing method, medium, device and apparatus

Country Status (1)

Country Link
CN (1) CN111369441B (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5715473A (en) * 1992-12-29 1998-02-03 Apple Computer, Inc. Method and apparatus to vary control points of an outline font to provide a set of variations for the outline font
KR20070049317A (en) * 2005-11-08 2007-05-11 엘지전자 주식회사 Method for detecting word regions using camera
EP1517231A4 (en) * 2002-03-29 2010-04-14 Enmedia System Corp Embedded curve chinese character library described based on stroke central line
US20130162838A1 (en) * 2011-12-22 2013-06-27 Pelco, Inc. Transformation between Image and Map Coordinates
CN107093172A (en) * 2016-02-18 2017-08-25 清华大学 character detecting method and system
CN109308734A (en) * 2017-07-27 2019-02-05 腾讯科技(深圳)有限公司 The generation method and its device of 3D text, equipment, storage medium
WO2019205744A1 (en) * 2018-04-28 2019-10-31 京东方科技集团股份有限公司 Image distortion correction method and apparatus, display device, computer readable medium, and electronic device

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5715473A (en) * 1992-12-29 1998-02-03 Apple Computer, Inc. Method and apparatus to vary control points of an outline font to provide a set of variations for the outline font
EP1517231A4 (en) * 2002-03-29 2010-04-14 Enmedia System Corp Embedded curve chinese character library described based on stroke central line
KR20070049317A (en) * 2005-11-08 2007-05-11 엘지전자 주식회사 Method for detecting word regions using camera
US20130162838A1 (en) * 2011-12-22 2013-06-27 Pelco, Inc. Transformation between Image and Map Coordinates
CN107093172A (en) * 2016-02-18 2017-08-25 清华大学 character detecting method and system
CN109308734A (en) * 2017-07-27 2019-02-05 腾讯科技(深圳)有限公司 The generation method and its device of 3D text, equipment, storage medium
WO2019205744A1 (en) * 2018-04-28 2019-10-31 京东方科技集团股份有限公司 Image distortion correction method and apparatus, display device, computer readable medium, and electronic device

Also Published As

Publication number Publication date
CN111369441B (en) 2022-11-15

Similar Documents

Publication Publication Date Title
US8368714B2 (en) Curved surface rendering system and method
CN109583509B (en) Data generation method and device and electronic equipment
CN110163831B (en) Method and device for dynamically displaying object of three-dimensional virtual sand table and terminal equipment
CN101727580B (en) Image processing apparatus, image processing unit, and image processing method
CN103810756B (en) The method for drafting of self adaptive Loop subdivision curved surface based on irregular area
CN108830385B (en) Deep learning model training method and device and computer readable storage medium
CN111724481A (en) Method, device, equipment and storage medium for three-dimensional reconstruction of two-dimensional image
CN104680483A (en) Image noise estimating method, video image de-noising method, image noise estimating device, and video image de-noising device
US11144717B2 (en) Automatic generation of document layouts
Sun A fast, free-form rubber-sheet algorithm for contiguous area cartograms
CN110363837B (en) Method and device for processing texture image in game, electronic equipment and storage medium
CN110782534B (en) 3D character color gradient method, medium, equipment and device
CN110458954B (en) Contour line generation method, device and equipment
CN111612886A (en) Indoor three-dimensional model generation method and system
Milošević The morphology of the brain neurons: box-counting method in quantitative analysis of 2D image
CN111369441B (en) Word processing method, medium, device and apparatus
CN111311724B (en) Shadow adding method, medium, device and apparatus for 3D characters
CN104239874B (en) A kind of organ blood vessel recognition methods and device
CN110807113B (en) Non-iterative elimination method for rectangular primitive overlap in visual layout
CN104020449B (en) A kind of interfering synthetic aperture radar phase diagram filtering method and equipment
CN111144064B (en) Character deformation method, medium, equipment and device
CN111063036B (en) Three-dimensional character arrangement method, medium, equipment and system based on path planning
CN111833395A (en) Direction-finding system single target positioning method and device based on neural network model
CN109164683A (en) Light distribution fast determination method and device based on mask graph processing
CN111444674B (en) Character deformation method, medium and computer equipment

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
GR01 Patent grant
GR01 Patent grant