CN113255289A - Method and system for composing and distributing file - Google Patents
Method and system for composing and distributing file Download PDFInfo
- Publication number
- CN113255289A CN113255289A CN202110530196.5A CN202110530196A CN113255289A CN 113255289 A CN113255289 A CN 113255289A CN 202110530196 A CN202110530196 A CN 202110530196A CN 113255289 A CN113255289 A CN 113255289A
- Authority
- CN
- China
- Prior art keywords
- layout
- text
- template
- file
- line
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/10—Text processing
- G06F40/103—Formatting, i.e. changing of presentation of documents
- G06F40/106—Display of layout of documents; Previewing
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/10—Text processing
- G06F40/103—Formatting, i.e. changing of presentation of documents
- G06F40/109—Font handling; Temporal or kinetic typography
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/10—Text processing
- G06F40/166—Editing, e.g. inserting or deleting
- G06F40/186—Templates
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Health & Medical Sciences (AREA)
- Artificial Intelligence (AREA)
- Audiology, Speech & Language Pathology (AREA)
- Computational Linguistics (AREA)
- General Health & Medical Sciences (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Document Processing Apparatus (AREA)
- Processing Or Creating Images (AREA)
Abstract
The application relates to a method and a system for document typesetting layout. The method comprises the following steps: constructing a template library, wherein the template library comprises a plurality of pattern layout templates; receiving the file information input by a user, traversing file layout templates in a template library according to the file information, and screening an optimal file layout template; adjusting the optimal document layout template according to the document information, extracting the layout style of the optimal document layout template, and transferring the layout style to the layout area of the user; and determining the coordinate position of the document information in the layout area, and outputting the typesetting result. The method is applied to the intelligent synthesized Banner map, and the richness of the output Banner map is improved. The method has strong portability and can be expanded to the typesetting of the documents under different business scenes.
Description
Technical Field
The application relates to the technical field of artificial intelligence design, in particular to a method and a system for composing and arranging a document, and particularly relates to a document composing and arranging layout in an intelligent synthesis electronic commerce banner (banner advertisement) picture.
Background
With the advent of the artificial intelligence era, artificial intelligence and design are combined into a new application field, and most representative is automatic generation of various banner maps, posters and the like. Every time a large promotion node is reached, the design requirements of each large power provider platform on the advertisement drawing are increased sharply. The prior art manual design requires a lot of labor and cost. The Banner graph generated by the intelligent design of the machine is applied to e-commerce projects, the quantity requirement is met, the investment of human resources is greatly reduced, and even real-time and flexible personalized recommendation can be achieved. In many links of artificial intelligence generation of the banner graph, automatic document layout is one of the difficulties. The text description can effectively convey information and attract the attention of a user, and the typesetting layout of the text description influences the overall effect of the banner.
In the banner diagram, a complete text typesetting requires four items to be determined: (1) the alignment mode is suitable for left alignment or center alignment under most conditions; (2) the contrast between the main and sub titles and the description title, the size contrast, the color contrast, the font contrast, etc.; (3) the line spacing and the space are set, and the line spacing and the space are a key ring in character typesetting, so that the final typesetting effect is determined; (4) the character modification layer can improve the overall visual effect of the document layout.
The method is characterized in that the method comprises the steps of automatically synthesizing Banner effect graphs by some current intelligent design platforms, analyzing the effect graphs, and obtaining the Banner effect graphs. The pattern layout style of the template is fixed, so that the pattern typesetting modes of a large number of banner drawings expanded based on the template are the same, and various choices cannot be provided for users.
Disclosure of Invention
In order to solve the above problems, the invention provides an advertisement pattern and text typesetting method based on a template library, comprising the following steps:
a method for composing and laying out a pattern, which comprises the following steps:
constructing a template library, wherein the template library comprises a plurality of pattern layout templates;
receiving the file information input by a user, traversing file layout templates in a template library according to the file information, and screening an optimal file layout template;
adjusting the optimal document layout template according to the document information, extracting the layout style of the optimal document layout template, and transferring the layout style to the layout area of the user;
and determining the coordinate position of the document information in the layout area, and outputting the typesetting result.
In one embodiment, a file layout template is collected through a preset collection dimension to form a database, wherein the preset collection dimension at least comprises file line number and aspect ratio;
the optimal document layout template screening method comprises the following steps:
extracting the file line number and the aspect ratio of the file information;
traversing the pattern layout template, and respectively comparing the pattern line number and the aspect ratio of the pattern layout template and the pattern line number and the aspect ratio of the pattern information;
and determining an optimal pattern layout template.
In one embodiment, the document comprises at least one line, each line of the document comprising a text and/or a finishing layer;
extracting the layout style of the optimal document layout template, and adjusting the layout style according to the user document information, wherein the method comprises the following steps:
analyzing the file information and the file layout template respectively, and determining whether each line of files comprises a modification layer;
adjusting each line of the file layout template according to the file information and the cover layer information, and reserving a modification layer or deleting the modification layer;
keeping the line spacing between the lines of the file layout template unchanged, and updating the coordinates of the text and the modification layer in sequence;
and calculating the maximum width of the text box in each line of text, and then adjusting the width of the text box of each line of text to the maximum value.
In one embodiment, migrating the layout style to a layout region of a user includes:
determining position coordinates of the layout area;
calculating coordinates of the layout style in the layout area;
and completing the migration of the text and the decoration layer of the layout style.
In one embodiment, determining the coordinate position of the paperwork information within the layout area comprises:
acquiring a text, a text box position and a font corresponding to each line of the document and a preset word height threshold value of the line according to the document information and the layout style;
rendering the text in the text box by using the initialized font size, and calculating the font height of the text by updating the font size until the text just fills the text box;
comparing the sizes of the word height and the preset word height threshold, and if the word height is not less than the preset word height threshold, calculating the rendering state of the text; if the word height is smaller than the preset word height threshold value, the preset word height threshold value is used as a word number, and the rendering state of the text is calculated;
and outputting the pre-rendering state of each line of the file.
In one embodiment, fine-tuning text according to the pre-rendering state of each line of text includes:
analyzing the pre-rendering state of each line of the file;
screening out the case with the word height of the text larger than a preset word height threshold value;
judging whether a case with a character height larger than the height of the text box exists;
if the text exists, adjusting the case that the word height of the text is larger than the preset word height threshold value, and reducing the word number of the case;
and adjusting the line spacing between the file patterns of each line.
In one embodiment, in the layout area, the coordinate positions of each line of text and the modification layer are calculated according to the size of the rendered text of each pattern, and the typesetting result is output.
A system for composing a layout of a document, the system comprising:
the template library module is used for constructing a template library, and the template library comprises a plurality of pattern layout templates;
the screening module is used for receiving the file information input by the user, traversing the file layout template of the template library according to the file information and screening the optimal file layout template;
the migration module is used for matching the document information according to the optimal document layout template, extracting the layout style of the optimal document layout template and migrating the layout style to the layout area of the user;
and the output module is used for determining the coordinate position of the file information in the layout area and outputting the typesetting result.
In one embodiment, the migration module further comprises a fine-tuning unit and a migration layout style unit,
the fine-tuning unit is used for adjusting each line of the file layout template, and reserving a modification layer or deleting the modification layer;
the transfer layout style unit is used for transferring the layout style of the optimal pattern layout template processed by the fine tuning unit to the layout area of the user.
In one embodiment, the output module further comprises a pre-rendering unit and an updating unit,
the pre-rendering unit is used for calculating the word size and the size of the rendered text when the text box is filled with the text, and obtaining the pre-rendering state of the file;
and the updating unit is used for updating the font size and the line spacing of each file according to the pre-rendering state.
The method and the system for typesetting and layout of the document ensure the size contrast and the line spacing between different types of titles by using the layout style of the template based on the template library. The method is applied to the intelligent synthesized Banner map, and the richness of the output Banner map is improved. The method has strong portability and can be expanded to the typesetting of the documents under different business scenes.
Drawings
FIG. 1 is a schematic diagram illustrating steps of a method for typesetting and layout of a document according to an embodiment;
FIG. 2 is a schematic diagram illustrating an overall process of a method for composing and laying out a document layout according to an embodiment;
FIG. 3 is a schematic diagram illustrating a fine-tuning process of a method for composing and laying out a pattern in an embodiment;
FIG. 4 is a schematic diagram illustrating a pre-rendering process of a method for layout of a document layout according to an embodiment;
FIG. 5 is a block diagram of a document layout system according to an embodiment;
FIG. 6 is a diagram illustrating an internal structure of a computer device according to an embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
The method for the document typesetting layout comprises the steps of firstly constructing a template library containing various document layout styles, selecting a template according to designed screening conditions, then arranging a text typesetting mode by referring to the original form of the template, and finally realizing the diversification of the typesetting styles according to the difference of the selected templates. The method is applied to an intelligent synthesis e-commerce banner graph, and according to the content of the document input by a user and the designated layout area, the method can design various document typesetting styles in the current layout area under the condition of no manual intervention, overcomes the defect that the layout form of the document in the same template in the current intelligent synthesis banner system is single, and supports the user to set whether a position is reserved for a document modification layer or not, thereby improving the visual effect of the whole layout.
In one embodiment, as shown in fig. 1-4, the method comprises the following steps:
s100, a template library is constructed, and the template library comprises a plurality of pattern layout templates.
In the present embodiment, for a business scenario of an application, the dimension of the scenario layout change in this scenario is analyzed. And collecting the pattern layout template by taking all the dimensions covered as the standard, wherein the dimensions comprise the pattern row number, the pattern region aspect ratio, the word number of the main pattern and the like. The collected templates have clearly distinguished title types, and the titles are matched with the modification layers one by one. The template can be stored in a PSD format, so that the position information of each layer can be conveniently read. And extracting information required by the typesetting layout by the parsing template, and storing the parsed information in a JSON file format.
Specifically, according to the file layout characteristics of the E-commerce banner image and the file input format of the current intelligent synthesis banner image, file layout templates in a PSD format are collected in two dimensions of file line number title _ number and aspect ratio aspect _ ratio of a file layout area. Preferably, for the case, the title of the case is divided into a main title, a sub-title and an action word according to the level, and the modification layer corresponds to the title type one by one, wherein the text layout area is a minimum rectangular frame containing all the titles and the modification layer. And analyzing each template to extract required analysis information, including character layout area coordinates, the coordinates of the title and the modification layer, line spacing, title sequence and the like. The parsing information implicitly expresses a document layout style, and is stored in a JSON format.
S200, receiving the file information input by the user, traversing the file layout template of the template base according to the file information, and screening the optimal file layout template.
In this embodiment, the pattern layout characteristics of the application scene are combined, the pattern information input by the user is received, the pattern information includes design screening conditions, all the pattern layout templates in the template library constructed in step S100 are traversed by analyzing the pattern layout characteristics of the application scene and the pattern information design screening conditions input by the user, and the pattern layout template meeting the conditions is screened out from the design screening conditions to serve as the optimal pattern layout template.
Specifically, in conjunction with the template screening dimension of step S100,
and extracting the title number of the file lines of the file information and the aspect ratio of the file layout area, traversing all templates in the template library by taking the two dimensions as design screening conditions, and screening the templates meeting the conditions. Preferably, the file line number title _ number and the aspect ratio aspect _ ratio of the file layout template and the file line number title _ number and the aspect ratio aspect _ ratio of the file information are respectively compared, and only if the template and the file line number title _ number of the user are equal and the difference between the aspect ratios aspect _ ratio of the two is within a range of ± 0.3, the template is determined to be a proper template, namely the best file layout template.
S300, adjusting the optimal document layout template according to the document information, extracting the layout style of the optimal document layout template, and transferring the layout style to the layout area of the user.
In this embodiment, after the optimal pattern layout template is determined in step S200, the optimal pattern layout template is modified according to the information input by the user to match the template with the input information, and then the pattern layout pattern is migrated to the layout area set by the user by learning the pattern layout pattern of the template, that is, the height ratio of each layer in the entire pattern area, and keeping the height ratio unchanged.
Specifically, step S300 further includes a fine-tuning step and a layout style migration step.
For the fine tuning step, the case includes at least one line of titles, each line of the case includes text, and some lines further include a modification layer. However, in the intelligent composite banner map, the modification layer that the user requires matching of each title does not necessarily correspond to the modification layer existing in the template, for example, the user requires that each title has no modification layer or that only subtitles and action words have modification layers, so the selected optimal pattern layout template needs to be finely adjusted according to the pattern information input by the user, and the position of the modification layer is reserved in the row corresponding to the template or the modification layer in the template is deleted.
Specifically, the document information and the document layout template are respectively analyzed, and whether each line of the document comprises a modification layer is determined. And then adjusting each line of the file layout template according to the file information, and adding a modification layer or deleting the modification layer. Preferably, under a template reference system, calculating coordinates of an added modification layer or deleting a modification layer matched with a certain line of titles according to a set size rule, wherein the size rule of the added modification layer is as follows;
ornament_height=int(1.6×title_height);
ornament_width=title_width+3×title_height;
wherein, the authority _ height is the height of the modification layer, the authority _ width is the width of the modification layer, the title _ width is the width of the title, and the title _ height is the height of the title.
Since the modification layer is wrapped with the title, deleting or adding the modification layer changes the line spacing between the modification layer and the upper and lower line titles. In order to keep the line distance row _ spacing [ s1, s2, s3, ] between each line of the template unchanged, in the pattern layout region text _ region _ template [ [ left, top, right, bottom ] ] of the template, the coordinates of the title [ [ tx1, ty1, tx2, ty2] and the modified layer organization [ [ x1, y1, x2, y2] are updated in sequence according to the order of the titles in the template, and the original layout pattern is restored. And simultaneously calculating the maximum value of the text box of each title, and then adjusting the width of the text box of each title to the maximum value. And finally, obtaining the layout style of the adjusted optimal pattern layout template. The specific adjustment process is as follows:
for the layout style migration step, the core is to learn the height and width ratio of the layout style of the template, i.e. the title, in the template. Determining the position coordinates of the layout region, i.e. text _ region _ in of the document layout region inputted by the user [ st _ x, st _ y, end _ x, end _ y ], and text _ region _ template of the document layout region of the template [ left, top, right, bottom ], by the following formula:
resize_w=(end_x-st_x)/(right-left)
resize_h=(end_y-st_y)/(bottom-top)
x1-left,y1-=top,x2-left,y2-=top
new_x1=max(int(round(x1*resize_w+st_x)),st_x)
new_x2=min(int(round(x2*resize_w+st_x)),end_x)
new_y1=max(int(round(y1*resize_h+st_y)),st_y)
new_y2=min(int(round(y2*resize_h+st_y)),end_y)
new_box=[new_x1,new_y1,new_x2,new_y2]
and (3) migrating the layout style in the template, namely the coordinates box of the title and the modification layer [ x1, y1, x2 and y2] to a text-layout region text _ region _ in input by a user, and calculating to obtain the new coordinates new _ b of the new title and the modification layer, thereby completing the migration of the layout style. The line space of the template is shifted by row _ spacing ═ int (round (s _ i × resize _ h)) ], wherein i ═ 1: title _ number + 1.
S400, determining the coordinate position of the file information in the layout area, and outputting the typesetting result.
In this embodiment, the position of each title or modifier layer within the new layout area and the target line spacing are calculated, per step 300. Next, it is necessary to render the corresponding input caption in each text box, calculate the font size of each caption and the size of the real rendered text, and finally output the layout result.
In one embodiment, step S400 includes a pre-rendering step and an update adjustment step.
S410, a pre-rendering step.
Through step S300, each layer maintains the height ratio of the original template in the layout area set by the user. However, when the height of the layout area of the template is greatly different from the height of the layout area set by the user, the text box calculated according to the proportion in the template is small, so that rendered characters are small, a high character threshold value is set, and the problem of small characters is solved. And in the pre-rendering module, selecting a font, rendering according to the font, and calculating the maximum font size of each title in the text box and the size of the rendered text. And when the height of the rendered text is smaller than a preset threshold value, performing pre-rendering according to the threshold value, and recording the rendering state of each line of titles.
Specifically, according to the document information and the layout style, the text, the position of the text box, the font corresponding to each line of the document and the preset word height threshold of the line are obtained.
And rendering the text in the text box by using the initialized font size, and calculating the font height of the text by iterating the font size until the text just fills the text box.
Comparing the sizes of the word height and the preset word height threshold, and if the word height is not less than the preset word height threshold, calculating the rendering state of the text. And if the word height is smaller than the preset word height threshold value, using the preset word height threshold value as the word number, and calculating the rendering state of the text.
And outputting the pre-rendering state of each line of the file.
In an embodiment, as shown in fig. 4, in the pre-rendering process, in the horizontal mode, when the height of the layout area of the template is greater than the actual height of the layout area set and input by the user, a situation that the text box is smaller after the layout style migration occurs, and thus the font of the row of titles is smaller. A word height threshold th _ threshold, { title _ name _ i: threshold _ i }, where i ═ 1: title _ number, is set for each type of title, indicating the minimum word height that each line of titles must reach under the current layout range. For font selection, it can be set or randomly selected in combination with specific business scenario requirements. Wherein the identifiers vert _ filled and hori _ filled indicate whether the limit state has been reached in the horizontal direction and the vertical direction of the text in the text box. updated _ small indicates that rendering using the threshold thresh as the font size results in text exceeding the text box. is _ grease represents whether the height of the rendered text is greater than a threshold thresh. Preferably, the minimum value of the height and the width of the text box divided by the number of words is used as an initialization word size, the word size of the text box just filled with words and the size [ tw, th ] of the rendered text are calculated by an iterative method, the identifiers vert _ filed and hori _ filed are updated at the same time, and the pre-rendering state of each line title, that is, the value of each identifier of each line is recorded.
And S420, updating the adjusting step.
When pre-rendering titles, titles of different word counts may fill the text box vertically, or fill the text box horizontally. Compared with the original template, the horizontal filling of the text box leads to the increase of the upper and lower line spaces, and if the text box is pre-rendered according to the threshold value, the line space is reduced. Both of these conditions affect the typesetting effect, so the new calculation of font size and line spacing is required to improve the typesetting effect.
Specifically, the pre-rendering state of each line of the document is parsed.
Screening out the case with the character height of the text being larger than the preset character height threshold value, judging whether the case with the character height being larger than the text box height exists, if so, adjusting the case with the character height of the text being larger than the preset character height threshold value, reducing the character size of the case, and adjusting the line spacing between the cases in each line.
In one embodiment, according to step S410, the pre-rendering status of each line title is recorded, and when updated _ small is True, it indicates that the height of the title exceeds the text box, which results in line space reduction and even overlap with other titles. Since the input layout space is fixed, the title word size of is _ grease being True can only be reduced.
S421, setting a minimum line spacing sum threshold value min _ space _ ratio, and reserving a certain line spacing; calculating a remaining Height ratio free _ space _ ratio (Height-Height _ sum)/Height, where Height-end _ y-st _ y represents the Height of the input layout area, Height _ sum is the sum of the heights of all rendered texts,
s422, if free _ spa _ create is smaller than min _ spa _ tio, then the difference height ratio of need _ ratio _ min _ space _ ratio-free _ space _ ratio, and reduce the header with is _ grease as True to obtain the height of need _ ratio;
s423, cur _ textRatio indicates a high ratio of the title word with is _ grease being True, { title _ name _ i: cur _ ratio _ i }, i ═ 1: n, n ≦ title _ number; then the rate at which the word height per line needs to be reduced is need _ ratio _ mean ═ need _ ratio/n;
s424, prevent the word height after the title reduction from being less than the threshold ratio thresh _ ratio, calculate the ratio diff that each line of titles can be reduced:
thresh_ratio_i=th_threshold[title_name_i]/Height
diff_i=cur_textRatio[title_name_i]-thresh_ratio_i
Diff_set={title_name_i:diff_i}
i=1:n,n≤title_number
s425, calculating the new _ th _ thermoshold of the word height which needs to be reached after the title of each line is reduced by Diff _ set according to the Diff sequence from small to large:
s426, the new _ th _ threshold is used as the initial font size, the height of the corresponding text box is changed to the threshold size, and the new font size and the size of the title are obtained through re-prerendering. Calculating a new residual space height free _ space, and if the residual space is larger than the sum of the calculated target line distances during layout migration, keeping the target line distance row _ space unchanged; otherwise, calculating the new height of each line space according to the proportional relation of the target line spaces, and updating the target line spaces row _ spacing [ s _ i/(row _ spacing) × free _ space) ], wherein i is 1: title _ number + 1.
And S430, calculating coordinate positions, calculating the coordinate positions of each line of texts and the modification layer according to the sizes of the rendered texts of the texts in the layout area, and outputting the typesetting result.
Specifically, the font size and size of each line header and the size of the modification layer are determined by the prerendering step S410 and the update adjusting step S420. And calculating the coordinate positions of each line title and the modification layer in a layout range reference system set by a user.
It should be understood that, although the steps in the flowchart are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless otherwise indicated herein. Moreover, at least some of the steps in the figures may include multiple sub-steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of performing the sub-steps or stages is not necessarily sequential, but may be performed alternately or by turns with other steps or at least some of the sub-steps or stages of other steps.
In one embodiment, as shown in fig. 5, there is provided a document layout system applying the above method, including:
the template library module 100 is used for constructing a template library, and the template library comprises a plurality of pattern layout templates.
The screening module 200 is configured to receive the document information input by the user, traverse the document layout template of the template library according to the document information, and screen an optimal document layout template.
The migration module 300 is configured to match the document information according to the optimal document layout template, extract a layout style of the optimal document layout template, and migrate the layout style to the layout area of the user.
And the output module 400 is used for determining the coordinate position of the file information in the layout area and outputting the layout result.
In particular, the migration module 300 further includes a fine-tuning unit 310 and a migration layout style unit 320,
the fine tuning unit 310 is used for adjusting each line of the document layout template, and reserving the modification layer or deleting the modification layer.
The migration layout style unit 320 is configured to migrate the layout style of the optimal pattern layout template processed by the fine-tuning unit to the layout area of the user.
In particular, the output module 400 further includes a pre-rendering unit 410 and an updating unit 420,
the prerender 410 is configured to calculate the font size and the rendered text size when the text box is filled with text, and obtain the prerender state of the pattern.
The updating unit 420 is configured to update the font size and the line spacing of each document according to the pre-rendering status.
For the specific definition of the document layout system, reference may be made to the above definition of the document layout method, which is not described herein again. The various modules in the above-described system may be implemented in whole or in part by software, hardware, and combinations thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In one embodiment, a computer device is provided, which may be a data management server, and its internal structure diagram may be as shown in fig. 6. The computer device includes a processor, a memory, a network interface, and a database connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The network interface of the computer equipment is used for communicating with an external data source terminal through network connection so as to receive data uploaded by the data source terminal. The computer program is executed by a processor to implement the pattern layout method.
Those skilled in the art will appreciate that the architecture shown in fig. 6 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects may be applied, and that a particular computing device may include more or less components than those shown, or some components may be combined, or have a different arrangement of components.
In one embodiment, a computer device is provided, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned method when executing the computer program.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a non-volatile computer-readable storage medium, and can include the processes of the embodiments of the methods described above when executed. Any reference to memory, storage, database, or other medium used in the embodiments provided herein may include non-volatile and/or volatile memory, among others. Non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), Rambus Direct RAM (RDRAM), direct bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
The invention discloses a method and a system for composing and arranging a pattern, and provides a method for composing a pattern based on a template library. The method has strong portability and can be expanded to the typesetting of the patterns under different business scenes.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.
Claims (10)
1. A method for composing and laying out a document, the method comprising:
constructing a template library, wherein the template library comprises a plurality of pattern layout templates;
receiving the file information input by the user, traversing the file layout templates of the template library according to the file information, and screening an optimal file layout template;
extracting the layout style of the optimal document layout template, adjusting the layout style according to the document information, and transferring the layout style to the layout area of the user;
and determining the coordinate position of the file information in the layout area, and outputting a typesetting result.
2. The method of claim 1, wherein the database is formed by collecting pattern layout templates through a preset collection dimension, the preset collection dimension comprising at least a pattern line number and an aspect ratio;
the screening of the optimal document layout template comprises the following steps:
extracting the file line number and the aspect ratio of the file information;
traversing the pattern layout template, and respectively comparing the pattern line number and the aspect ratio of the pattern layout template and the pattern line number and the aspect ratio of the pattern information;
and determining the optimal pattern layout template.
3. The method of claim 1, wherein the document comprises at least one line, each line of the document comprising a text or a finishing layer;
the method for extracting the layout style of the optimal document layout template and adjusting the layout style according to the user document information comprises the following steps:
analyzing the file information and the file layout template respectively, and determining whether each line of files comprises a modification layer;
adjusting each line of the file layout template according to the file information and the cover layer information, and reserving a modification layer or deleting the modification layer;
keeping the line spacing between the lines of the file layout template unchanged, and updating the coordinates of the text and the modification layer in sequence;
and calculating the maximum width of the text box in each line of text, and adjusting the width of the text box in each line of text to the maximum value.
4. The method of claim 3, wherein said migrating the layout style to the layout area of the user comprises:
determining position coordinates of the layout area;
calculating coordinates of the layout style in the layout area;
and completing the migration of the text and the modification layer of the layout style.
5. The method of claim 4, wherein said determining a coordinate location of said document information within said layout area comprises
Acquiring a text, a text box position and a font corresponding to each line of the document and a preset character height threshold value of the line according to the document information and the layout style;
rendering the text in the text box by using the initial word size, and calculating the word height of the text by iterating the word size until the text fills the text box;
comparing the sizes of the word height and a preset word height threshold, and if the word height is not less than the preset word height threshold, calculating the rendering state of the text; if the word height is smaller than a preset word height threshold value, using the preset word height threshold value as a word size, and calculating the rendering state of the text;
and outputting the pre-rendering state of each line of the file.
6. The method of claim 5, wherein fine-tuning text according to the pre-rendering state of the each line of text comprises:
analyzing the pre-rendering state of each line of the file;
screening out the case with the word height of the text larger than a preset word height threshold value;
judging whether a case with a character height larger than the height of the text box exists;
if yes, adjusting the case of which the word height of the text is larger than a preset word height threshold value, and reducing the word size of the case;
and adjusting the line spacing between the file patterns of each line.
7. The method according to claim 6, wherein in the layout area, the coordinate positions of each line of text and the modification layer are calculated according to the size of the rendered text of each pattern, and the typesetting result is output.
8. A system for composing and laying out a document, the system comprising:
the template library module is used for constructing a template library, and the template library comprises a plurality of pattern layout templates;
the screening module is used for receiving the file information input by the user, traversing the file layout template of the template library according to the file information and screening the optimal file layout template;
the migration module is used for matching the document information according to the optimal document layout template, extracting the layout style of the optimal document layout template and migrating the layout style to the layout area of the user;
and the output module is used for determining the coordinate position of the file information in the layout area and outputting the typesetting result.
9. The system of claim 8, wherein the migration module further comprises a fine-tuning unit and a migration layout style unit,
the fine tuning unit is used for adjusting each line of the file layout template, and reserving a modification layer or deleting the modification layer;
the transfer layout style unit is used for transferring the layout style of the optimal pattern layout template processed by the fine tuning unit to the layout area of the user.
10. The system of claim 8, wherein the output module further comprises a pre-rendering unit and an update unit,
the pre-rendering unit is used for calculating the word size and the size of the rendered text when the text box is filled with the text, and obtaining the pre-rendering state of the pattern;
and the updating unit is used for updating the size and the line spacing of each file according to the pre-rendering state.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110530196.5A CN113255289A (en) | 2021-05-14 | 2021-05-14 | Method and system for composing and distributing file |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110530196.5A CN113255289A (en) | 2021-05-14 | 2021-05-14 | Method and system for composing and distributing file |
Publications (1)
Publication Number | Publication Date |
---|---|
CN113255289A true CN113255289A (en) | 2021-08-13 |
Family
ID=77182023
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110530196.5A Pending CN113255289A (en) | 2021-05-14 | 2021-05-14 | Method and system for composing and distributing file |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113255289A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115185429A (en) * | 2022-05-13 | 2022-10-14 | 北京达佳互联信息技术有限公司 | File processing method and device, electronic equipment and storage medium |
TWI809909B (en) * | 2022-06-01 | 2023-07-21 | 崑山科技大學 | A smart system for automatic poster designs and printing with its method |
-
2021
- 2021-05-14 CN CN202110530196.5A patent/CN113255289A/en active Pending
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115185429A (en) * | 2022-05-13 | 2022-10-14 | 北京达佳互联信息技术有限公司 | File processing method and device, electronic equipment and storage medium |
TWI809909B (en) * | 2022-06-01 | 2023-07-21 | 崑山科技大學 | A smart system for automatic poster designs and printing with its method |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110163640B (en) | Method for implanting advertisement in video and computer equipment | |
CN108228183B (en) | Front-end interface code generation method and device, electronic equipment and storage medium | |
CN109671126B (en) | Predicting block displacement maps using neural networks | |
JP4587832B2 (en) | Method and apparatus for organizing identified areas in image data | |
CN110780873B (en) | Interface color adaptation method, device, computer equipment and storage medium | |
JP4751047B2 (en) | How to place a set of objects in an area | |
US7088870B2 (en) | Image region filling by example-based tiling | |
CN110443140B (en) | Text positioning method, device, computer equipment and storage medium | |
CN112734641A (en) | Training method and device of target detection model, computer equipment and medium | |
CN113255289A (en) | Method and system for composing and distributing file | |
CN112733044B (en) | Recommended image processing method, apparatus, device and computer-readable storage medium | |
CN110428504B (en) | Text image synthesis method, apparatus, computer device and storage medium | |
CN113516666A (en) | Image cropping method and device, computer equipment and storage medium | |
CN111047508A (en) | Image processing method, image processing device, computer equipment and storage medium | |
CN114332895A (en) | Text image synthesis method, text image synthesis device, text image synthesis equipment, storage medium and program product | |
CN111857704A (en) | Code generation method and device for layout relationship | |
JP2022531638A (en) | Element rendering method, device, computer program and computer device | |
CN113159035B (en) | Image processing method, device, equipment and storage medium | |
CN115131803A (en) | Document word size identification method and device, computer equipment and storage medium | |
CN113936187A (en) | Text image synthesis method and device, storage medium and electronic equipment | |
CN108256611B (en) | Two-dimensional code image generation method and device, computing equipment and storage medium | |
JP4334981B2 (en) | Image processing apparatus and image processing method | |
CN113496225A (en) | Image processing method, image processing device, computer equipment and storage medium | |
CN113240765A (en) | Color matching method and device, computer equipment and storage medium | |
CN113744365B (en) | Text intelligent layout method, system and storage medium based on significance perception |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication |