Typesetting processing method, related device and medium
By calculating the intersection points and vertices of the multilateral figure and parallel lines, and determining the type-banned space, the problems of high traversal surround complexity and large computing overhead in the prior art are solved, and the traversal surround effect is achieved while reducing the calculation overhead. Typesetting processing method.
Patent Information
- Application Number
- CN202311030214.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-14
- Publication Date
- 2025-02-21
AI Technical Summary
The technical complexity of realizing traversal surround in the prior art is too high, and the computing overhead is large, making it difficult to apply in the online document layout of platform servers and the local document layout of terminals with few computing resources.
By obtaining the multilateral figure to be typed and the line space used for typewriting, determine the wrapping format of the text surrounding multilateral figure as the target format, calculate the intersection points of the multilateral figure and parallel lines, and determine the type-proof based on these intersection points and the vertices located in the line space, determine the layout-proofing based on these intersection points and the vertices located in the line space. space, thereby typing text around the forbidden type-up space in line space.
While maintaining the effect of traversal surround, it significantly reduces computing overhead and is suitable for online documents and resource-intensive local document typesetting.
Smart Images

Figure CN119494334A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of image and text processing, and in particular to a typesetting processing method, related devices and media. Background Art
[0002] Cross-type wrapping means that when the text is typeset around a picture, the text can not only be typeset along the edge of the picture, but also inside the semi-enclosed shape if the picture is a semi-enclosed shape. For example, if the picture is an n-shaped picture, the text can be typeset inside the circular arch of the n. The technology for implementing cross-type wrapping in the prior art is too complex and has a large computational overhead, so it is unacceptable for online document typesetting on platform servers or local document typesetting on terminals with few computing resources. In some scenarios, in order to reduce computational overhead, cross-type wrapping is roughly downgraded to tight wrapping.
[0003] The prior art lacks a solution for reducing the computational overhead while maintaining the effect of the cross-type surround. Summary of the invention
[0004] The disclosed embodiments provide a typesetting processing method, related devices and media, which can reduce computing overhead while maintaining the effect of penetrating surround.
[0005] According to one aspect of the present disclosure, a typesetting processing method is provided, the typesetting processing method is used for mixed typesetting of graphics and text, and the typesetting processing method comprises:
[0006] Acquire a polygonal figure to be typeset and a line space for typeset the text, wherein the line space is defined by parallel lines and the polygonal figure to be typeset includes a plurality of vertices;
[0007] If it is determined that the wrapping format of the text wrapping around the polygonal figure to be typeset is the target format, determining a target intersection point between the polygonal figure to be typeset and the parallel line;
[0008] Determine a prohibited typesetting space based on the target intersection point and a target vertex located in the row space among the plurality of vertices;
[0009] The text is typeset in a portion of the line space outside the prohibited typesetting space.
[0010] According to one aspect of the present disclosure, a typesetting processing device is provided, the typesetting processing device is used for mixed typesetting of graphics and text, and the typesetting processing device includes:
[0011] An acquisition unit, used for acquiring a polygonal figure to be typeset and a line space for typeset the text, wherein the line space is defined by parallel lines and the polygonal figure to be typeset includes a plurality of vertices;
[0012] A first determining unit is used to determine a target intersection point between the polygonal figure to be typeset and the parallel line if it is determined that the surrounding format of the text surrounding the polygonal figure to be typeset is a target format;
[0013] A second determining unit, configured to determine a prohibited typesetting space based on the target intersection point and a target vertex located in the row space among the plurality of vertices;
[0014] The typesetting unit is used to typeset the text in a portion of the line space outside the prohibited typesetting space.
[0015] Optionally, the first determining unit is specifically configured to:
[0016] For each edge of the polygonal figure to be typeset, determining a sub-intersection point between the edge and the parallel line;
[0017] The sub-intersections of the multiple sides of the polygonal graphic to be typeset are integrated into the target intersection.
[0018] Optionally, the second determining unit is specifically configured to:
[0019] Based on the target intersection point and the target vertex, obtaining a target edge segment of the polygonal figure to be typeset that is cut off by the row space;
[0020] Based on the target intersection point, obtaining a target segment of the parallel line cut off by the polygonal graphic to be typeset;
[0021] The interval enclosed by the target edge segment and the target intercept segment is determined as the prohibited layout space.
[0022] Optionally, the first determining unit is specifically configured to:
[0023] Taking the target intersection point and the target vertex as interception points, obtaining the edge line segments to be examined between the adjacent interception points in the polygonal figure to be typeset;
[0024] If at least one endpoint of the to-be-investigated edge segment is the target vertex, it is determined that the to-be-investigated edge segment is the target edge segment.
[0025] Optionally, the parallel lines include a first line and a second line, the target intersection includes a first intersection and a second intersection, and the target cross-line segment includes a first cross-line segment and a second cross-line segment; and the first determining unit is specifically configured to:
[0026] Determine a first intersection point of the polygonal figure to be typeset and the first line, and a second intersection point of the polygonal figure to be typeset and the second line;
[0027] If the first intersection point is a vertex of the polygon to be typeset, split the first intersection point into two first intersection points;
[0028] Connecting an odd-numbered first intersection point among the plurality of first intersection points and the first intersection point adjacent to the first intersection point to form a line segment as the first section segment;
[0029] If the second intersection point is a vertex of the polygon to be typeset, split the second intersection point into two second intersection points;
[0030] An odd-numbered second intersection point among the plurality of second intersection points and a second intersection point adjacent to the second intersection point are connected to form a line segment as the second section segment.
[0031] Optionally, the typesetting unit is specifically used for:
[0032] Determine a direction parallel to the parallel line as a first axis direction;
[0033] Mapping each edge of the forbidden typesetting space to the first axis direction to obtain a first axis sub-mapping interval of the edge;
[0034] Taking a union of the first axis sub-mapping intervals mapped by each edge of the forbidden typesetting space to obtain a first axis mapping interval;
[0035] The text is typeset in a remaining interval outside the first axis mapping interval in the first axis direction of the line space.
[0036] Optionally, the remaining interval has at least one of an upper limit value and a lower limit value, and the typesetting unit is further configured to:
[0037] If the remaining interval has the lower limit value, the lower limit value is rounded up relative to the first multiple of the standard text width to obtain a first correction multiple;
[0038] If the remaining interval has the upper limit value, the upper limit value is rounded down relative to the second multiple of the standard text width to obtain a second correction multiple;
[0039] Correcting the remaining interval based on at least one of the first correction multiple and the second correction multiple;
[0040] The text is typeset in the remaining interval.
[0041] Optionally, the typesetting unit is further used for:
[0042] Based on the first correction multiple and the standard text width, a corrected lower limit value is obtained;
[0043] Based on the second correction multiple and the standard text width, a corrected upper limit value is obtained;
[0044] Based on at least one of the corrected lower limit value and the corrected upper limit value, a corrected remaining section is determined.
[0045] Optionally, the parallel lines include a first line and a second line, and the target vertex is determined by the second determining unit in the following manner:
[0046] Establishing a plane rectangular coordinate system with a direction parallel to the first line and the second line as a horizontal axis direction, wherein the first line has a first vertical coordinate and the second line has a second vertical coordinate;
[0047] Determine the ordinates of the plurality of vertices in the plane rectangular coordinate system;
[0048] If the ordinate of the vertex is between the first ordinate and the second ordinate, the vertex is determined as the target vertex.
[0049] Optionally, the acquiring unit is specifically used for:
[0050] Get the graphics to be typeset;
[0051] If the graphic to be typeset has a curved edge, a plurality of sampling points are set on the curved edge, and the plurality of sampling points include a start point and an end point of the curved edge;
[0052] Connecting two adjacent sampling points among the plurality of sampling points with a line segment to form a polyline edge between the plurality of sampling points;
[0053] The curved edge is replaced by the broken line edge to obtain a polygonal figure to be typeset.
[0054] Optionally, the acquisition unit is further configured to:
[0055] Determining the length of the curved side;
[0056] Get typesetting accuracy;
[0057] The number of the sampling points is determined based on the length and the layout accuracy.
[0058] Optionally, the acquisition unit is further configured to:
[0059] Acquire an original polygonal figure, wherein the original polygonal figure is a concave polygon;
[0060] Identifying the reflex angle vertices of the original polygon;
[0061] A dividing line is made from the vertex of the apparent angle to divide the original polygon into a plurality of polygons to be typeset, and the polygons to be typeset are convex polygons.
[0062] Optionally, the acquisition unit is further configured to:
[0063] Taking each vertex of the original polygon as a starting point in turn;
[0064] A plane rectangular coordinate system is established with the starting point as the origin and the direction from the starting point to the first adjacent vertex as the horizontal axis, wherein the first adjacent vertex is a vertex on the boundary of the original polygon and adjacent to the starting point in the counterclockwise direction;
[0065] If the second adjacent vertex is located below the horizontal axis, the first adjacent vertex is determined to be the reflex angle vertex, wherein the second adjacent vertex is a vertex on the boundary of the original polygon and adjacent to the first adjacent vertex in a counterclockwise direction.
[0066] Optionally, the acquisition unit is further configured to:
[0067] Determine a segmentation end point, wherein the segmentation end point is the first vertex above the horizontal axis in the counterclockwise direction along the boundary of the original polygon starting from the second adjacent vertex;
[0068] The line connecting the reflex angle vertex to the segmentation end point is used as the segmentation line.
[0069] Optionally, the acquisition unit is further configured to:
[0070] Determining an edge vector of each edge of the original polygon;
[0071] For each vertex of the original polygon, determine the cross product of the edge vectors of two adjacent edges where the vertex is located;
[0072] If the cross product of the vertex is of different sign from the cross products of other vertices on the original polygon, the vertex is determined to be the reflex angle vertex.
[0073] Optionally, the acquisition unit is further configured to:
[0074] Drawing a candidate segmentation line from the reflex angle vertex to each other vertex on the original polygon, wherein each candidate segmentation line segments the original polygon into a plurality of candidate polygons to be typeset;
[0075] If the cross products of the edge vectors of the adjacent edges of the plurality of candidate polygonal figures to be typeset that are divided by a candidate dividing line have the same sign, the candidate dividing line is used as the dividing line.
[0076] Optionally, the second determining unit is further configured to:
[0077] Determine a direction parallel to the parallel line as a first axis direction;
[0078] Mapping the target intersection point and the target vertex to the first axis direction to obtain a plurality of first axis mapping values;
[0079] Determine a prohibited typesetting subspace corresponding to the convex polygon based on a minimum first-axis mapping value and a maximum first-axis mapping value among the plurality of first-axis mapping values;
[0080] The union of the multiple forbidden layout subspaces corresponding to the multiple convex polygons is used as the forbidden layout space.
[0081] According to one aspect of the present disclosure, an electronic device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the typesetting processing method as described above when executing the computer program.
[0082] According to one aspect of the present disclosure, a computer-readable storage medium is provided, wherein the storage medium stores a computer program, and when the computer program is executed by a processor, the typesetting processing method as described above is implemented.
[0083] According to one aspect of the present disclosure, a computer program product is provided. The computer program product includes a computer program. The computer program is read and executed by a processor of a computer device, so that the computer device executes the typesetting processing method as described above.
[0084] In the disclosed embodiment, the parallel lines of the row space and the intersections with the polygonal figure to be typeset are determined, and the prohibited typesetting space is determined according to the determined intersections and the target vertex in which multiple vertices in the polygonal figure to be typeset are located in the row space, and the text is typeset in the row space by bypassing the prohibited typesetting space. The intersections of the polygonal figure to be typeset and the parallel lines define the edge points of each part of the polygonal figure to be typeset cut by the row space in the direction perpendicular to the row, and the target vertex defines the edge points of each part cut in the row direction. The prohibited typesetting space defined by the two edge points makes the semi-enclosed interior of the semi-enclosed shape of the figure not defined as the prohibited typesetting space, thereby realizing the through-type surrounding typesetting. The disclosed embodiment abandons the complex algorithm and only calculates the intersections of each side of the polygonal figure to be typeset with the parallel lines, and determines the prohibited typesetting space accordingly. The complexity of calculating the intersections of each side and the parallel lines is very low, and determining the prohibited typesetting space according to the intersections and the target vertex brings almost no complexity. Therefore, the whole scheme greatly reduces the computational overhead while maintaining the effect of the through-type surrounding.
[0085] Other features and advantages of the present disclosure will be described in the following description, and partly become apparent from the description, or understood by practicing the present disclosure. The purpose and other advantages of the present disclosure can be realized and obtained by the structures particularly pointed out in the description, claims and drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0086] The accompanying drawings are used to provide further understanding of the technical solution of the present disclosure and constitute a part of the specification. Together with the embodiments of the present disclosure, they are used to explain the technical solution of the present disclosure and do not constitute a limitation on the technical solution of the present disclosure.
[0087] Figure 1 is a system architecture diagram of the typesetting processing method of the embodiment of the present disclosure;
[0088] Figure 2A-2D It is a schematic diagram of an interface of an embodiment of the present disclosure applied to mixed typesetting of images and texts in an online document;
[0089] Figure 3 is a flow chart of a typesetting processing method according to an embodiment of the present disclosure;
[0090] Figure 4A yes Figure 3 Schematic diagram of step 310 regarding the graphics to be typeset and the line space;
[0091] Figure 4B It is a schematic diagram of the vertices of the figure to be typeset and the parallel lines of the row space;
[0092] Figure 5A-Figure 5B yes Figure 3 A schematic diagram of an interface for determining a surround format in step 320;
[0093] Fig. 6A yes Figure 3 A schematic diagram of step 320 for determining a target intersection point;
[0094] Figure 6B yes Figure 3 A schematic diagram of determining a prohibited typesetting space in step 330;
[0095] Figure 6C yes Figure 3 A schematic diagram of step 340 regarding the partial typeset text outside the prohibited typeset;
[0096] Figure 7 yes Figure 3 Step 310 is a first flow chart for obtaining a polygonal graphic to be typeset;
[0097] Figure 8A-8B It is a specific implementation diagram of converting a polygonal figure to be typeset into a polygonal figure to be typeset;
[0098] Fig. 9 yes Figure 3 Step 310 is a second flow chart for obtaining a polygonal graphic to be typeset;
[0099] Fig.10 It is a specific implementation diagram of dividing an original polygonal figure into multiple polygonal figures to be typeset;
[0100] Fig.11 yes Fig. 9 Step 920 of the first flow chart for identifying the reflex angle vertex;
[0101] Fig.12 It is a schematic diagram of the specific implementation of identifying the vertex of the reflex angle using the rectangular coordinate system;
[0102] Fig.13 yes Fig. 9 Step 930 in the first flow chart about making a dividing line;
[0103] Fig.14 It is a schematic diagram of the specific implementation of using a rectangular coordinate system as a dividing line;
[0104] Fig.15 yes Fig. 9 Step 920 of the second flow chart is about identifying the vertex of the reflex angle;
[0105] Fig.16 It is a schematic diagram of the specific implementation of using the cross product of edge vectors to identify the reflex angle vertex;
[0106] Fig.17 yes Fig. 9 Step 930 in the second flow chart for making a dividing line;
[0107] Fig.18 This is a schematic diagram of the specific implementation of using the cross product of edge vectors as the dividing line;
[0108] Fig.19 yes Figure 3 Step 320 is a flowchart for determining a target intersection point;
[0109] Fig. 20 yes Fig.19 Flowchart of the target intersection obtained based on the integration of sub-nodes;
[0110] Figure 21A-21B It is a schematic diagram of using a function to determine the target intersection point of an edge and a parallel line;
[0111] Fig. 22 yes Figure 3 Step 330 of the first flow chart for determining the prohibited typesetting space;
[0112] Fig.23 It is a specific implementation diagram of determining the prohibited typesetting space based on the target edge segment and the target cut-off segment;
[0113] Fig.24 yes Fig. 22 A schematic diagram of a specific implementation of step 2210 for determining a target edge segment;
[0114] Fig.25 yes Fig. 22 Step 2220 is a flowchart for determining a target cut line segment;
[0115] Figure 26A-26C It is a specific implementation diagram for determining the target cut-off segment;
[0116] Fig. 27 yes Figure 3 Step 330 of the second flow chart is about determining the prohibited typesetting space;
[0117] Figure 28A-28B This is a specific implementation diagram for determining the prohibited typesetting space;
[0118] Fig.29 yes Figure 3 Step 340 is a flowchart for partially typeset text outside the prohibited typesetting space;
[0119] Fig.30 It is a specific implementation diagram of determining the remaining interval using the direction of the first axis;
[0120] Fig.31 yes Fig.29 Step 2940 is a flowchart for determining the layout of text in the remaining interval;
[0121] Fig.32 This is a specific implementation diagram of correcting the remaining interval based on the standard text width;
[0122] Fig.33 It is a detailed diagram of the implementation of the embodiment of the present disclosure using the target edge line segment and the target section line segment to perform the through-type wrapping typesetting;
[0123] Fig.34 It is a detailed diagram of the implementation of the embodiment of the present disclosure using the first axis mapping value in the first axis direction to perform the through-type wrapping typesetting;
[0124] Figure 35A-Figure 35D This is a schematic diagram of the contrast effect of the through-type wraparound typesetting;
[0125] Fig.36 is a module diagram of a typesetting processing device according to an embodiment of the present disclosure;
[0126] Fig.37 According to the embodiment of the present disclosure, Figure 3 The terminal structure diagram of the typesetting processing method shown;
[0127] Fig.38 According to the embodiment of the present disclosure, Figure 3 The server structure diagram of the typesetting processing method shown. DETAILED DESCRIPTION
[0128] In order to make the purpose, technical solution and advantages of the present disclosure more clear, the present disclosure is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present disclosure and are not used to limit the present disclosure.
[0129] Before further describing the embodiments of the present disclosure in detail, the nouns and terms involved in the embodiments of the present disclosure are described. The nouns and terms involved in the embodiments of the present disclosure are subject to the following interpretations:
[0130] Artificial intelligence: It is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain target results. In other words, artificial intelligence is a comprehensive technology in computer science. It attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines so that machines have the functions of perception, reasoning and decision-making. Artificial intelligence technology is a comprehensive discipline that covers a wide range of fields, including both hardware-level technology and software-level technology. The basic technologies of artificial intelligence generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, and mechatronics. Artificial intelligence software technology mainly includes computer vision technology, speech processing technology, natural language processing technology, and machine learning / deep learning. With the research and advancement of artificial intelligence technology, artificial intelligence technology has been studied and applied in many fields, such as common smart homes, smart wearable devices, virtual assistants, smart speakers, smart marketing, unmanned driving, automatic driving, drones, robots, smart medical care, smart customer service, etc. I believe that with the development of technology, artificial intelligence technology will be applied in more fields and play an increasingly important role.
[0131] Text wrapping: A technology in the typesetting engine that allows text to be laid out around images according to certain rules.
[0132] Tight wrapping: In the text wrapping rules, the rule allows the text to be typeset close to the outer edge of the surrounding polygon.
[0133] Cross-type wrapping: In the text wrapping rules, text can not only be laid out along the edge, but also in the internal gap of the polygon, such as a hollow circle, where text can also be laid out inside the circle.
[0134] Prohibited layout space: refers to the space within the text surround where text cannot be typeset, that is, the space where graphics are arranged within the text.
[0135] System architecture and scenario description of the application of the embodiments of the present disclosure
[0136] Figure 1 It is a system architecture diagram used in the typesetting processing method according to the embodiment of the present disclosure, which includes an object terminal 110, the Internet 120, a gateway 130, and a server 140.
[0137] The object terminal 110 is a device that displays mixed layouts of graphics and text to the object. It includes various forms such as desktop computers, laptops, PDAs (personal digital assistants), mobile phones, and dedicated terminals. In addition, it can be a single device or a collection of multiple devices. For example, multiple devices are connected through a local area network and work together using a common display device to form a terminal. The terminal can also communicate with the Internet 120 in a wired or wireless manner to exchange data.
[0138] The server 140 refers to a computer system that can provide typesetting processing services to the target terminal 110. Compared with the target terminal 110, the server 140 has higher requirements in terms of stability, security, performance, etc. The server 140 can be a high-performance computer in a network platform, a cluster of multiple high-performance computers, a part of a high-performance computer (such as a virtual machine), a combination of parts of multiple high-performance computers (such as virtual machines), etc. The server 140 can also communicate with the gateway 130 in a wired or wireless manner to exchange data.
[0139] The gateway 130 is also called an internetwork connector or a protocol converter. The gateway 130 realizes network interconnection at the transport layer and is a computer system or device that acts as a converter. The gateway is a translator between two systems that use different communication protocols, data formats or languages, or even completely different architectures. At the same time, the gateway can also provide filtering and security functions. The message sent by the object terminal 110 to the server 140 is sent to the corresponding server through the gateway 130. The message sent by the server 140 to the object terminal 110 is also sent to the corresponding object terminal 110 through the gateway 130.
[0140] The embodiments of the present disclosure can be applied in various scenarios, such as Figure 2A -D shows the mixed layout of text and images in online documents.
[0141] like Figure 2A As shown in the interface of the online document shown, the online document can be used to edit text and display mixed text and graphics. After the target object triggers the "Insert" option in the upper function bar, three candidates are displayed, including graphics, text boxes and tables. After the "Graphic" option is triggered, a graphic will be inserted into the interface of the online document, and the text will be typeset around the inserted graphic. The wrapping formats of text wrapping graphics include insertion type, surrounding type, top and bottom wrapping, lining under text, floating above text, tight wrapping, and through wrapping. The following examples illustrate surrounding type, tight wrapping and through wrapping.
[0142] Figure 2BThe interface of mixed typesetting with surrounding format of four-sided type is shown. The inserted graphic is a diamond. The test text is typeset around the diamond. Right-click the diamond on the interface to pop up a hidden menu. By triggering the "Text Wrapping" option on the hidden menu, various surrounding formats can be displayed. The current surrounding format is four-sided type, and the surrounding format can be switched by clicking other options.
[0143] Figure 2C The interface shows a mixed layout with a tight wrapping format. The inserted graphic is an n-shaped image. The test text will be laid out along the edge of the n-shaped image. Right-click the n-shaped image on the interface to pop up a hidden menu. By triggering the "Text Wrapping" option on the hidden menu, various wrapping formats can be displayed. The current wrapping format is tight wrapping, and you can switch the wrapping format by clicking other options.
[0144] Figure 2D The interface of mixed typesetting with the wrapping format of through-type wrapping is shown. The inserted graphic is an n-shaped image. The test text will not only wrap around the edge of the n-shaped image, but also be typeset in the internal gap of the n-shaped image. Right-click the n-shaped image on the interface to pop up a hidden menu. By triggering the "Text Wrapping" option on the hidden menu, various wrapping formats can be displayed. The current wrapping format is through-type wrapping, and the wrapping format can be switched by clicking other options.
[0145] It should be noted that in the case of through-type wrapping, for example, if the image is a concave polygon, the text can be typeset into the internal gap of the concave polygon. The related technology also has technology that can realize through-type wrapping, but the complexity is too high and the computational overhead is large. It is acceptable in some terminals that can tolerate the high overhead, but it is unacceptable on the platform server of online documents. Therefore, in order to reduce the overhead, the through-type wrapping will be roughly downgraded to a tight wrapping, and the through-type wrapping cannot be accurately restored. It is precisely because of the downgrade strategy and the rough restriction of the influence range of elements that the online document field is currently unable to accurately restore the effect of through-type wrapping. The related technology has problems such as computational space errors and computational space inefficiency.
[0146] General description of the disclosed embodiments
[0147] According to an embodiment of the present disclosure, a typesetting processing method is provided.
[0148] The typesetting processing method is a technology for mixed typesetting of graphics and text. This typesetting processing method is often used for Figure 2A-2DThe scene of mixed layout of text and images in the online document shown. The technology for realizing through-type wrapping in the related art is too complex and has a large computational overhead, making it difficult to apply to online document layout of platform servers or local document layout of terminals with limited computing resources. The layout processing method of the embodiment of the present disclosure is mainly capable of reducing the computational overhead while maintaining the effect of through-type wrapping.
[0149] like Figure 3 As shown, according to one embodiment of the present disclosure, the typesetting processing method includes:
[0150] Step 310: Obtain a polygonal figure to be typeset and a line space for typeset text, wherein the line space is defined by parallel lines and the polygonal figure to be typeset includes a plurality of vertices;
[0151] Step 320: If it is determined that the wrapping format of the text wrapping around the polygonal figure to be typeset is the target format, determine the target intersection point of the polygonal figure to be typeset and the parallel lines;
[0152] Step 330: determine a prohibited layout space based on a target intersection point and a target vertex in the row space among a plurality of vertices;
[0153] Step 340: Typeset the text in the portion outside the prohibited typesetting space in the line space.
[0154] The above steps 310 - 340 are generally described below.
[0155] The typesetting method can be Figure 1 The object terminal 130 shown in the figure may also be executed by Figure 1 The server 110 is shown executing.
[0156] In step 310, a polygonal graphic to be typeset and a line space for typeset text are obtained. The polygonal graphic to be typeset refers to a graphic surrounded by text. The line space refers to a space where text can be placed. The line space is defined by parallel lines, and the text is typeset inside the parallel lines. Figure 4A As shown, the polygonal graphics to be typeset include graphics Q1, graphics Q2, graphics Q3, and graphics Q4. The line space includes line space h1 and line space h2. Figure 4B As shown, the line space h1 is defined by parallel lines formed by lines L1 and L2, and the line space h2 is defined by parallel lines formed by lines L3 and L4.
[0157] The polygon to be typeset contains multiple vertices. Figure 4BAs shown, the graph Q1 includes vertex d1, vertex d2, vertex d3, and vertex d4. The graph Q2 includes vertex d5, vertex d6, vertex d7, and vertex d8. The graph Q3 includes vertex d9, vertex d10, vertex d11, and vertex d12. The graph Q4 includes vertex d13, vertex d14, vertex d15, vertex d16, vertex 17, and vertex 18.
[0158] In step 320, if it is determined that the wrapping format of the text wrapping around the polygonal figure to be typeset is the target format, the target intersection point of the polygonal figure to be typeset and the parallel lines is determined. The wrapping format refers to the format of the text wrapping around the figure. In conjunction with the above, the wrapping format includes surrounding type, tight wrapping, and through type wrapping. The target format refers to a format that is set in advance and can start the typesetting processing service, for example, the target format is through type wrapping.
[0159] In one embodiment, the method for determining the surround format includes but is not limited to the following method:
[0160] (1) Figure 5A As shown, right-clicking the graphic on the interface will pop up a hidden menu. By triggering the "Text Wrap" option on the hidden menu, various wrapping formats can be displayed. The current wrapping format is tight wrapping, and you can click the "Through wrapping" option to switch to through wrapping.
[0161] (2) Figure 5B As shown, click the "Tools" option in the function bar on the interface to pop up a hidden menu. By triggering the "Text Wrap" option on the hidden menu, various wrapping formats can be displayed. The current wrapping format is tight wrapping, and you can click the "Through wrapping" option to switch to through wrapping.
[0162] In one example, the target format is a through-type wrapping. If it is determined that the wrapping format is a through-type wrapping, the target intersection point of the polygonal figure to be typeset and the parallel line is determined. Fig. 6A As shown, the target intersections of the graphs Q1 and Q2 with the line space h1 include {intersection j1, intersection j2, intersection j3, intersection j4}. The intersections of the graph Q3 with the line space h2 include {intersection j5, intersection j6, intersection j7, intersection j8}. The target intersections of the graph Q4 with the line space h2 include {intersection j9, intersection j10, intersection j11, intersection j12} and {intersection j13, intersection j14, intersection j15, intersection j16}.
[0163] In step 330, a prohibited layout space is determined based on the target intersection and the target vertex located in the row space among the multiple vertices. The target vertex refers to the vertex located in the row space, that is, the vertex located in the parallel line. The target intersection defines the edge point of each part of the polygonal figure to be typeset by the row space cut into, in the direction perpendicular to the row, and the target vertex defines the edge point of each part cut into in the row direction. The prohibited layout space defined by the two edge points makes the semi-enclosed interior of the semi-enclosed shape of the figure not be defined as the prohibited layout space, thereby realizing the through-type surround typesetting.
[0164] In one example, refer to Figure 4B , the target vertices of graphs Q1 and Q2 in row space h1 include {vertex d2, vertex d6}. The target vertices of graph Q3 in row space h2 include {vertex d12}. The target vertices of graph Q4 in row space h2 are empty. Figure 6B As shown, the essence of solving the through-surround problem is to solve Figure 6B The dotted area shown is blocked by graphics, so text cannot be typeset in these areas. The space that can be typeset is the internal space of the graphics and the unblocked space outside. These unblocked parts are where text can be placed.
[0165] Continue as Figure 6B As shown, the forbidden typesetting space q1 is determined based on the target intersections {intersection j1, intersection j2, intersection j3, intersection j4} and the target vertices {vertex d2, vertex d6}. The forbidden typesetting space q2 is determined based on the target intersections {intersection j5, intersection j6, intersection j7, intersection j8} and the target vertex {vertex d12}. The forbidden typesetting space q3 and the forbidden typesetting space q4 are determined based on the target intersections {intersection j13, intersection j14, intersection j15, intersection j16, intersection j17, intersection j18}. Finally, the forbidden typesetting space includes {forbidden typesetting space q1, forbidden typesetting space q2, forbidden typesetting space q3, forbidden typesetting space q4}.
[0166] In step 340, the text is typeset in the portion outside the prohibited typesetting space in the line space. In one example, Figure 6B and Figure 6C As shown, the test text is typeset in the part outside the prohibited typesetting space q1, prohibited typesetting space k2, prohibited typesetting space k3 and prohibited typesetting space k4. It should be noted that although the embodiment of the present disclosure realizes the through-type surround, if the graphics to be typeset have no internal gaps, such as graphics Q1, graphics Q2 and graphics Q3, the interface display effect of the text surrounding the graphics after typesetting is similar to the tight type surround. If the graphics to be typeset have internal gaps, such as graphics Q4, the effect of the text passing through the graphics and tightly surrounding the graphics can be displayed on the interface after typesetting.
[0167] Through the above steps 310-340, when calculating the intersection, the calculation complexity of the target intersection of a single edge of the polygon to be typeset and the parallel line is O(1), and the complexity of n edges is O(n). Since the target intersection has been calculated, the subsequent determination of the prohibited typesetting space based on the target intersection and the target vertex will hardly bring any complexity. The disclosed embodiment greatly reduces the computational overhead while ensuring the crossing effect, and is more universal. For example, it is suitable for online documents and local documents with tight processing resources.
[0168] The above is a general description of steps 310 - 340 . The specific implementation process of steps 310 - 340 will be described in detail below.
[0169] The above steps 310 - 340 are described in detail below.
[0170] Detailed description of step 310
[0171] In step 310, a polygonal graphic to be typeset and a line space for typeset text are obtained.
[0172] In one embodiment, the polygonal figure to be typeset includes a plurality of vertices, and the plurality of vertices are obtained in the following manner:
[0173] Get the vertex coordinates of the polygon to be typeset in the row space;
[0174] Get the rotation angle of the polygon to be typeset in the row space;
[0175] The vertex coordinates are transformed based on the rotation angle to obtain multiple vertices.
[0176] In this embodiment, considering that the object may adjust its rotation angle after the polygon to be typeset is inserted into the row space, in order to reduce the waste of computing resources caused by repeatedly obtaining vertices, this embodiment transforms the vertex coordinates based on the rotation angle to obtain the vertices of the polygon to be typeset after rotation, without the need to obtain the vertex coordinates of the polygon to be typeset after rotation again.
[0177] The benefit of this embodiment is that the efficiency of obtaining vertices is improved.
[0178] Reference Figure 7 In one embodiment, obtaining the polygonal graphics to be typeset in step 310 includes:
[0179] Step 710, obtaining the graphics to be typeset;
[0180] Step 720: If the graphic to be typeset has a curved edge, multiple sampling points are set on the curved edge, and the multiple sampling points include a start point and an end point of the curved edge;
[0181] Step 730: connect two adjacent sampling points among the plurality of sampling points with a line segment to form a polyline edge between the plurality of sampling points;
[0182] Step 740: Replace the curved edge with a broken line edge to obtain a polygonal figure to be typeset.
[0183] Steps 710-740 are described in detail below.
[0184] In step 710, the graphics to be typeset refer to the graphics surrounded by the text, which are generally inserted from the object into the middle of the text. Different graphics to be typeset have great differences in shape. For example, Fig. 8A As shown in , some edges of some graphics to be typeset are curved edges. Figure 8B As shown, some graphics to be typeset are completely composed of curved edges. Curved edges will affect the calculation efficiency when calculating intersections with row spaces. In order to improve the processing efficiency of the embodiment of the present disclosure, the graphics to be typeset need to be adjusted.
[0185] In step 720, if the graphics to be typeset have a curved edge, multiple sampling points are set on the curved edge. Fig. 8A As shown in FIG. 1 , three sampling points are set on the curve edge of the graphics to be typeset, including sampling point c1, sampling point c2, and sampling point c3. Sampling point c1 is the starting point of the curve edge, and sampling point c3 is the end point of the curve edge. In another example, Figure 8B As shown, 8 sampling points are set on the curved edge of the graphics to be typeset, including sampling point c4, sampling point c5, sampling point c6, sampling point c7, sampling point c8, sampling point c9, sampling point c10, and sampling point c11. Sampling point c4 is the starting point of the curved edge and also the end point of the curved edge.
[0186] In step 730, two adjacent sampling points among the plurality of sampling points are connected by a line segment to form a polyline edge between the plurality of sampling points. Fig. 8A As shown, the sampling point c1 and the sampling point c2 are connected by a line segment, and the sampling point c2 and the sampling point c3 are connected by a line segment, and then a polyline edge is formed between the sampling points c1, c2 and c3.
[0187] In step 740, the curved edge is replaced by the broken line edge to obtain the polygonal figure to be typeset. Fig. 8A As shown, the curved edge of the figure to be typeset is replaced by the broken line edge formed between the sampling point c1 and the sampling point c2, and the broken line edge formed between the sampling point c2 and the sampling point c3, to obtain the polygonal figure to be typeset. Figure 8BAs shown, the curved edge of the graphic to be typeset is replaced by the broken line edge formed between sampling point c4 and sampling point c5, the broken line edge formed between sampling point c5 and sampling point c6, the broken line edge formed between sampling point c6 and sampling point c7, the broken line edge formed between sampling point c7 and sampling point c8, the broken line edge formed between sampling point c8 and sampling point c9, the broken line edge formed between sampling point c9 and sampling point c10, and the broken line edge formed between sampling point c10 and sampling point c11, to obtain the polygonal graphic to be typeset.
[0188] The advantage of the embodiment of steps 710-740 is that replacing the curved edge with a broken line edge to obtain the polygonal figure to be typeset can reduce the computing resources required for calculating the intersection of the polygonal figure to be typeset and the row space, thereby greatly improving the computing efficiency.
[0189] In one embodiment, the number of the plurality of sampling points in step 720 is determined by:
[0190] Determine the length of the curve side;
[0191] Get typesetting accuracy;
[0192] Determine the number of sampling points based on length and layout accuracy.
[0193] Specifically, the length of the curve edge can be determined by determining the length based on the starting point, the end point, and the function expression of the curve edge. Other length determination methods can also be used, which are not specifically limited in this embodiment. Typesetting accuracy refers to the accuracy of typesetting text. The typesetting accuracy can be related to the display screen resolution of the target terminal. The higher the resolution, the higher the typesetting accuracy. The typesetting accuracy can also be set in advance by the target object. It can be understood that the longer the length of the curve edge, the more sampling points. The higher the typesetting accuracy, the more sampling points.
[0194] The advantage of this embodiment is that the number of sampling points is determined based on the length and the typesetting accuracy, which improves the rationality and flexibility of determining the number and improves the accuracy of the typesetting process.
[0195] In one embodiment, the number of sampling points is determined based on the length and the typesetting accuracy, including:
[0196] Based on the length, determining a first score;
[0197] Based on the typesetting accuracy, a second score is determined;
[0198] determining a total score based on the first score and the second score;
[0199] Based on the total score, the number of sampling points is determined.
[0200] Specifically, the first score may be determined based on the length by searching a comparison table between the length range and the first score, or by using a formula method.
[0201] (1) The length range and first score comparison table lists the correspondence between the length range and the first score. First, the length range is obtained according to the length, and then the length range and first score comparison table is searched to obtain the first score. The following is an example of a length range and first score comparison table:
[0202] Length range First Score More than 5 cm 100 3-5 cm 90 2-3 cm 80 1.5-2 cm 70 1-1.5 cm 60 …… ……
[0203] Table 1
[0204] For example, if the length is 4 cm, then the length range is 3-5 cm. By looking up Table 1, the corresponding first score is 90.
[0205] The above method of searching the length range and the first score comparison table has the advantages of being simple and easy to implement with low processing overhead.
[0206] (2) When the formula method is used, the first fraction can be set to be proportional to the length, for example:
[0207] F1=K1·G1 Formula 1
[0208] Wherein, F1 represents the first fraction, G1 represents the length, and K1 is a preset constant which can be set according to actual needs. For example, K1=45 / 2, after substituting G1=4, the first fraction F1=90.
[0209] The advantages of the above method of determining the first score by means of a formula are high accuracy, and the formula can be adjusted as required, which is highly flexible.
[0210] Based on the typesetting accuracy, the second score can be determined by looking up a comparison table between the typesetting accuracy range and the second score, or by using a formula method.
[0211] (1) The typesetting accuracy range and the second score comparison table lists the correspondence between the typesetting accuracy range and the second score. First, the typesetting accuracy range is obtained according to the typesetting accuracy, and then the typesetting accuracy range and the second score comparison table are searched to obtain the second score. The following is an example of a typesetting accuracy range and the second score comparison table:
[0212] Typesetting accuracy range Second score 0.9-1 100 0.6-0.9 90 0.4-0.6 80 0.3-0.4 70 0.2-0.3 60 …… ……
[0213] Table 2
[0214] For example, if the precision is 0.5, the typesetting precision range is 0.4-0.6. By looking up Table 2, the corresponding second score is 80.
[0215] The above method of searching the typesetting accuracy range and the second score comparison table has the advantages of being simple and easy to implement with low processing overhead.
[0216] (2) When the formula method is used, the second fraction can be set to be proportional to the typesetting accuracy, for example:
[0217] F2=K2·G2 Formula 2
[0218] Among them, F2 represents the first score, G2 represents the typesetting accuracy, and K2 is a preset constant that can be set according to actual needs. For example, K2=160, after substituting G2=0.5, the second score F2=80.
[0219] The advantages of the above method of determining the second score by means of a formula are high accuracy, and the formula can be adjusted as required, which is highly flexible.
[0220] The total score is determined based on the first score and the second score, and the average or weighted average of the first score and the second score can be calculated.
[0221] When the average of the first score and the second score is calculated as the total score, for example, the first score is 90 and the second score is 80, then the total score is (90+80) / 2=85. The advantage of using the average to calculate the total score is that the influence of length and typesetting accuracy on determining the number of sampling points can be equally reflected.
[0222] When calculating the weighted average of the first score and the second score as the total score, for example, the weights for length and layout accuracy are set to 0.6 and 0.4 respectively, the first score is 90, and the second score is 80, then the total score is 90×0.6+80×0.4=86. The advantage of using the weighted average to calculate the total score is that different weights can be set for length and layout accuracy, which increases the flexibility of determining the number of sampling points.
[0223] Based on the total score, the number of sampling points can be determined by looking up a comparison table of the total score range and number, or by using a formula.
[0224] (1) The total score range and number comparison table lists the correspondence between the total score range and the number. First, the total score range is obtained based on the total score, and then the total score range and number comparison table is searched based on this to obtain the number of sampling points. The following is an example of a total score range and number comparison table:
[0225] Total score range number 90 points or above 8 80-90 points 7 70-80 points 6 60-70 points 5 50-60 points 4 …… ……
[0226] Table 3
[0227] For example, if the total score is 85, then the total score range is 80-90 points. Look up Table 3 and get the corresponding number 7.
[0228] The above method of searching the total score range and the number comparison table has the advantages of being simple and easy to implement with low processing overhead.
[0229] (2) When using the formula method, the number can be set to be proportional to the total score, for example:
[0230] D=K3·S Formula 3
[0231] Where D represents the number, S represents the total score, and K3 is a preset constant that can be set according to actual needs. For example, K3 = 7 / 85, after substituting S = 85, the number D = 7.
[0232] The advantages of the above method of determining the number by formula are high accuracy, and the formula can be adjusted as needed, which is highly flexible.
[0233] It should be noted that in the above embodiment, the polygonal figure to be typeset may be a concave polygon or a convex polygon. Considering that a convex polygon has no internal space in the row space, if the polygonal figure to be typeset is a convex polygon, the complexity of subsequently determining the forbidden typesetting space is lower. Therefore, in one embodiment, the concave polygon needs to be segmented to obtain multiple convex polygons.
[0234] Reference Fig. 9 In the specific implementation of this embodiment, the step 310 of obtaining the polygonal graphics to be typeset includes:
[0235] Step 910: Obtain an original polygonal figure, where the original polygonal figure is a concave polygon;
[0236] Step 920, identifying the reflex angle vertices of the original polygon;
[0237] Step 930: Draw a dividing line from the vertex of the apparent angle to divide the original polygon into a plurality of polygons to be laid out, where the polygons to be laid out are convex polygons.
[0238] Steps 910 - 930 are described in detail below.
[0239] In step 910, the original polygon is a concave polygon. A concave polygon is characterized by at least one internal angle being a reflex angle, which is an angle greater than 180 degrees. The process of determining a concave polygon includes: establishing an edge vector for each side of the polygon, and using the cross product of adjacent edge vectors to test convexity and concavity. The cross products of all adjacent edge vectors of a convex polygon have the same sign. Therefore, if some cross products of a certain original polygon have a positive sign and other cross products have a negative sign, it can be determined to be a concave polygon.
[0240] For example, Fig.10As shown, the original polygon includes 5 vertices, namely, vertex V1, vertex V2, vertex V3, vertex V4, and vertex V5. Among them, the internal angle corresponding to vertex V2 is greater than 180 degrees, which is a reflex angle.
[0241] In step 920, the reflex angle vertex refers to the vertex corresponding to the reflex angle. Fig.10 As shown, the reflex angle vertex of the original polygon is identified as vertex V2 ( Fig.10 The portion outlined by the dotted circle shown).
[0242] In step 930, a convex polygon is a polygon whose interior angles are not greater than 180 degrees. Therefore, based on the segmentation line from the reflex angle vertex, the segmentation line will segment the reflex angle corresponding to the reflex angle vertex into two angles less than 180 degrees, so that the concave polygon is segmented into multiple convex polygons. For example, continue as Fig.10 As shown, a dividing line is drawn from vertex V2, the starting point of the dividing line is vertex V2, and the ending point is vertex V4. After the division is completed, two polygonal figures to be typed are obtained, and both are convex polygons. Among them, one polygonal figure to be typed includes vertex V1, vertex V2, vertex V4, and vertex V5, and the other polygonal figure to be typed includes vertex V2, vertex V3, and vertex V4.
[0243] The advantage of the embodiment of steps 910-930 is that, considering that under a concave polygon, the text needs to be typeset in the internal space formed by the concave polygon in the row space, but the processing resources for calculating the internal space are high, so this embodiment divides the concave polygon into multiple convex polygons, and converts the complex processing of calculating one concave polygon into the simple processing of calculating multiple convex polygons. In this way, the processing resources are reduced and the typesetting processing efficiency is greatly improved.
[0244] In another embodiment, unlike the method of implementing segmentation based on the reflex angle vertex as a segmentation line in steps 910-930, a plane rectangular coordinate system can be established, and then the original polygonal figure can be segmented by rotating the original polygonal figure in the plane rectangular coordinate system. Specifically, along the counterclockwise direction of the boundary of the original polygonal figure, the vertices are moved one by one to the origin of the plane rectangular coordinate system, and then the original polygonal figure is rotated clockwise so that the first adjacent vertex falls on the X-axis. If the second adjacent vertex is below the X-axis, the original polygonal figure is a concave polygon, and the original polygonal figure is segmented into two new polygons based on the first adjacent vertex as a segmentation line, and the operation is repeated for the two new polygons until all polygons are convex polygons.
[0245] The advantage of this embodiment is that segmentation is achieved by using a plane rectangular coordinate system and rotating the original polygon, which can improve segmentation efficiency.
[0246] Steps 920-930 are described in detail below.
[0247] In one embodiment, the reflex angle vertices of the original polygonal figure may be identified based on a plane rectangular coordinate system.
[0248] For example, refer to Fig.11 In the specific implementation of this embodiment, step 920 includes:
[0249] Step 1110, taking each vertex of the original polygon as a starting point in turn;
[0250] Step 1120: Establish a plane rectangular coordinate system with the starting point as the origin and the direction from the starting point to the first adjacent vertex as the horizontal axis;
[0251] Step 1130: If the second adjacent vertex is below the horizontal axis, determine that the first adjacent vertex is a reflex angle vertex.
[0252] Steps 1110 - 1130 are described in detail below.
[0253] Specifically, in step 1110, the original polygon includes multiple vertices, among which there is a reflex vertex. In order to find the reflex vertex, each vertex needs to be used as a starting point in turn. Fig.12 As shown, the original polygon includes vertex V1, vertex V2, vertex V3, vertex V4 and vertex V5, and vertex V1, vertex V2, vertex V3, vertex V4 and vertex V5 are taken as starting points in turn.
[0254] In step 1120, the first adjacent vertex is a vertex on the boundary of the original polygon that is adjacent to the starting point in the counterclockwise direction. Fig.12 As shown, if vertex V1 is used as the starting point, the first adjacent vertex is vertex V2, vertex V1 is used as the origin, and the direction from vertex V1 to vertex V2 is used as the horizontal axis, a plane rectangular coordinate system is established.
[0255] In step 1130, the second adjacent vertex is a vertex on the boundary of the original polygon that is adjacent to the first adjacent vertex in the counterclockwise direction. Fig.12 As shown, the second adjacent vertex is vertex V2, and vertex V2 is located below the horizontal axis, so vertex V1 is determined to be the reflex angle vertex.
[0256] The advantage of the embodiment of steps 1110-1130 is that each vertex is used as a starting point in turn and the rectangular coordinate system is used to determine the reflex angle vertex, which is accurate and efficient. It also has high universality, for example, it is applicable to original polygons with more than two reflex angle vertices.
[0257] In one embodiment, when the rectangular coordinate system is used to determine the reflex angle vertex in step 920, the rectangular coordinate system can be used to make a dividing line in step 930.
[0258] When this embodiment is implemented, refer to Fig.13 , the step 930 of drawing a segmentation line from the vertex of the reflex angle includes:
[0259] Step 1310: determine the segmentation end point, wherein the segmentation end point is the first vertex above the horizontal axis in the counterclockwise direction along the boundary of the original polygon starting from the second adjacent vertex;
[0260] Step 1320: Use the line from the vertex of the reflex angle to the end point of the segmentation as the segmentation line.
[0261] In one example, if Fig.14 As shown in the figure, the reflex vertex is vertex V2, and the second adjacent vertex is vertex V3. Starting from vertex V3, the first vertex above the horizontal axis along the counterclockwise direction of the original polygon boundary is vertex V4, so vertex V4 is determined as the end point of the segmentation. Then, the line from vertex V2 to vertex V4 is used as the segmentation line.
[0262] The advantage of the embodiment of steps 1310-1320 is that, when the reflex angle vertex is determined based on a rectangular coordinate system, the segmentation end point is determined again using the rectangular coordinate system, which does not bring additional computing resources and greatly saves processing resources.
[0263] Reference Fig.15 In another embodiment, step 920 includes:
[0264] Step 1510, determining the edge vector of each edge of the original polygon;
[0265] Step 1520: for each vertex of the original polygon, determine the cross product of the edge vectors of the two adjacent edges where the vertex is located;
[0266] Step 1530: If the cross product of the vertex is of different sign from the cross products of other vertices on the original polygon, the vertex is determined to be a reflex angle vertex.
[0267] Steps 1510-1530 are described in detail below.
[0268] In step 1510, the original polygonal graph includes a plurality of edges, each edge is defined by two adjacent vertices, and each edge corresponds to an edge vector. Fig.16As shown, the original polygonal figure includes vertex V1, vertex V2, vertex V3, vertex V4 and vertex V5. Vertex V1 and vertex V2 form an edge, and the corresponding edge vector is vector E1. Vertex V2 and vertex V3 form an edge, and the corresponding edge vector is vector E2. Vertex V3 and vertex V4 form an edge, and the corresponding edge vector is vector E3. Vertex V4 and vertex V5 form an edge, and the corresponding edge vector is vector E4. Vertex V5 and vertex V1 form an edge, and the corresponding edge vector is vector E5.
[0269] In step 1520, each vertex has an edge vector corresponding to two adjacent edges. The cross product of the edge vector corresponding to each vertex can be calculated. The cross product is also called the cross product or cross product, and is a binary operation of vectors in a vector space. Unlike the dot product, the result of the cross product operation is a pseudo-vector rather than a scalar, and the cross product of two vectors is perpendicular to both vectors. Assuming that the vector space in which the edge vector is located is composed of the X-axis, Y-axis, and Z-axis, and the direction of the edge vector is in the X-axis direction and the Y-direction, then the direction of the cross product is in the Z-axis direction. For example, Fig.16 As shown, the calculated cross products include vector E1×vector E2, vector E2×vector E3, vector E3×vector E4, vector E4×vector E5, and vector E5×vector E1. Note that × represents the cross product sign. (Vector E1×vector E2)z<0 means that the cross product corresponding to vertex V1 is on the negative direction side in the Z-axis direction. (Vector E2×vector E3)z>0 means that the cross product corresponding to vertex V2 is on the positive direction side in the Z-axis direction. (Vector E3×vector E4)z>0 means that the cross product corresponding to vertex V3 is on the positive direction side in the Z-axis direction. (Vector E4×vector E5)z>0 means that the cross product corresponding to vertex V4 is on the positive direction side in the Z-axis direction. (Vector E5×vector E1)z>0 means that the cross product corresponding to vertex V5 is on the positive direction side in the Z-axis direction.
[0270] At step 1530, if the cross product of the vertex is of different sign from the cross products of other vertices on the original polygon, the vertex is determined to be a reflex vertex. Fig.16 As shown, the cross product of vertex V1 is negative, while the cross products of other vertices are all positive, so vertex V1 is determined as the reflex angle vertex.
[0271] The benefit of the embodiment of steps 1510 - 1530 is that cross products of different numbers can be quickly found based on the cross product result of the edge vector, thereby improving the efficiency of determining the reflex angle vertex.
[0272] In one embodiment, when the cross product of the edge vectors is used to determine the reflex angle vertex in step 920, the cross product of the edge vectors may be used as the dividing line in step 930.
[0273] When this embodiment is implemented, refer to Fig.17 , the step 930 of drawing a segmentation line from the vertex of the reflex angle includes:
[0274] Step 1710: draw a candidate segmentation line from the reflex angle vertex to each other vertex on the original polygon, wherein each candidate segmentation line segments the original polygon into a plurality of candidate polygons to be typeset;
[0275] Step 1720: If the cross products of the edge vectors of adjacent edges of multiple candidate polygonal figures to be typeset divided by a candidate dividing line have the same sign, the candidate dividing line is used as the dividing line.
[0276] In one example, if Fig.18 As shown, the reflex angle vertex is vertex V2, and it is assumed that the segmentation end point is vertex V4, that is, the candidate segmentation line is defined by vertex V2 and vertex V4. The candidate segmentation line divides the original polygon into two candidate polygons to be typeset. Among them, one candidate polygon to be typeset includes vertex V1, vertex V2, vertex V4 and vertex V5, and the corresponding edge vectors include vector E1, vector E6, vector E4, and vector E5. Another candidate polygon to be typeset includes vertex V2, vertex V3 and vertex V4, and the corresponding edge vectors include vector E7, vector E2 and vector E3. After calculating the cross product, it is found that the cross products of the edge vectors of the adjacent edges of the multiple candidate polygons to be typeset divided by the candidate segmentation line have the same sign, and the candidate segmentation line is used as the segmentation line.
[0277] The advantage of the embodiment of steps 1710-1720 is that, when the reflex angle vertex is determined based on the edge vector, the cross product of the edge vector is used again to determine the dividing line, which can save computing resources and improve processing efficiency.
[0278] Detailed description of step 320
[0279] In step 320, if it is determined that the wrapping format of the text wrapping around the polygonal figure to be typeset is the target format, the target intersection point of the polygonal figure to be typeset and the parallel lines is determined. The parallel lines include a first line and a second line, and step 320 includes: determining a first intersection point of the polygonal figure to be typeset and the first line, and a second intersection point of the polygonal figure to be typeset and the second line, and integrating the first intersection point and the second node to obtain the target intersection point.
[0280] Reference Fig.19 In one embodiment, determining the target intersection of the polygonal figure to be typeset and the parallel lines in step 320 includes:
[0281] Step 1910: for each edge of the polygon to be typeset, determine the sub-intersection point between the edge and the parallel line;
[0282] Step 1920: Integrate the sub-intersection points of multiple edges of the polygonal figure to be typeset into target intersection points.
[0283] In step 1910, the intersection of each side of the polygonal figure to be typeset and the first line is used as the first sub-intersection point. The intersection of each side of the polygonal figure to be typeset and the second line is used as the second sub-intersection point. The first sub-intersection point and the second sub-intersection point are both sub-intersection points of the side and the parallel line.
[0284] Reference Fig. 20 In step 1910, determining the sub-intersection points of the edge and the parallel line includes:
[0285] Step 2010: determine a first sub-intersection point between the polygonal figure to be typeset and the first line, and a second sub-intersection point between the polygonal figure to be typeset and the second line.
[0286] After determining the sub-intersection point, refer to Fig. 20 , step 1920 includes: step 2020, integrating the first sub-intersections of multiple edges of the polygonal figure to be typeset into the first intersection, and integrating the second sub-intersections into the second intersection.
[0287] The benefit of the embodiment of steps 2010-2020 is that the complexity of determining the target intersection can be simplified by respectively calculating the first sub-intersection of the edge with the first line and the second sub-intersection with the second line and then integrating them to obtain the target intersection.
[0288] In one example, each edge of the polygon to be typeset may correspond to a piecewise function, and the parallel lines may also correspond to a function, and the intersection point may be determined based on these two functions. Fig.21A , the function of the edge corresponding to vertex V1 and vertex V2 is y=kx+b1, a1≤x≤a2, k represents the slope, a1, a2, b1 represent constants. The function of parallel lines can be y=b2 and y=b3, b2 and b3 represent constants. Assuming k=2, b1=-2, a1=2.5, a2=4, b2=2, b3=4, the coordinates of the target intersection are calculated to be (3,4). Based on the above process of solving the intersection, refer to Fig. 21B , the target intersection points of the polygonal figure to be typeset and the parallel line are calculated to include {j1, j2, j3, j4}. Among them, the coordinates of j1 are (3, 4), the coordinates of j2 are (0.3, 2), the coordinates of j3 are (2, 2), and the coordinates of j4 are (1.7, 3).
[0289] Detailed description of step 330
[0290] In step 330, a prohibited layout space is determined based on the target intersection point and the target vertex in the row space among the plurality of vertices.
[0291] In one embodiment, the target vertex is determined by:
[0292] A plane rectangular coordinate system is established with a direction parallel to the first line and the second line as a horizontal axis direction, wherein the first line has a first vertical coordinate and the second line has a second vertical coordinate;
[0293] Determine the ordinates of multiple vertices in a plane rectangular coordinate system;
[0294] If the ordinate of the vertex is between the first ordinate and the second ordinate, the vertex is determined as a target vertex.
[0295] For example, Fig. 21B As shown, it is assumed that the first ordinate of the first line is 2, and the second ordinate of the second line is 4. If the ordinate of vertex V1 is 5, it means that the ordinate of vertex V1 is not between the first ordinate and the second ordinate, and vertex V5 is not the target vertex. If the ordinate of vertex V2 is 3, it means that the ordinate of vertex V2 is between the first ordinate and the second ordinate, and vertex V2 is the target vertex. If the ordinate of vertex V3 is 1, it means that the ordinate of vertex V3 is not between the first ordinate and the second ordinate, and vertex V1 is not the target vertex. If the ordinate of vertex V4 is 2.5, it means that the ordinate of vertex V4 is between the first ordinate and the second ordinate, and vertex V4 is the target vertex. If the ordinate of vertex V5 is 3.5, it means that the ordinate of vertex V5 is between the first ordinate and the second ordinate, and vertex V5 is the target vertex. Finally, the target vertices include {vertex V2, vertex V4, get V5}.
[0296] The advantage of this embodiment is that the target vertex can be quickly determined using a plane rectangular coordinate system, thereby improving the determination accuracy and efficiency.
[0297] Reference Fig. 22 In one embodiment, step 330 includes:
[0298] Step 2210: based on the target intersection point and the target vertex, obtain the target edge line segment of the polygonal figure to be typeset that is cut out by the row space;
[0299] Step 2220: based on the target intersection point, obtain the target segment of the parallel line cut off by the polygonal graphic to be typeset;
[0300] Step 2230: determine the interval enclosed by the target edge segment and the target transverse segment as a prohibited typesetting space.
[0301] Steps 2210-2230 are described in detail below.
[0302] In step 2210, the target edge segment refers to the segment of the edge of the polygon to be typeset that is cut off by the line space. Fig.23As shown, for the edge defined by vertex V1 and vertex V2, there is a part of the line segment located in the row space, which is defined by intersection j1 and vertex V2. A target edge segment can be represented by (j1, V2). Similarly, a target edge segment can be represented by (V2, j2), a target edge segment can be represented by (j3, V4), a target edge segment can be represented by (V4, V5), and a target edge segment can be represented by (V5, j4). Finally, the target edge segment includes {(j1, V2), (V2, j2), (j3, V4), (V4, V5), (V5, j4)}.
[0303] In step 2220, the target segment is a segment of a parallel line that is cut off by the graphics to be typeset. Fig.23 As shown, there are two line segments of the parallel line cut off by the graphics to be typeset. One target cut-off line segment is defined by the intersection point j1 and the intersection point j4, and can be represented by (j1, j4). Another target cut-off line segment is defined by the intersection point j2 and the intersection point j4, and can be represented by (j2, j3). Finally, the target cut-off line segments include {(j1, j4), (j2, j3)}.
[0304] After determining the target edge segment and the target cross-line segment, in step 2330, the interval enclosed by the target edge segment and the target cross-line segment is determined as a prohibited layout space. Fig.23 As shown, the interval enclosed by the target edge segments {(j1, V2), (V2, j2), (j3, V4), (V4, V5), (V5, j4)} and the target transverse segment {(j1, j4), (j2, j3)} is determined as the prohibited typesetting space.
[0305] The advantage of the implementation example of steps 2210-2230 is that the target edge segments and target transverse segments are first determined based on the target intersection points and target vertices, and then the forbidden layout space is determined based on the target edge segments and target transverse segments. This can avoid the processing resources required to directly determine the internal gaps of the concave polygon, and the calculation of the target intersection points and target vertices consumes less computing resources, which greatly reduces the resource pressure of the processing equipment and improves processing efficiency.
[0306] In one embodiment, step 2210 includes:
[0307] Taking the target intersection point and the target vertex as the interception points, obtaining the edge line segments to be examined between the adjacent interception points in the polygonal figure to be typeset;
[0308] If at least one endpoint of the edge segment to be examined is a target vertex, it is determined that the edge segment to be examined is a target edge segment.
[0309] For example, Fig.24As shown, the target intersection point and the target vertex are both used as interception points, and the interception points obtained include {j1, V2, j2, j3, V4, V5, j4}. Based on the adjacent interception points in the polygonal figure to be typeset, the sideline segments to be examined can be determined, and the sideline segments to be examined include {(j1, V2), (V2, j2), (j2, j3), (j3, V4), (V4, V5), (V5, j4), (j4, j1)}. For the sideline segments to be examined (j2, j3) and (j4, j1), it does not meet the condition that at least one endpoint of the sideline segment to be examined is the target vertex, so it cannot be used as the target sideline segment. Finally, the determined target sideline segments include {(j1, V2), (V2, j2), (j3, V4), (V4, V5), (V5, j4)}.
[0310] The advantage of this embodiment is that the edge segments to be examined are first determined, and then the edge segments that meet the conditions are obtained from the edge segments to be examined as target edge segments, which can ensure the accuracy of obtaining the target edge segments. And because the intercept points come from the target intersection points and target vertices, no additional computing resources are added, thereby improving processing efficiency.
[0311] In one embodiment, the parallel lines include a first line and a second line, the target intersection includes a first intersection and a second intersection, and the target segment includes a first segment and a second segment. Based on the first intersection, a first segment of the first line cut off by the polygonal graphic to be typeset can be obtained, and based on the second intersection, a second segment of the second line cut off by the polygonal graphic to be typeset can be obtained.
[0312] When this embodiment is implemented, refer to Fig.25 , step 2220 includes:
[0313] Step 2510: if the first intersection point is a vertex of the polygon to be typeset, split the first intersection point into two first intersection points;
[0314] Step 2520: connect an odd-numbered first intersection point among the plurality of first intersection points and a first intersection point adjacent to the first intersection point to form a line segment as a first section segment;
[0315] Step 2530: if the second intersection point is a vertex of the polygon to be typeset, split the second intersection point into two second intersection points;
[0316] Step 2540: Connect an odd-numbered second intersection point among the plurality of second intersection points and a second intersection point adjacent to the second intersection point into a line segment as a second section segment.
[0317] Steps 2510-2540 are described in detail below.
[0318] In step 2510, the first intersection is the intersection of the polygonal figure to be typeset and the first line, indicating that the first intersection is located both in the polygonal figure to be typeset and in the first line. Due to the through-type wrapping, when the figure is more complex, there may be multiple intersections. According to the Jordan curve theorem, for a parallel line, when it passes through the polygonal figure, if none of the intersections are vertices, an even number of intersections will be generated. Therefore, the real internal space of the figure must be one in and one out.
[0319] For example, refer to Fig.26A , assuming that the polyline ( Fig.26A The solid black line in the figure is part of a polygon. The parallel lines ( Fig.26A The black dotted line in the figure indicates that the first intersection with the leftmost point must have entered the interior of the polygon first, and the second intersection went out to the outside, and so on. Then, 6 intersections were obtained, including intersection m1, intersection m2, intersection m3, intersection m4, intersection m5, and intersection m6. Since these 6 intersections are not vertices, there is no need to split them. Then, the first intersection includes {m1, m2, m3, m4, m5, m6}.
[0320] For example, refer to Fig.26B , assuming that the polyline ( Fig.26B The solid black line in the figure is part of a polygon. The parallel lines ( Fig.26B The black dotted line in the figure indicates that the first intersection with its leftmost point must have entered the interior of the polygon first, and the second intersection went out to the outside, and so on. Then, 5 intersections were obtained, including intersection m1, intersection m2, intersection m3, intersection m4, and intersection m5. Since intersection m1, intersection m2, intersection m4, and intersection m5 are not vertices, and intersection m3 is a vertex, intersection m3 needs to be split into two intersections m3. Then, the first intersection includes {m1, m2, m3, m3, m4, m5}.
[0321] In step 2520, the odd-numbered first intersection points among the plurality of first intersection points and the first intersection points adjacent to the first intersection points are connected into a line segment as the first line segment. For example, assuming that there are 4 first intersection points, for the first first intersection point, the first intersection point adjacent to it is the second first intersection point. For the third first intersection point, the first intersection point adjacent to it is the fourth first intersection point. Therefore, the first first intersection point and the second intersection point are connected into a line segment as the first line segment. The third first intersection point and the fourth intersection point are also connected into a line segment as the first line segment.
[0322] For example, Fig.26A As shown, based on the first intersection points including {m1, m2, m3, m4, m5, m6}, it can be obtained that the first section segment includes {(m1, m2), (m3, m4), (m5, m6)}. For another example, Fig.26BAs shown, based on the first intersection points including {m1, m2, m3, m3, m4, m5}, it can be obtained that the first section segment includes {(m1, m2), (m3, m3), (m4, m5)}.
[0323] The process of step 2530 is similar to that of step 2510, and will not be described in detail. The process of step 2530 is similar to that of step 2510, and will not be described in detail.
[0324] In one example, refer to Fig.26C , the first intersection of a polygon to be typeset and the first line includes {j1, j4}, and the second intersection with the second line includes {j2, j3}. Since the first intersection is not a vertex, there is no need to split it. Similarly, the second intersection does not need to be split. Based on the first intersection including {j1, j4}, the first line segment is (j1, j4). Based on the second intersection including {j2, j3}, the second line segment is (j2, j3). Finally, the target line segment includes {(j1, j4), (j2, j3)}.
[0325] The advantage of the embodiment of steps 2510-2540 is that by determining whether the first intersection point and the second intersection point are vertices to decide whether to split, the target cut-off line segment can be effectively formed based on the intersection point after the split, thereby improving the accuracy of obtaining the target cut-off line segment.
[0326] It should be noted that the polygonal figure to be typeset in the above embodiment can be a convex polygon or a concave polygon, and has high universality. For convex polygons, assuming that the parallel lines are in the horizontal direction, the prohibited typesetting space can be determined by considering the leftmost and rightmost points of the convex polygon in the row space by crossing-type wrapping. If there are multiple convex polygons, the prohibited typesetting space can be determined based on the leftmost and rightmost points corresponding to each convex polygon. The following is a detailed description of the embodiment of determining the prohibited typesetting space for the case where the polygonal figure to be typeset is a convex polygon.
[0327] Reference Fig. 27 In this embodiment, the polygonal figure to be typeset is a convex polygon, and step 330 includes:
[0328] Step 2710, determining the direction parallel to the parallel line as the first axis direction;
[0329] Step 2720, mapping the target intersection point and the target vertex to the first axis direction to obtain a plurality of first axis mapping values;
[0330] Step 2730: determine the prohibited typesetting subspace corresponding to the convex polygon based on the minimum first-axis mapping value and the maximum first-axis mapping value among the multiple first-axis mapping values;
[0331] Step 2740: Take the union of multiple forbidden typesetting subspaces corresponding to multiple convex polygons as the forbidden typesetting space.
[0332] Steps 2710-2740 are described in detail below.
[0333] In step 2710, the direction parallel to the parallel line is determined as the first axis direction. Fig.28A As shown, the direction of the parallel lines is horizontal, and the direction of the first axis is also horizontal.
[0334] In step 2720, the target intersection point and the target vertex are mapped to the first axis direction to obtain a plurality of first axis mapping values. Fig.28A As shown, the first axis mapping value corresponding to the target intersection j1 is 8. The first axis mapping value corresponding to the target intersection j2 is 9. The first axis mapping value corresponding to the target intersection j3 is 15. The first axis mapping value corresponding to the target intersection j4 is 14. The first axis mapping value corresponding to the target vertex V2 is 5. The first axis mapping value corresponding to the target vertex V4 is 17. The first axis mapping value corresponding to the target vertex V5 is 16. Finally, the first mapping values include {5, 8, 9, 14, 15, 16, 17}.
[0335] In step 2730, based on the minimum first axis mapping value and the maximum first axis mapping value among the plurality of first axis mapping values, the prohibited typesetting subspace corresponding to the convex polygon is determined. When the first axis direction is horizontal, the minimum first axis is mapped to the leftmost point of the corresponding convex polygon, and the maximum first axis is mapped to the rightmost point of the corresponding convex polygon. Fig.28A As shown, the minimum first axis mapping value in the first mapping value is 5, and the maximum first axis mapping value is 17. Therefore, the forbidden typesetting subspace corresponding to the convex polygon is [5,17].
[0336] In step 2740, the union of the multiple forbidden layout subspaces corresponding to the multiple convex polygons is used as the forbidden layout space. Fig.28A As shown, based on the forbidden typesetting subspace [5,17] as the forbidden typesetting space, the part outside the forbidden typesetting space in the row space is the remaining space.
[0337] In one example, if Fig.28B As shown, the original polygon is a concave polygon. The original polygon is divided into two polygons to be typed, and the polygons to be typed are convex polygons. Among them, the first axis mapping values of one convex polygon in the first axis direction include {4,5,6,7}, so the forbidden typesetting subspace is [4,7]. The first axis mapping values of the other convex polygon in the first axis direction include {12,13,14,15}, so the forbidden typesetting subspace is [12,15]. Based on the union of these two forbidden typesetting subspaces, the forbidden typesetting space includes {[4,7], [12,15]}, and the part outside the forbidden typesetting space in the row space is the remaining space.
[0338] The advantage of the embodiment of steps 2710-2740 is that the forbidden layout space is determined by using the minimum first-axis mapping value and the maximum first-axis mapping value of the convex polygon, without the need for complex algorithm logic, thus greatly reducing the complexity of the algorithm.
[0339] Detailed description of step 340
[0340] In step 340, the text is typeset in the portion outside the prohibited typesetting space in the line space.
[0341] It should be noted that the line space is defined by parallel lines and is used to place text. The width of the line space is generally related to the resolution of the terminal. The height of the line space is related to the height of the text. For example, the height of the line space is the same as the standard text height.
[0342] Reference Fig.29 In one embodiment, step 340 includes:
[0343] Step 2910, determining the direction parallel to the parallel line as the first axis direction;
[0344] Step 2920: Map each edge of the forbidden typesetting space to the first axis direction to obtain the first axis sub-mapping interval of the edge;
[0345] Step 2930, taking a union of the first axis sub-mapping intervals mapped by each edge of the forbidden typesetting space to obtain a first axis mapping interval;
[0346] Step 2940: typeset the text in the remaining interval outside the first axis mapping interval in the first axis direction of the row space.
[0347] Steps 2910-2940 are described in detail below.
[0348] In step 2910, the direction parallel to the parallel line is determined as the first axis direction. Fig.30 As shown, the direction of the parallel lines is horizontal, and the direction of the first axis is also horizontal.
[0349] In step 2920, the mapping value of each edge of the prohibited typesetting space in the first axis direction represents the area where the text cannot be typeset, so the first axis sub-mapping interval of the edge can represent the area where the text cannot be typeset. Fig.30 As shown in the figure, for a concave polygon to be typeset, there are often more than two forbidden typeset spaces inside the parallel lines. Among them, the first axis sub-mapping interval corresponding to the edge of one forbidden typesetting space includes {[4,5], [4,6], [5,7], [6,7]}. The first axis sub-mapping interval corresponding to the edge of another forbidden typesetting space includes {[12,13], [12,14], [13,15], [14,15]}.
[0350] In step 2930, the first axis sub-mapping intervals mapped by each edge of the forbidden typesetting space are combined to obtain the first axis mapping interval. Fig.30 As shown, based on the first axis sub-mapping interval including {[4,5], [4,6], [5,7], [6,7]}, the first axis mapping interval can be obtained as [4,7]. Based on the first axis sub-mapping interval including {[12,13], [12,14], [13,15], [14,15]}, the first axis mapping interval can be obtained as [12,15]. Finally, the first axis mapping interval includes {[4,7], [12,15]}.
[0351] In step 2940, the text is typeset in the remaining interval outside the first axis mapping interval in the first axis direction of the row space. Fig.30 As shown, the remaining intervals outside {[4,7], [12,15]} include {[-∞,4], [7,12], [15,+∞]}.
[0352] The advantage of the embodiment of steps 2910-2940 is that by mapping the forbidden typesetting space using the first axis direction, the remaining interval can be quickly determined, thereby improving the determination efficiency and thus improving the typesetting processing efficiency.
[0353] In one embodiment, the remaining interval has at least one of an upper limit value and a lower limit value. Fig.31 , step 2940 includes:
[0354] Step 3110: if the remaining interval has a lower limit value, the lower limit value is rounded up relative to the first multiple of the standard text width to obtain a first correction multiple;
[0355] Step 3120: if the remaining interval has an upper limit value, round down the upper limit value relative to the second multiple of the standard text width to obtain a second correction multiple;
[0356] Step 3130: Correct the remaining interval based on at least one of the first correction multiple and the second correction multiple;
[0357] Step 3140: typeset the text in the remaining interval.
[0358] In steps 3110-3120, the remaining interval may have an upper limit value, for example, the remaining interval is [-∞,4], and the upper limit value is 4. The remaining interval may have a lower limit value, for example, the remaining interval is [15,+∞], and the lower limit value is 15. The remaining interval may also have an upper limit value and a lower limit value, for example, the remaining interval is [7,12], the lower limit value is 7, and the upper limit value is 12. Considering that the text is usually arranged in sequence according to the standard text width when typeset in the remaining interval, the remaining interval is a multiple of the standard text width. For example, if the remaining interval has a lower limit value of 7, assuming the standard text width is 3, the first multiple is first calculated to be 7 / 3, and then rounded up to obtain a first correction multiple of 3. For another example, if the remaining interval has an upper limit value of 4, assuming the standard text width is 3, the second multiple is first calculated to be 4 / 3, and then rounded down to obtain a first correction multiple of 1.
[0359] In step 3130, the method specifically includes obtaining a corrected lower limit value based on the first correction multiple and the standard text width, obtaining a corrected upper limit value based on the second correction multiple and the standard text width, and determining a corrected remaining interval based on at least one of the corrected lower limit value and the corrected upper limit value. For example, the remaining interval [-∞, 4] is corrected to [-∞, 3]. For another example, the remaining interval [7, 12] is corrected to [9, 12].
[0360] Finally, in step 3140, the text is typeset in the remaining interval.
[0361] In one example, if Fig.32 As shown, assuming that the interval of the prohibited typesetting space corresponding to the dotted part is [5,17], the remaining intervals are [-∞,5] and [17,+∞]. Among them, the lower limit is 17 and the upper limit is 5. Assume that the standard text width is 3. Based on the lower limit of 17, the first multiple is calculated to be 17 / 3, then the first correction multiple is 6 after rounding up, and the remaining interval [17,+∞] is corrected to [18,+∞]. Based on the upper limit of 5, the second multiple is calculated to be 5 / 3, then the second correction multiple is 1 after rounding down, and the remaining interval [-∞,5] is corrected to [-∞,3].
[0362] The benefit of the embodiment of steps 3110-3140 is that by correcting the remaining interval based on the standard text width, the typesetting efficiency of the text in the remaining interval can be improved, and no additional comparison between the width of the remaining interval and the text space is required, thus saving processing resources.
[0363] In one embodiment, step 3140 includes:
[0364] Divide the remaining interval according to the standard text width to obtain multiple typesetting areas;
[0365] The texts are typeset in a plurality of typesetting areas according to the direction in which the texts are written, and one typesetting area corresponds to one text.
[0366] In one example, assuming that the remaining interval is [0,6] and the standard text width is 3, 2 layout areas can be obtained. In this example, the layout areas include {[0,3], [3,6]}. In another example, assuming that the remaining interval is [12,21] and the standard text width is 3, 3 layout areas can be obtained. In this example, the layout areas include {[12,15], [15,18], [18,21]}.
[0367] The advantage of this embodiment is that by dividing the remaining interval into multiple layout areas, there is no need to additionally judge the relationship between the text and the remaining space, and the text can be directly typeset into the layout area, thereby improving the layout efficiency.
[0368] Detailed diagram of the implementation of the typesetting processing method of the disclosed embodiment
[0369] Refer to the following Fig.33 and Fig.34 , the implementation details of the typesetting processing method of the embodiment of the present disclosure are explained in detail and by way of example.
[0370] like Fig.33 As shown, the typesetting processing method of the embodiment of the present disclosure includes the following implementation details:
[0371] Get the polygonal graphics to be typeset and the line space for typeset text;
[0372] If it is determined that the wrapping format of the text wrapping around the polygonal figure to be typeset is the target format, a target intersection point of the polygonal figure to be typeset and the parallel lines is determined;
[0373] Based on the target intersection point and the target vertex located in the row space among the multiple vertices, the target edge line segment intercepted by the row space of the polygonal figure to be typeset is obtained; based on the target intersection point, the target intercepted line segment intercepted by the parallel line of the polygonal figure to be typeset is obtained;
[0374] Based on the target intersection point, a target segment segment of the parallel line intercepted by the polygonal graphic to be typeset is obtained;
[0375] The interval enclosed by the target edge segment and the target intercept segment is determined as a prohibited typesetting space;
[0376] Typeset text outside the prohibited typesetting space in the line space.
[0377] like Fig.34 As shown, the typesetting processing method of the embodiment of the present disclosure includes the following implementation details:
[0378] Obtaining an original polygonal figure, identifying the reflex angle vertices of the original polygonal figure, making a dividing line from the reflex angle vertices, dividing the original polygonal figure into a plurality of polygonal figures to be typeset, and obtaining a line space for typeset text;
[0379] If it is determined that the wrapping format of the text wrapping around the polygonal figure to be typeset is the target format, a target intersection point of the polygonal figure to be typeset and the parallel lines is determined;
[0380] Determine a direction parallel to the parallel lines as a first axis direction, map a target intersection point and a target vertex in the row space among the multiple vertices to the first axis direction, and obtain multiple first axis mapping values;
[0381] Determine a prohibited typesetting subspace corresponding to the convex polygon based on a minimum first-axis mapping value and a maximum first-axis mapping value among the plurality of first-axis mapping values;
[0382] The union of multiple forbidden typesetting subspaces corresponding to multiple convex polygons is used as the forbidden typesetting space;
[0383] Typeset text outside the prohibited typesetting space in the line space.
[0384] The advantages of the above implementation details are that the complexity is O(n), which is relatively low, and the processing efficiency of polygonal graphics in the through-surround format is relatively high. In addition, the embodiments of the present disclosure are excellent in the restoration accuracy of the through-surround effect.
[0385] About the contrast effect of cross-type wrapping typesetting
[0386] Refer to the following Fig.35A , Fig.35B , Fig.35C and Fig.35D , and detailed examples illustrate the contrast effect of the through-type wrapping layout.
[0387] like Fig.35A and Fig.35B As shown in the figure, in the online document, after applying the through-type wrapping algorithm provided by the related technology, the test text can only wrap around the graphics, and the through-type wrapping cannot be achieved. It can be seen that in the online document, it is basically impossible to achieve the effect of text wrapping around the graphics. In most cases, the text cannot even achieve the effect of tightly wrapping around the graphics, and will be downgraded to the four-sided wrapping.
[0388] like Fig.35C and Fig.35D As shown, in the online document, after applying the typesetting processing method provided by the embodiment of the present disclosure, the test text can not only tightly surround the graphics, but also accurately pass through the surrounding graphics. It can be seen that the embodiment of the present disclosure can achieve the effect of text tightly surrounding the polygonal graphics to be typeset, and can achieve the effect of text passing through the polygonal graphics to be typeset.
[0389] Description of the apparatus and device of the present disclosure
[0390] It is to be understood that, although the steps in the above-mentioned flowcharts are sequentially displayed according to the characterization of arrows, these steps are not necessarily executed in sequence according to the order of arrow characterization. Unless there is a clear description in the present embodiment, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a portion of the steps in the above-mentioned flowcharts can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a portion of the steps or stages in other steps.
[0391] It should be noted that in each specific implementation of the present application, when it comes to the need to perform relevant processing based on data related to the characteristics of the task content, such as task content attribute information or attribute information sets, the permission or consent of the task content will be obtained first, and the collection, use and processing of these data will comply with relevant laws, regulations and standards. In addition, when the embodiment of the present application needs to obtain task content attribute information, it will obtain a separate permission or separate consent for the task content through a pop-up window or jump to a confirmation page. After clearly obtaining a separate permission or separate consent for the task content, the necessary task content-related data used to enable the normal operation of the embodiment of the present application will be obtained.
[0392] Fig.36 The schematic diagram of the structure of the typesetting processing device 3600 provided in the embodiment of the present disclosure. The typesetting processing device 3600 is used for mixed typesetting of graphics and texts, and the typesetting processing device 3600 includes:
[0393] An acquisition unit 3610 is used to acquire a polygonal figure to be typeset and a line space for typeset text, wherein the line space is defined by parallel lines and the polygonal figure to be typeset includes a plurality of vertices;
[0394] The first determining unit 3620 is used to determine the target intersection point of the polygonal figure to be typeset and the parallel line if it is determined that the wrapping format of the text wrapping around the polygonal figure to be typeset is the target format;
[0395] A second determining unit 3630 is used to determine a prohibited typesetting space based on a target intersection point and a target vertex located in the row space among a plurality of vertices;
[0396] The typesetting unit 3640 is used to typeset text in a portion outside the prohibited typesetting space in a line space.
[0397] Optionally, the first determining unit 3620 is specifically configured to:
[0398] For each edge of the polygonal figure to be typeset, determine the sub-intersection point of the edge and the parallel line;
[0399] Integrate the sub-intersection points of multiple edges of the polygonal figure to be typeset into the target intersection point.
[0400] Optionally, the second determining unit 3630 is specifically configured to:
[0401] Based on the target intersection point and the target vertex, the target edge segment of the polygonal figure to be typeset is obtained which is cut off by the row space;
[0402] Based on the target intersection point, a target segment segment of the parallel line intercepted by the polygonal graphic to be typeset is obtained;
[0403] The interval enclosed by the target edge segment and the target intercept segment is determined as a prohibited typesetting space.
[0404] Optionally, the first determining unit 3620 is specifically configured to:
[0405] Taking the target intersection point and the target vertex as the interception points, obtaining the edge line segments to be examined between the adjacent interception points in the polygonal figure to be typeset;
[0406] If at least one endpoint of the edge segment to be examined is a target vertex, it is determined that the edge segment to be examined is a target edge segment.
[0407] Optionally, the parallel lines include a first line and a second line, the target intersection includes a first intersection and a second intersection, and the target section segment includes a first section segment and a second section segment; the first determining unit 3620 is specifically configured to:
[0408] Determine a first intersection point between the polygonal figure to be typeset and the first line, and a second intersection point between the polygonal figure to be typeset and the second line;
[0409] If the first intersection point is a vertex of the polygon to be typeset, split the first intersection point into two first intersection points;
[0410] Connecting an odd-numbered first intersection point among the plurality of first intersection points and a first intersection point adjacent to the first intersection point to form a line segment as a first section segment;
[0411] If the second intersection point is a vertex of the polygon to be typeset, split the second intersection point into two second intersection points;
[0412] An odd-numbered second intersection point among the plurality of second intersection points and a second intersection point adjacent to the second intersection point are connected to form a line segment as a second section segment.
[0413] Optionally, the typesetting unit 3640 is specifically used for:
[0414] Determine the direction parallel to the parallel line as the first axis direction;
[0415] Map each edge of the forbidden typesetting space to the first axis direction to obtain the first axis sub-mapping interval of the edge;
[0416] Take the union of the first-axis sub-mapping intervals mapped by each edge of the forbidden typesetting space to obtain the first-axis mapping interval;
[0417] The text is typeset in the remaining interval outside the first axis mapping interval in the first axis direction of the row space.
[0418] Optionally, the remaining interval has at least one of an upper limit value and a lower limit value, and the typesetting unit 3640 is further configured to:
[0419] If the remaining interval has a lower limit value, the lower limit value is rounded up relative to the first multiple of the standard text width to obtain a first correction multiple;
[0420] If the remaining interval has an upper limit value, the upper limit value is rounded down relative to the second multiple of the standard text width to obtain a second correction multiple;
[0421] Correcting the remaining interval based on at least one of the first correction multiple and the second correction multiple;
[0422] In the remaining interval, typeset the text.
[0423] Optionally, the typesetting unit 3640 is further configured to:
[0424] Based on the first correction multiple and the standard text width, a corrected lower limit value is obtained;
[0425] Based on the second correction multiple and the standard text width, a corrected upper limit value is obtained;
[0426] Based on at least one of the corrected lower limit value and the corrected upper limit value, a corrected remaining section is determined.
[0427] Optionally, the parallel lines include a first line and a second line, and the target vertex is determined by the second determining unit in the following manner:
[0428] A plane rectangular coordinate system is established with a direction parallel to the first line and the second line as a horizontal axis direction, wherein the first line has a first vertical coordinate and the second line has a second vertical coordinate;
[0429] Determine the ordinates of multiple vertices in a plane rectangular coordinate system;
[0430] If the ordinate of the vertex is between the first ordinate and the second ordinate, the vertex is determined as a target vertex.
[0431] Optionally, the acquiring unit 3610 is specifically configured to:
[0432] Get the graphics to be typeset;
[0433] If the graphic to be typeset has a curved edge, multiple sampling points are set on the curved edge, and the multiple sampling points include a start point and an end point of the curved edge;
[0434] Connecting two adjacent sampling points among the plurality of sampling points with a line segment to form a polyline edge between the plurality of sampling points;
[0435] Replace the curved edge with the broken line edge to obtain the polygonal figure to be typeset.
[0436] Optionally, the acquiring unit 3610 is further configured to:
[0437] Determine the length of the curve side;
[0438] Get typesetting accuracy;
[0439] Determine the number of sampling points based on length and layout accuracy.
[0440] Optionally, the acquiring unit 3610 is further configured to:
[0441] Get the original polygonal figure, which is a concave polygon;
[0442] Identify the reflex angle vertices of the original polygon;
[0443] The original polygon is divided into a plurality of polygons to be laid out by making a dividing line from the vertex of the apparent angle, and the polygons to be laid out are convex polygons.
[0444] Optionally, the acquisition unit is further configured to:
[0445] Take each vertex of the original polygon as the starting point in turn;
[0446] A plane rectangular coordinate system is established with the starting point as the origin and the direction from the starting point to the first adjacent vertex as the horizontal axis, wherein the first adjacent vertex is the vertex on the boundary of the original polygon that is adjacent to the starting point in the counterclockwise direction;
[0447] If the second adjacent vertex is located below the horizontal axis, the first adjacent vertex is determined to be a reflex angle vertex, wherein the second adjacent vertex is a vertex on the boundary of the original polygon and adjacent to the first adjacent vertex in a counterclockwise direction.
[0448] Optionally, the acquiring unit 3610 is further configured to:
[0449] Determine a segmentation end point, wherein the segmentation end point is the first vertex above the horizontal axis in the counterclockwise direction along the boundary of the original polygon starting from the second adjacent vertex;
[0450] The line from the vertex of the reflex angle to the end point of the division is used as the division line.
[0451] Optionally, the acquiring unit 3610 is further configured to:
[0452] Determine the edge vector of each edge of the original polygon;
[0453] For each vertex of the original polygon, determine the cross product of the edge vectors of the two adjacent edges where the vertex lies;
[0454] If the cross product of a vertex is of a different sign than the cross products of other vertices on the original polygon, the vertex is determined to be a reflex angle vertex.
[0455] Optionally, the acquiring unit 3610 is further configured to:
[0456] From the reflex angle vertex to each other vertex on the original polygon, a candidate segmentation line is drawn, wherein each candidate segmentation line segments the original polygon into a plurality of candidate polygons to be typeset;
[0457] If the cross products of the edge vectors of adjacent edges of multiple candidate polygonal figures to be typeset divided by a candidate dividing line have the same sign, the candidate dividing line is used as the dividing line.
[0458] Optionally, the second determining unit 3630 is further configured to:
[0459] Determine the direction parallel to the parallel line as the first axis direction;
[0460] Mapping the target intersection point and the target vertex to the first axis direction to obtain a plurality of first axis mapping values;
[0461] Determine a prohibited typesetting subspace corresponding to the convex polygon based on a minimum first-axis mapping value and a maximum first-axis mapping value among the plurality of first-axis mapping values;
[0462] The union of multiple forbidden typesetting subspaces corresponding to multiple convex polygons is used as the forbidden typesetting space.
[0463] Reference Fig.37 , Fig.37 The structural block diagram of the terminal part for implementing the typesetting processing method of the embodiment of the present disclosure includes: a radio frequency (RF) circuit 3710, a memory 3715, an input unit 3730, a display unit 3740, a sensor 3750, an audio circuit 3760, a wireless fidelity (WiFi) module 3770, a processor 3780, and a power supply 3790. Those skilled in the art can understand that Fig.37 The terminal structure shown does not constitute a limitation on the mobile phone or computer, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0464] The RF circuit 3710 can be used for receiving and sending signals during information transmission or calls. In particular, after receiving the downlink information from the base station, it is sent to the processor 3780 for processing; in addition, the designed uplink data is sent to the base station.
[0465] The memory 3715 may be used to store software programs and modules. The processor 3780 executes various functional applications and data processing of the content terminal by running the software programs and modules stored in the memory 3715 .
[0466] The input unit 3730 may be used to receive input digital or character information and generate key signal input related to the setting and function control of the content terminal. Specifically, the input unit 3730 may include a touch panel 3731 and other input devices 3732.
[0467] The display unit 3740 may be used to display input information or provided information and various menus of the content terminal. The display unit 3740 may include a display panel 3741.
[0468] The audio circuit 3760, the speaker 3761, and the microphone 3762 may provide an audio interface.
[0469] In this embodiment, the processor 3780 included in the terminal can execute the typesetting processing method of the previous embodiment.
[0470] The terminals of the embodiments of the present disclosure include but are not limited to mobile phones, computers, intelligent voice interaction devices, smart home appliances, vehicle terminals, aircraft, etc. The embodiments of the present invention can be applied to various scenarios, including but not limited to mixed text and image typesetting, big data processing, etc.
[0471] Fig.38 A block diagram of the structure of a portion of a server for implementing the typesetting processing method of an embodiment of the present disclosure. The server may have relatively large differences due to different configurations or performances, and may include one or more central processing units (CPUs) 3822 (for example, one or more processors) and memories 3832, and one or more storage media 3830 (for example, one or more mass storage devices) storing application programs 3842 or data 3844. Among them, the memories 3832 and the storage media 3830 may be short-term storage or permanent storage. The program stored in the storage medium 3830 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations on the server. Furthermore, the central processing unit 3822 may be configured to communicate with the storage medium 3830 and execute a series of instruction operations in the storage medium 3830 on the server.
[0472] The server may also include one or more power supplies 3826, one or more wired or wireless network interfaces 3850, one or more input and output interfaces 3858, and / or, one or more operating systems 3841, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.
[0473] The central processor 3822 in the server can be used to execute the typesetting processing method of the embodiment of the present disclosure.
[0474] The embodiments of the present disclosure also provide a computer-readable storage medium, which is used to store program codes, and the program codes are used to execute the typesetting processing methods of the aforementioned embodiments.
[0475] The embodiment of the present disclosure also provides a computer program product, which includes a computer program. A processor of a computer device reads and executes the computer program, so that the computer device executes and implements the above-mentioned typesetting processing method.
[0476] The terms "first", "second", "third", "fourth", etc. (if any) in the specification of the present disclosure and the above-mentioned drawings are used to distinguish similar contents, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present disclosure described herein can, for example, be implemented in an order other than those illustrated or described herein. In addition, the terms "comprises" and "comprising" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0477] It should be understood that in the present disclosure, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated content, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the associated content before and after is in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.
[0478] It should be understood that in the description of the embodiments of the present disclosure, the meaning of multiple (or multiple items) is more than two, greater than, less than, exceed, etc. are understood to not include the number, and above, below, within, etc. are understood to include the number.
[0479] In the several embodiments provided in the present disclosure, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0480] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0481] In addition, each functional unit in each embodiment of the present disclosure may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0482] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present disclosure is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the various embodiments of the present disclosure. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, referred to as ROM), random access memory (Random Access Memory, referred to as RAM), disk or optical disk and other media that can store program codes.
[0483] It should also be understood that the various implementations provided in the embodiments of the present disclosure can be combined arbitrarily to achieve different technical effects.
[0484] The above is a specific description of the implementation methods of the present disclosure, but the present disclosure is not limited to the above implementation methods. Technical personnel familiar with the art can also make various equivalent modifications or substitutions without violating the spirit of the present disclosure. These equivalent modifications or substitutions are all included in the scope defined by the claims of the present disclosure.
Claims
1. A typesetting processing method, characterized in that: The typesetting processing method is used for mixed typesetting of graphics and texts, and the typesetting processing method comprises: Acquire a polygonal figure to be typeset and a line space for typeset the text, wherein the line space is defined by parallel lines and the polygonal figure to be typeset includes a plurality of vertices; If it is determined that the wrapping format of the text wrapping around the polygonal figure to be typeset is the target format, determining a target intersection point between the polygonal figure to be typeset and the parallel line; Determine a prohibited typesetting space based on the target intersection point and a target vertex located in the row space among the plurality of vertices; The text is typeset in a portion of the line space outside the prohibited typesetting space.
2. The typesetting method according to claim 1, characterized in that: The step of determining a target intersection point between the polygonal figure to be typeset and the parallel line comprises: For each edge of the polygonal figure to be typeset, determining a sub-intersection point between the edge and the parallel line; The sub-intersections of the multiple sides of the polygonal graphic to be typeset are integrated into the target intersection.
3. The typesetting method according to claim 1, characterized in that: The step of determining the prohibited layout space based on the target intersection point and a target vertex located in the row space among the plurality of vertices includes: Based on the target intersection point and the target vertex, obtaining a target edge segment of the polygonal figure to be typeset that is cut off by the row space; Based on the target intersection point, obtaining a target segment of the parallel line cut off by the polygonal graphic to be typeset; The interval enclosed by the target edge segment and the target intercept segment is determined as the prohibited layout space.
4. The typesetting method according to claim 3, characterized in that: The step of obtaining a target edge segment of the polygonal graphic to be typeset cut out by the row space based on the target intersection point and the target vertex includes: Taking the target intersection point and the target vertex as interception points, obtaining the edge line segments to be examined between the adjacent interception points in the polygonal figure to be typeset; If at least one endpoint of the to-be-investigated edge segment is the target vertex, it is determined that the to-be-investigated edge segment is the target edge segment.
5. The typesetting method according to claim 3, characterized in that: The parallel lines include a first line and a second line, the target intersection includes a first intersection and a second intersection, and the target section segment includes a first section segment and a second section segment; The step of determining a target intersection point between the polygonal figure to be typeset and the parallel line comprises: Determine a first intersection point of the polygonal figure to be typeset and the first line, and a second intersection point of the polygonal figure to be typeset and the second line; The step of obtaining a target segment of the parallel line intercepted by the polygonal graphic to be typeset based on the target intersection point includes: If the first intersection point is a vertex of the polygon to be typeset, split the first intersection point into two first intersection points; Connecting an odd-numbered first intersection point among the plurality of first intersection points and the first intersection point adjacent to the first intersection point to form a line segment as the first section segment; If the second intersection point is a vertex of the polygon to be typeset, split the second intersection point into two second intersection points; An odd-numbered second intersection point among the plurality of second intersection points and a second intersection point adjacent to the second intersection point are connected to form a line segment as the second section segment.
6. The typesetting method according to claim 3, characterized in that: Typesetting the text in a portion outside the prohibited typesetting space in the line space includes: Determine a direction parallel to the parallel line as a first axis direction; Mapping each edge of the forbidden typesetting space to the first axis direction to obtain a first axis sub-mapping interval of the edge; Taking a union of the first axis sub-mapping intervals mapped by each edge of the forbidden typesetting space to obtain a first axis mapping interval; The text is typeset in a remaining interval outside the first axis mapping interval in the first axis direction of the line space.
7. The typesetting method according to claim 6, characterized in that: The remaining interval has at least one of an upper limit value and a lower limit value; The remaining interval outside the first axis mapping interval in the first axis direction of the line space, typeset the text, comprising: If the remaining interval has the lower limit value, the lower limit value is rounded up relative to the first multiple of the standard text width to obtain a first correction multiple; If the remaining interval has the upper limit value, the upper limit value is rounded down relative to the second multiple of the standard text width to obtain a second correction multiple; Correcting the remaining interval based on at least one of the first correction multiple and the second correction multiple; The text is typeset in the remaining interval.
8. The typesetting method according to claim 7, characterized in that: The step of correcting the remaining interval based on at least one of the first correction multiple and the second correction multiple includes: Based on the first correction multiple and the standard text width, a corrected lower limit value is obtained; Based on the second correction multiple and the standard text width, a corrected upper limit value is obtained; Based on at least one of the corrected lower limit value and the corrected upper limit value, a corrected remaining section is determined.
9. The typesetting method according to claim 1, characterized in that: The parallel lines include a first line and a second line, and the target vertex is determined by: Establishing a plane rectangular coordinate system with a direction parallel to the first line and the second line as a horizontal axis direction, wherein the first line has a first vertical coordinate and the second line has a second vertical coordinate; Determine the ordinates of the plurality of vertices in the plane rectangular coordinate system; If the ordinate of the vertex is between the first ordinate and the second ordinate, the vertex is determined as the target vertex.
10. The typesetting method according to claim 1, characterized in that: The step of obtaining the polygonal graphics to be typeset includes: Get the graphics to be typeset; If the graphic to be typeset has a curved edge, a plurality of sampling points are set on the curved edge, and the plurality of sampling points include a start point and an end point of the curved edge; Connecting two adjacent sampling points among the plurality of sampling points with a line segment to form a polyline edge between the plurality of sampling points; The curved edge is replaced by the broken line edge to obtain a polygonal figure to be typeset.
11. The typesetting method according to claim 1, characterized in that: The step of obtaining the polygonal graphics to be typeset includes: Acquire an original polygonal figure, wherein the original polygonal figure is a concave polygon; Identifying the reflex angle vertices of the original polygon; A dividing line is made from the vertex of the apparent angle to divide the original polygon into a plurality of polygons to be typeset, and the polygons to be typeset are convex polygons.
12. The typesetting method according to claim 11, characterized in that: The step of identifying the reflex angle vertices of the original polygonal figure comprises: Taking each vertex of the original polygon as a starting point in turn; A plane rectangular coordinate system is established with the starting point as the origin and the direction from the starting point to the first adjacent vertex as the horizontal axis, wherein the first adjacent vertex is a vertex on the boundary of the original polygon and adjacent to the starting point in the counterclockwise direction; If the second adjacent vertex is located below the horizontal axis, the first adjacent vertex is determined to be the reflex angle vertex, wherein the second adjacent vertex is a vertex on the boundary of the original polygon and adjacent to the first adjacent vertex in a counterclockwise direction.
13. The typesetting method according to claim 12, characterized in that: The step of drawing a dividing line from the vertex of the reflex angle comprises: Determine a segmentation end point, wherein the segmentation end point is the first vertex above the horizontal axis in the counterclockwise direction along the boundary of the original polygon starting from the second adjacent vertex; The line connecting the reflex angle vertex to the segmentation end point is used as the segmentation line.
14. The typesetting method according to claim 11, characterized in that: The step of identifying the reflex angle vertices of the original polygonal figure comprises: Determining an edge vector of each edge of the original polygon; For each vertex of the original polygon, determine the cross product of the edge vectors of two adjacent edges where the vertex is located; If the cross product of the vertex is of different sign from the cross products of other vertices on the original polygon, the vertex is determined to be the reflex angle vertex.
15. The typesetting method according to claim 14, characterized in that: The step of drawing a dividing line from the vertex of the reflex angle comprises: Drawing a candidate segmentation line from the reflex angle vertex to each other vertex on the original polygon, wherein each candidate segmentation line segments the original polygon into a plurality of candidate polygons to be typeset; If the cross products of the edge vectors of the adjacent edges of the plurality of candidate polygonal figures to be typeset that are divided by a candidate dividing line have the same sign, the candidate dividing line is used as the dividing line.
16. The typesetting method according to claim 11, characterized in that: The step of determining the prohibited layout space based on the target intersection point and a target vertex located in the row space among the plurality of vertices includes: Determine a direction parallel to the parallel line as a first axis direction; Mapping the target intersection point and the target vertex to the first axis direction to obtain a plurality of first axis mapping values; Determine a prohibited typesetting subspace corresponding to the convex polygon based on a minimum first-axis mapping value and a maximum first-axis mapping value among the plurality of first-axis mapping values; The union of the multiple forbidden layout subspaces corresponding to the multiple convex polygons is used as the forbidden layout space.
17. A typesetting processing device, characterized in that: The typesetting processing device is used for mixed typesetting of graphics and texts, and the typesetting processing device includes: An acquisition unit, used for acquiring a polygonal figure to be typeset and a line space for typeset the text, wherein the line space is defined by parallel lines and the polygonal figure to be typeset includes a plurality of vertices; A first determining unit is used to determine a target intersection point between the polygonal figure to be typeset and the parallel line if it is determined that the surrounding format of the text surrounding the polygonal figure to be typeset is a target format; A second determining unit, configured to determine a prohibited typesetting space based on the target intersection point and a target vertex located in the row space among the plurality of vertices; The typesetting unit is used to typeset the text in a portion of the line space outside the prohibited typesetting space.
18. An electronic device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the typesetting processing method according to any one of claims 1 to 16 is implemented.
19. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the typesetting processing method according to any one of claims 1 to 16 is implemented.
20. A computer program product, comprising a computer program, wherein the computer program is read and executed by a processor of a computer device, so that the computer device executes the typesetting processing method according to any one of claims 1 to 16.