Background
In the field of information publishing and commercial printing, there is a type of publication which has a considerable specific gravity, namely, a large number of publications of the same type (or similar type) but different contents, such as commercial posters in supermarkets, second-hand house posters, a large number of business cards/signs, performance tickets and the like, and is characterized in that the contents of the publication are very large, the whole is composed of one or more pages, each page is composed of a plurality of small areas, and the pattern layout of each small area is substantially the same or similar, but the contents are different, so that the large number of information publications is formed.
Along with the development of the field of pre-press manufacturing, typesetting software develops rapidly, the interactive type-setting function is also more and more perfect, and complex image-text type-setting work can be easily realized. However, if the publication of the above type relies on manual typesetting, even if the mode of copy/paste/re-modification is adopted, a lot of manpower and material resources are still consumed in manufacturing, the efficiency is low, the real-time performance is poor, and the mistakes are easy to occur.
Based on the above publishing requirements, the prior art has realized the typesetting by means of templates, that is, templates are manufactured in advance, the sizes, the layout, the common base map, the scribing lines, the graphics, the text patterns, the labels of replaceable objects and the like of small areas are all set in the templates, the manufactured templates are well arranged on the whole layout in a copying manner, and finally, the real layout objects are generated in a data filling and data replacing and internal automatic adjustment manner for the template objects on the layout, so that the whole typesetting manufacturing is completed.
The existing automatic template assembling mode solves the problem of partial template assembling efficiency, but has the following defects:
1) When the templates are used for automatic plate assembly, the positions and the number of the templates are required to be determined in advance by a producer, although the typesetting areas of the whole pages can be calculated in advance by means of other tools, the templates are placed in advance after normalized segmentation, and the total number of the pages and the total number of the templates placed are predetermined according to the number of actual data, the method is only suitable for normalized rectangular areas and templates with the same size.
2) When the template is placed in advance for assembly, adjustment is difficult after assembly is completed. If the typesetting data items are increased or decreased or the arrangement order is changed, the existing typesetting results can only be completely overturned, and all rearrangements can be completely regenerated, so that all post-modification and adjustment works which are done on the layout before are scrapped.
Disclosure of Invention
In view of this, the embodiments of the present invention provide an automatic typesetting system and method for graphics context, a server, and a medium, so that the system and method can quickly complete the preparation and typesetting of a large amount of data with different contents in the same layout style or similar layout styles.
In a first aspect of the embodiment of the present invention, an automatic typesetting method for graphics and text is provided, where the automatic typesetting method for graphics and text includes the following contents:
prefabricating templates containing layout and patterns, and setting typesetting rules;
appointing the corresponding relation between the content to be typeset and the templates, copying the templates according to the templates appointed by each piece of data to generate template objects;
converting the template object into pseudo words, linking the pseudo words in sequence, and setting corresponding word attributes to form a pseudo word stream;
and the pseudo-text stream is delivered to a typesetting engine, and the typesetting engine automatically arranges the pseudo-text stream on a designated area according to a preset typesetting rule according to the typesetting mode of the text.
In a second aspect of the embodiment of the present invention, an automatic graphic typesetting system is provided, where the automatic graphic typesetting system includes the following functional modules:
the template prefabricating module is configured to prefabricate templates containing layout and patterns and set typesetting rules;
the template generating module is configured to designate the corresponding relation between the content to be typeset and the template, and copy the template to generate a template object according to the template designated by each piece of data;
the template disguising module is configured to convert the template object into pseudo words, link the pseudo words in order and set corresponding word attributes to form a pseudo word stream;
and the automatic typesetting module is configured to deliver the pseudo text stream to the typesetting engine, and the typesetting engine automatically arranges the pseudo text stream on the designated area according to the typesetting mode of the text and the established typesetting rule.
In a third aspect of the embodiment of the present invention, a server is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor implements the steps of the automatic layout method for graphics and text as described above when executing the computer program.
In a fourth aspect of the embodiments of the present invention, there is provided a computer readable storage medium storing a computer program which, when executed by a processor, implements the steps of the automatic layout method for images and texts as described above.
The invention provides an automatic typesetting method and system for pictures and texts, a server and a medium, wherein a template object is camouflaged into a text through a shell device for camouflaging the text, a large number of template objects are camouflaged into a text stream, and typesetting of a large number of template objects is rapidly completed by fully utilizing typesetting processing capacity of the existing text typesetting engine for the text; meanwhile, the processing capacity of the text typesetting engine on the complex typesetting area is utilized, so that typesetting of a large number of template objects can be performed on the complex area without manual placement adjustment in advance, and pages can be automatically expanded or reduced according to the actual data amount typesetting requirement; the typesetting method can be used for rapidly completing the production and typesetting of a large amount of data with different contents in the same layout style or similar layout styles, the layout produced by the typesetting method has the editing capability of characters and the function of copying/pasting/deleting/adjusting sequence of camouflage characters (template objects), and the typesetting engine can automatically and locally rearrange after adjustment.
Detailed Description
In order to make the objects, features and advantages of the present invention more comprehensible, the technical solutions in the embodiments of the present invention are described in detail below with reference to the accompanying drawings, and it is apparent that the embodiments described below are only some embodiments of the present invention, but not all embodiments of the present invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
As shown in fig. 1, the embodiment of the invention provides an automatic typesetting method for graphics and texts, which includes the following steps:
s1, prefabricating templates containing layout and patterns, and setting typesetting rules.
The method comprises the steps of setting a template, wherein pictures, graphs and characters which are common in the template are preset, the replaceable content is prefabricated in a label object mode, and the relative positions and the dependence relations among the objects are preset.
S2, appointing the corresponding relation between the content to be typeset and the templates, and copying the templates according to the templates appointed by each piece of data to generate template objects.
The template can be designated for each piece of data independently or in batches, and the mapping replacement rule of the formatted label and the content data field in the template is designated at the same time, and the label object in the template object is replaced according to the designated mapping rule to generate the template object of the real content.
S3, converting the template object into pseudo words, linking the pseudo words in sequence, and setting corresponding word attributes to form a pseudo word stream.
A camouflage character shell is generated for each template object, the template object is placed in the camouflage shell to form a camouflage large character, the shell is responsible for providing standard character attribute information about the width and the height of the camouflage character to a typesetting engine, for example, the width and the height of the provided character are the width and the height of a template object entity, the alignment mode adopts the alignment mode of full-angle characters, and the inter-row characters and the like also adopt the inter-row characters of the set full-angle characters.
S4, the pseudo-text stream is delivered to a typesetting engine, and the typesetting engine automatically arranges the pseudo-text stream on a designated area according to a preset typesetting rule according to a typesetting mode of the text.
Specifically, after camouflage processing is carried out, a template object entity is changed into a camouflage large character, the large characters are sequentially linked to form a character stream, the character stream is delivered to a typesetting engine, a designated area is provided for the typesetting engine, a typesetting area is created according to the typesetting mode of the characters, for example, a picture is embedded in the middle of the designated area, and the areas on two sides of the picture need to be separated into the areas; the typesetting engine starts arranging the large-size camouflage characters from a designated area according to the normal character typesetting processing process, when arranging the camouflage characters to a certain camouflage character, the typesetting engine informs the camouflage character of providing own size information, so that the camouflage character automatically replaces labels in a template with designated contents to be typeset according to a mapping rule, after the internal arrangement is finished, the overall size and attribute information are provided for the typesetting engine, the typesetting engine calculates the template object according to the obtained size and attribute like the characters to be typeset, the position and the occupation size of the template object in a typesetting area are determined, the next camouflage character is typeset in the same way, when the existing area is used, new pages can be automatically added at the end according to the rule and are continuously arranged until all the camouflage characters are completely arranged, and the typesetting is the same as the common character typesetting; finally, the positions of the template entity objects displayed on the page are the positions discharged by the typesetting engine, so that the typesetting of the whole content is completed rapidly.
The template objects are disguised to form a text stream, the operation processing of common characters is suitable for the disguised characters after typesetting the text stream, the sequence of selecting, deleting, copying/pasting and adjusting the template objects can be selected, the content in the template objects can be directly edited, after each adjustment, the typesetting engine can also locally rearrange the template objects according to the rule of the text change, calculate new positions and occupation positions, and the final processing can be completed by repeating the readjustment process.
The invention provides an automatic typesetting method for pictures and texts, which not only can realize the replacement of contents and data as the original template, but also can automatically generate template objects according to the items of the data and automatically discharge the template objects onto pages without arranging the template objects on the layout in advance and arranging the template objects at good positions, even if a page typesetting area is not a regular rectangular area, the automatic typesetting method can automatically adapt to the shape of the area and discharge the page objects, and can automatically expand or reduce the page numbers according to typesetting space required by an entity of the template objects which is actually discharged until all the page objects are discharged.
After the template objects are automatically arranged in the layout, the sequence of the template objects can be directly deleted or adjusted or the content of the template objects can be directly modified on the layout.
The novel template and the corresponding typesetting method can solve the problem of rapid typesetting generation of large quantities of data in the same style (or similar style) on the page, solve the problem of typesetting on irregular layouts, and simultaneously support the problem of rapid rearrangement after subsequent adjustment and processing on the layouts, thereby bringing great efficiency improvement.
It should be understood that the sequence number of each step in the foregoing embodiment does not mean that the execution sequence of each process should be determined by the function and the internal logic, and should not limit the implementation process of the embodiment of the present invention.
The above mainly describes an automatic typesetting method for graphics and text, and a detailed description will be given below of an automatic typesetting system for graphics and text.
Fig. 2 shows a functional block diagram of an automatic typesetting system for graphics and text according to an embodiment of the present invention. As shown in fig. 2, the automatic typesetting system for graphics and text comprises the following functional modules:
a template prefabrication module 10 configured to prefabricate templates including layouts and styles and set typesetting rules;
the template generating module 20 is configured to designate a corresponding relation between the content to be typeset and the template, and copy the template to generate a template object according to the template designated by each piece of data;
the template disguising module 30 is configured to convert the template object into pseudo words, link the pseudo words in order and set corresponding word attributes to form a pseudo word stream;
the automatic typesetting module 40 is configured to deliver the pseudo text stream to the typesetting engine, and the typesetting engine automatically arranges the pseudo text stream on the designated area according to the typesetting mode of the text and the predetermined typesetting rule.
Fig. 3 is a schematic diagram of an automatic typesetting server structure for graphics and text according to an embodiment of the present invention. The server is a device for providing a computing service, generally referred to as a computer having a high computing power and provided to a plurality of users through a network. As shown in fig. 3, the server 5 of this embodiment includes: a memory 51, a processor 52 and a system bus 53, the memory 51 including an executable program 511 stored thereon, it will be understood by those skilled in the art that the terminal device structure shown in fig. 3 is not limiting of the terminal device and may include more or less components than illustrated, or may combine some components, or a different arrangement of components.
The following describes the respective constituent elements of the terminal device in detail with reference to fig. 3:
the memory 51 may be used to store software programs and modules, and the processor 52 performs various functional applications of the terminal and data processing by running the software programs and modules stored in the memory 51. The memory 51 may mainly include a storage program area that may store an operating system, application programs required for at least one function (such as a sound playing function, an image playing function, etc.), and a storage data area; the storage data area may store data (such as audio data, phonebook, etc.) created according to the use of the terminal, etc. In addition, memory 51 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid-state storage device.
An executable program 511 comprising a text automatic typesetting method on a memory 51, the executable program 511 may be divided into one or more modules/units, which are stored in the memory 51 and executed by a processor 52 to complete the delivery of notifications and obtain notification implementation procedures, and the one or more modules/units may be a series of computer program instruction segments capable of performing specific functions, which instruction segments describe the execution procedure of the computer program 511 in the server 5. For example, the computer program 511 may be divided into an acquisition module, a comparison module, a splicing module, and a transmission module.
The processor 52 is a control center of the server, connects respective parts of the entire terminal device using various interfaces and lines, and performs various functions of the terminal and processes data by running or executing software programs and/or modules stored in the memory 51, and calling data stored in the memory 51, thereby performing overall monitoring of the terminal. Optionally, the processor 52 may include one or more processing units; preferably, the processor 52 may integrate an application processor that primarily handles operating systems, applications, etc., with a modem processor that primarily handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into the processor 52.
The system bus 53 is used to connect various functional components inside the computer, and can transfer data information, address information, and control information, and the types of the system bus may be, for example, a PCI bus, an ISA bus, and a VESA bus. Instructions of the processor 52 are transferred to the memory 51 through the bus, the memory 51 feeds back data to the processor 52, and the system bus 53 is responsible for data and instruction interaction between the processor 52 and the memory 51. Of course, the system bus 53 may also have access to other devices, such as a network interface, a display device, etc.
The server should at least include a CPU, a chipset, a memory, a disk system, etc., and other components will not be described herein.
In the embodiment of the present invention, the executable program executed by the processor 52 included in the terminal is specifically: an automatic typesetting method for graphics and texts comprises the following steps:
prefabricating templates containing layout and patterns, and setting typesetting rules;
appointing the corresponding relation between the content to be typeset and the templates, copying the templates according to the templates appointed by each piece of data to generate template objects;
converting the template object into pseudo words, linking the pseudo words in sequence, and setting corresponding word attributes to form a pseudo word stream;
and the pseudo-text stream is delivered to a typesetting engine, and the typesetting engine automatically arranges the pseudo-text stream on a designated area according to a preset typesetting rule according to the typesetting mode of the text.
It will be clear to those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described systems, apparatuses and units may refer to corresponding procedures in the foregoing method embodiments, which are not repeated herein.
In the foregoing embodiments, the descriptions of the embodiments are emphasized, and in part, not described or illustrated in any particular embodiment, reference is made to the related descriptions of other embodiments.
Those of ordinary skill in the art will appreciate that the modules, units, and/or method steps of the various embodiments described in connection with the embodiments disclosed herein can be implemented as electronic hardware, or as a combination of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
The above embodiments are only for illustrating the technical solution of the present invention, and not for limiting the same; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention.