Printing control method and electronic equipment

By building a hybrid font processing architecture on embedded devices and combining dot matrix and vector rendering technologies, the processing channel is intelligently selected according to the encoding and language type, which solves the problems of text display defects and resource consumption in multilingual environments of embedded devices, and realizes efficient and high-definition multilingual printing.

CN121807244APending Publication Date: 2026-04-07FUJIAN LANDI COMMERCIAL EQUIPMENT CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-30
Publication Date
2026-04-07

AI Technical Summary

Technical Problem

Existing embedded printing devices suffer from problems such as unclear text display, formatting errors, and unsatisfactory printing speed when processing multilingual texts. In particular, they cannot effectively handle complex texts such as Thai and Arabic, and full vector rendering leads to excessive resource consumption.

Method used

The printing control method adopts a hybrid architecture, combining dot matrix font processing channels and vector font processing channels. By parsing the encoding type and language type, it intelligently selects the processing channel. For complex characters, it uses vector fonts for shape planning and rendering, and for basic characters, it uses dot matrix fonts for high-speed printing, thus achieving resource allocation and efficient printing.

Benefits of technology

This invention enables efficient and high-quality printing of multiple languages ​​on resource-constrained embedded devices, resolving the conflict between complex text display abnormalities and system performance, and balancing printing speed and output quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121807244A_ABST
    Figure CN121807244A_ABST
Patent Text Reader

Abstract

The invention discloses a printing control method and electronic equipment. The method comprises the following steps: acquiring to-be-printed data; the coding type and the language type of the to-be-printed data are analyzed; selecting word stock processing channels based on the coding type and the language type, wherein the word stock processing channels comprise a dot matrix word stock processing channel and a vector word stock processing channel containing an integer rendering process; the to-be-printed data is converted into printing dot matrix data through the word stock processing channel; printing is completed based on the printing dot matrix data. According to the method, by establishing a dot matrix and vector mixed font library processing architecture and based on coding and language type intelligent routing, the problems of font deformation and stacking display of a complex language family are solved by utilizing a shaping rendering engine while high-speed printing of basic characters is guaranteed, and the balance of the printing speed and the output quality in a resource limited environment is realized.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of thermal printer, in particular to a printing control method and electronic equipment. BACKGROUND

[0002] With the global application of embedded printing equipment (such as POS machine, cash register), embedded printing equipment is widely used in the global range, and often needs to process printing tasks containing multiple languages.

[0003] However, the current printing has the problems of unclear display of part of the text, format error or unsatisfactory printing speed, which affects the user experience. SUMMARY

[0004] The technical problem solved by the present application is to provide a printing control method and electronic equipment, which can balance printing speed, multi-code compatibility and printing quality on resource-limited embedded devices.

[0005] In order to solve the above technical problems, one technical solution adopted by the present application is: A printing control method applied to an electronic equipment, comprising: obtaining to-be-printed data; analyzing the encoding type and language type of the to-be-printed data; selecting a font processing channel based on the encoding type and language type; the font processing channel includes a dot matrix font processing channel and a vector font processing channel; the vector font processing channel includes the processing of complex characters and the vector font processing channel includes an integer rendering process; converting the to-be-printed data into print dot matrix data through the font processing channel; completing printing based on the print dot matrix data.

[0006] In order to solve the above technical problems, another technical solution adopted by the present application is: An electronic equipment, comprising a memory, a processor and a computer program stored in the memory and running on the processor, wherein the processor implements each step of the above printing control method when executing the computer program.

[0007] The beneficial effects of the present application are that: by establishing a mixed architecture containing a dot matrix font library processing channel and a vector font library processing channel with an integer rendering process, intelligently selecting the processing channel based on the encoding type and language type of the to-be-printed data, for the Thai stacking, Arabic deformation and other defects that the traditional dot matrix lookup method cannot handle, using the vector font library processing channel containing the integer rendering process, by shape planning and binary rendering of complex characters, the correctness and integrity of complex language system output are ensured; at the same time, for the problem of excessive resource consumption caused by full vector rendering, by analyzing the encoding and language type for shunting, the dot matrix font channel is used to ensure the high-speed printing and neat layout of basic characters such as Chinese and Western characters. The efficient and high-quality printing of multiple language characters on resource-constrained embedded devices is realized, the contradiction between complex character display abnormalities and system running efficiency is solved, and the printing speed and output quality are considered. BRIEF DESCRIPTION OF DRAWINGS

[0008] Figure 1 A step flow chart of a printing control method provided by an embodiment of the present application is provided. Figure 2 A work flow chart of a printing control method provided by an embodiment of the present application is provided. Figure 3 A structural schematic diagram of an electronic device provided by an embodiment of the present application is provided. DETAILED DESCRIPTION

[0009] In order to make the technical problems, technical solutions and beneficial effects of the present application clearer, the present application will be further described in detail below in combination with the drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and not to limit the present application.

[0010] In the following description, specific details are set forth in order to provide a thorough understanding of embodiments of the present application. However, persons skilled in the art will understand that embodiments of the present application can be practiced without these specific details. In other instances, well-known systems, devices, circuits and methods have been omitted or simplified in order not to obscure the description of the present application with unnecessary detail.

[0011] It should be understood that when used in the specification and the appended claims of the present application, the term "comprising" indicates the presence of the described features, integers, steps, operations, elements, and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof.

[0012] Reference within the specification of this application to "one embodiment" or "some embodiments" etc., means that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one embodiment of the application. The appearances of the phrases "in one embodiment", "in some embodiments", "in other embodiments", "in additional embodiments" etc., in various places in the specification are not necessarily all referring to the same embodiment, although they can. The terms "comprising", "including", "having" and their variants mean "including but not limited to", unless expressly specified otherwise.

[0013] In the related art, the embedded printing device usually adopts a single dot matrix font library lookup table method when processing text output in a multi-language environment. However, for languages such as Thai and Arabic, which have complex text layout characteristics, because the character shape will change (such as the phenomenon of ligature) with the position of the character in the word, or there are multiple symbols stacked in the vertical direction (such as vowel diacritics), the traditional dot matrix lookup table method can only realize the simple splicing of character encoding and fixed font, and cannot process dynamic morphological conversion and position offset. This leads to the fact that when printing such complex text, text breakage, symbol misplacement, or incomplete display, and other defects occur, which seriously affects the accuracy and readability of the printing output.

[0014] At the same time, in order to take into account the rendering quality, some schemes in the related art try to introduce a vector rendering engine. However, in resource-constrained embedded devices, full use of the vector rendering will consume a large amount of processor computing resources and memory bandwidth, resulting in a significant decrease in the printing response speed of basic characters such as Chinese and English, and easy paper jam or system crash when continuously processing a large amount of transaction data. In addition, related schemes usually lack an effective scheduling mechanism for heterogeneous font library resources, and cannot automatically match the optimal processing channel according to the encoding properties and language characteristics of the input data, resulting in the fact that the system is difficult to balance the output quality and running efficiency when processing mixed language typesetting.

[0015] In order to solve the above problems, the present application provides a printing control method and an electronic device. The following will specifically introduce a printing control method of the present application.

[0016] The printing control method of the present application can be used in various embedded systems and mobile terminal devices with printing output requirements. The electronic device of the present application can be an electronic device with limited resources and supporting internationalized text display, such as a smart POS terminal, a mobile payment handheld device, a thermal printer, a self-service terminal, and various embedded financial terminals equipped with a printing module.

[0017] The following will specifically introduce a printing control method of the present application, and the accompanying drawings will be referred to. Figure 1It mainly includes steps 110 to 150.

[0018] Step 110: Obtain the data to be printed. The electronic device receives a print command stream from the host computer or application through a communication interface (such as USB, Bluetooth, serial port, etc.). This data stream contains the text character data to be printed and related control commands.

[0019] Step 120: Parse the encoding type and language type of the data to be printed. The system preprocesses the received data stream to identify the character encoding standard (e.g., GB18030, UTF-8, or single-byte code page) and the corresponding natural language attribute (e.g., Chinese, Spanish, Thai, or Arabic). This parsing process is the basis for subsequent routing scheduling.

[0020] Step 130: Select a font processing channel based on the encoding type and language type. The font processing channel includes a bitmap font processing channel and a vector font processing channel. The vector font processing channel includes the processing of complex characters and includes an integer rendering process. Based on the parsing results, the system distributes data to different processing paths through an internal scheduling mechanism. If the type is determined to be suitable for fast output, the bitmap font processing channel is selected; if the type requires complex deformation, the vector font processing channel is selected. The vector font processing channel not only involves simple glyph acquisition but also includes shaping and rendering logic for complex character layouts.

[0021] Step 140: Convert the data to be printed into printable dot matrix data through the font processing channel. The selected channel uses its respective mechanism (direct dot matrix encoding or real-time vector rendering) to convert the input character encoding into device-recognizable bitmap data (printable dot matrix data).

[0022] Step 150: Complete printing based on the dot matrix data. The generated dot matrix data is sent to the print driver module to control the thermal print head to heat up and form visual text or images on the printing medium.

[0023] This application establishes a hybrid architecture that includes a bitmap font processing channel and a vector font processing channel with an integer rendering process. It intelligently selects the processing channel based on the encoding type and language type of the data to be printed. Addressing issues such as Thai text stacking and Arabic text distortion that traditional bitmap lookup methods cannot handle, the vector font processing channel with integer rendering ensures the correctness and integrity of complex language output by performing shape planning and binarization rendering on complex characters. Simultaneously, to address the excessive resource consumption caused by full vector rendering, it uses encoding parsing and language type separation to ensure high-speed printing and neat layout of basic characters such as Chinese and Western languages ​​using the bitmap font channel. This achieves efficient and high-quality printing of multiple languages ​​on resource-constrained embedded devices, resolving the contradiction between complex text display abnormalities and system performance, thus balancing printing speed and output quality.

[0024] In one embodiment of this application, the channel selection logic in step 130 is refined, including steps 131 to 132.

[0025] Step 131: If the encoding type is code page or GB18030, then select the dot matrix font processing channel. When the data to be printed is parsed to use the GB18030 standard (usually used for Chinese characters) or code page (usually used for Western extended symbols or traditional ESC / POS commands), the system directly activates the dot matrix font processing channel. This is because the characters covered by GB18030 and code pages are mainly square characters or Latin letters with fixed shapes, and they occupy a dominant position in commercial printing, making them suitable for utilizing the high-speed characteristics of dot matrix fonts.

[0026] Step 132: If the encoding type is UTF-8, then select the character processing channel according to the language type of the data to be printed. When the parsed data is encoded in UTF-8, since UTF-8 can cover all characters globally, the system cannot determine the processing method based solely on the encoding. Therefore, a second judgment is made based on the language type to determine whether to enter the dot matrix channel or the vector channel.

[0027] In this way, a first-level routing strategy based on encoding features was constructed. GB18030 and code pages, as traditional and mature encoding methods, have stable character set structures, and direct mapping to dot matrix fonts can maximize the use of existing resources and improve speed. For UTF-8, a universal encoding, a second-level judgment of language type is introduced, avoiding the indiscriminate sending of all UTF-8 characters to the high-consumption vector engine, thus ensuring internationalization support while maximizing the preservation of system response efficiency.

[0028] In one embodiment of this application, the process of selecting a channel according to the language type in step 132 is refined, including steps 1321 to 1322.

[0029] Step 1321: If the language type is a glyphic language, then the vector font processing channel is selected. When the identified language type belongs to complex text layout languages ​​such as Thai and Arabic, these languages ​​have the characteristics of glyphic changes with position (ligatures) or character combinations (vowel markings), and are therefore determined to be glyphic languages. In this case, the system selects the vector font processing channel and uses its internal engine to process complex glyphic transformations.

[0030] Step 1322: If the language type is a fixed-character language, then select the dot-matrix font processing channel. When the language in the UTF-8 stream is recognized as Chinese, Japanese, or basic Western languages, which have relatively fixed character shapes and do not require contextual deformation, the system selects the dot-matrix font processing channel.

[0031] In this way, a two-level traffic splitting strategy based on the morphological features of characters was established. This strategy logically divides the language based on the mapping relationship between characters and glyphs. For languages ​​where glyphs change with context (such as Arabic and other languages ​​with ligature features), since accurate reconstruction cannot be achieved through a one-to-one correspondence between a single character encoding and a fixed glyph, the system directs them to the vector engine processing path. For languages ​​where the mapping relationship between characters and glyphs is fixed, the dot matrix lookup table processing mode is maintained. Through this traffic splitting mechanism, on-demand matching of computational resources and task complexity is achieved, avoiding display flaws in complex language systems while optimizing the overall resource utilization of the system.

[0032] In one embodiment of this application, the process of conversion through the dot matrix font processing channel in step 140 is refined, including steps 141 to 142.

[0033] Step 141: If the font processing channel is a dot matrix font processing channel, then the data to be printed is parsed according to the encoding type to obtain the character encoding. Within the dot matrix channel, the system reads the data stream according to preset parsing rules (such as the double-byte rule of GB18030 or the single-byte rule of the code page) and extracts the exact character index code.

[0034] Step 142: Based on the character encoding, obtain the corresponding font data from the dot matrix font library, and combine all the font data to obtain the printable dot matrix data. Using the parsed character encoding as an index, directly address in the pre-stored dot matrix font library to read the corresponding binary dot matrix font. Since the dot matrix font is a pre-designed pixel matrix, the reading process does not require complex mathematical calculations. Subsequently, the read multiple fonts are assembled in sequence to form a line or page of data to be printed.

[0035] In this way, static mapping is achieved through a pre-defined character matrix library. For characters with fixed glyphs, direct addressing is used to obtain the bitmap data, simplifying the character parsing process to a memory retrieval operation. This process avoids real-time geometric calculations of vector contours, reduces the processor's computation frequency during the data conversion stage, effectively shortens the processing cycle from instruction reception to bitmap generation, and ensures real-time performance and stability when outputting multiple lines of text continuously.

[0036] In one embodiment of this application, the process of conversion through the vector font processing channel in step 140 is refined, including steps 143 to 145.

[0037] Step 143: If the font processing channel is a vector font processing channel, the text shaping engine processes the data to be printed to obtain the target glyph and target position. After entering the vector channel, the text shaping engine, as the control core of the typesetting logic, outputs the specific glyph index of the character to be printed and its corresponding position on the page based on text rules and context analysis.

[0038] Step 144: Retrieve the glyph data corresponding to the target glyph from the vector font library using the vector rendering engine, and render the glyph data according to the target position to obtain the rendering result. The vector rendering engine receives the target glyph and target position information, extracts the corresponding glyph data from the vector font library, and performs rendering processing in conjunction with the position planning output by the shaping engine.

[0039] Step 145: Convert the rendering result into printable dot matrix data. The rendering engine uses complex text shape planning and rendering logic to binarize the result into monochrome dot matrix data, making it conform to the input requirements of the printer hardware.

[0040] In this way, a complete complex text rendering pipeline was constructed. Through the collaborative processing of the shaping engine and the rendering engine, the problem of inconsistency between the character input order and the final visual presentation in complex languages ​​was resolved. The shaping engine is responsible for analyzing the context and planning the shape, while the rendering engine is responsible for extracting data from the character library and performing binarization. This mechanism solves the deformation (ligature) problem caused by positional changes in complex scripts such as Thai and Arabic, ensuring the correctness of complex language text processing on resource-constrained devices and filling the technological gap where traditional embedded devices cannot handle such texts.

[0041] In one embodiment of this application, the text shaping engine processing in step 143 is refined, including steps 1431 to 1432.

[0042] Step 1431: Obtain the text writing rules corresponding to the language type of the data to be printed. The text shaping engine loads the corresponding text writing rules according to the identified language type. The writing rules include the morphological change rules corresponding to different positions of characters in a word (such as the beginning, middle, and end of the word), as well as the combination and stacking rules between characters.

[0043] Step 1432: The text shaping engine adjusts the glyphs and positions of the characters in the data to be printed according to the writing rules to obtain the target glyphs and positions. The engine traverses the character stream to be printed and applies the writing rules. For characters whose glyphs change with position (such as Arabic), the engine determines the deformed glyphs that should be presented at the current position; for characters with stacking features (such as Thai), the engine adjusts the relative positions of characters and their combinations of symbols to ensure the correctness of display and printing. Finally, the shaped glyphs and their corresponding positions in the printed line are output.

[0044] In this way, a complete complex text rendering logic was constructed. Through the collaborative processing of the shaping engine and the rendering engine, the problem of inconsistency between encoding order and visual form in complex languages ​​was solved. The shaping engine analyzes the text rules, dynamically converting the input character stream into specific deformable glyphs and spatial stacking positions that conform to writing habits; the rendering engine then extracts data from the vector font library according to these instructions and performs binarization conversion. This mechanism solves the problems of Thai character stacking and Arabic character deformation (ligatures) caused by different positions, ensuring that complex language texts with complete structure and correct logic can be printed on resource-constrained devices, filling the technological gap that traditional embedded printing devices cannot handle such texts.

[0045] In one embodiment of this application, the typesetting process of printing based on dot matrix data in step 150 is refined, including steps 151 to 154.

[0046] Step 151: Based on the current print position and the width of the character to be placed, determine whether a line break is needed. The system maintains a horizontal position pointer to the current line's print buffer. Before placing any character generated from any channel into the buffer, calculate whether the current pointer position and the character width exceed the preset maximum line width.

[0047] Step 152: When a line break is required, determine the starting print position of the current line within the preset print area based on the set alignment. If the line breaks are outside the specified range, trigger the line break logic. At this point, the system needs to calculate the starting offset of the new line or the currently filled line. This offset depends on the user's alignment settings (left alignment, center alignment, or right alignment).

[0048] Step 153: Based on the initial printing position and the current printing position, place each character from the print dot matrix data sequentially. After determining the starting coordinates (X-axis), the system writes the dot matrix data byte by byte into the print buffer. For dot matrix font characters, they are written directly; for bitmaps generated by vector rendering, they are also written as image blocks at the corresponding coordinates.

[0049] Step 154: Reset the current print position to the beginning of the next line. After placing a line of data, or after a forced line break is triggered, update the position pointer to prepare for receiving subsequent data streams and achieve continuous printing.

[0050] In this way, a unified typesetting engine is achieved. Regardless of whether the data comes from a bitmap channel or a vector channel, it ultimately converges into a graphic block with a width attribute. This typesetting logic uniformly manages the geometric layout of the page, enabling mixed typesetting of fonts from different sources (such as a single line containing both Chinese bitmap and Thai vector text). This unified backend processing ensures a clean and orderly layout while supporting flexible alignment methods, meeting the aesthetic requirements of printing.

[0051] In one embodiment of this application, the calculation method for determining the starting printing position in step 152 is refined, including steps 1521 to 1523.

[0052] Step 1521: Calculate the sum of the widths of all fonts in the current line as the total width of the line content. When the engine encounters a newline character or actively triggers a newline, it temporarily stores and calculates the cumulative width of all arranged fonts in the current line.

[0053] Step 1522: When the alignment is right-aligned, the starting printing position is the preset line width minus the total width of the line content. The system subtracts the calculated total width of the line content from the preset total line width, and the difference obtained is the starting drawing offset of the line in the horizontal direction.

[0054] Step 1523: When the alignment is centered, the starting printing position is the preset line width minus the total width of the line content, divided by two. The system calculates the difference between the preset line width and the total width of the line content, and divides the difference equally; the resulting value is the starting drawing offset.

[0055] In this way, this application transforms complex visual layout requirements into arithmetic compensation based on geometric width. By pre-calculating the overall physical dimensions of the line content and combining this with the boundary constraints (line width) of the printing paper, precise control over the starting point of character flow drawing is achieved. Whether dealing with dot-matrix characters of uniform width or proportional vector fonts of varying widths, accurate centering or right alignment can be achieved, solving the common layout misalignment problem in multilingual mixed printing and ensuring the format standardization and professionalism of the printed content.

[0056] In one embodiment of this application, steps 101 to 102 are included, which can be performed before obtaining the data to be printed in step 110.

[0057] Step 101: Determine the encoding type and language type through configuration information. The electronic device receives explicit configuration instructions before or during the receipt of print data. These configuration instructions define the attributes of the subsequent data stream.

[0058] Step 102: The configuration information is transmitted via escape codes or interface parameters. Specifically, the configuration can be implemented as an escape sequence embedded in the data stream, or as a parameter structure passed in during an upper-level API call.

[0059] This approach provides interfaces for human-computer interaction or machine-to-machine interaction. The system no longer relies entirely on passive, automatic guessing, but instead allows upper-layer applications to explicitly specify the printing mode. This provides developers with significant flexibility, enabling the same device to serve different language environments at different times, or to print multiple languages ​​mixed on the same document, ensuring the accurate triggering of the font scheduling strategy and avoiding the risk of encoding misjudgment.

[0060] In summary, this invention constructs a print control architecture integrating encoding parsing, multi-path routing scheduling, and a heterogeneous rendering engine. After acquiring the print command stream, it achieves on-demand allocation of print tasks between the bitmap processing channel and the vector processing channel with shaping and rendering capabilities through correlation analysis of data encoding standards and language geometric characteristics. At the feature analysis level, for text encoding with fixed glyphs, a bitmap addressing mechanism is used to directly extract preset glyphs, avoiding complex geometric calculations and ensuring system response speed and low resource consumption. For complex languages ​​with dynamic deformation and stacking features, the collaborative logic of the text shaping engine and the vector rendering engine predetermines the glyph shape index and spatial coordinate offset based on contextual semantics, solving the technical difficulty of non-linear writing system encoding and visual glyph non-one-to-one correspondence from the underlying architecture. This solution solves the rendering errors and typesetting misalignment problems of embedded devices in multilingual environments in the background technology, maintaining the high-frequency printing performance of Chinese and Western languages ​​while ensuring the accuracy and clarity of complex text output, achieving a balance between print compatibility, output quality, and processing performance under limited hardware resources.

[0061] The following details the application embodiments of this application, with reference to the appendix. Figure 2 The above printing control methods will be explained in detail in conjunction with the overall system workflow.

[0062] The system workflow is as follows: Step 1: Resource loading and environment initialization, corresponding to the data acquisition stage in step 110 above.

[0063] When the system starts, it first performs preloading of font resources. Vector font files (such as .ttf format) and bitmap font files are loaded from the storage medium into a preset buffer in memory or Flash, providing the data foundation for subsequent calls from different channels.

[0064] Step 2: Command reception and configuration parsing, corresponding to the parsing encoding and language type in step 120 above.

[0065] The upper-layer application calls the print interface and explicitly specifies the configuration to be used for this print job by sending interface parameters or specific escape instructions (such as the ESC tn instruction). The system receives and parses the instruction, extracts the encoding configuration information, and determines whether the text to be printed is Chinese, code page, Thai, or Arabic.

[0066] Step 3: Font processing channel routing and scheduling, corresponding to selecting the font processing channel in step 130 above.

[0067] Based on the configuration information extracted in step 2, the system directs the subsequent input text data stream to the corresponding processing channel. It selects the most suitable font scheme based on language characteristics, thus guiding the data into either the dot matrix path described in Example 1 or the vector path described in Example 2.

[0068] Step 4: Dot matrix font parsing and processing, corresponding to the dot matrix channel conversion logic in step 140 above.

[0069] If the configuration information points to Chinese (GB18030), the data stream is directed to the dot matrix font management module. The system parses the input byte stream according to the GB18030 rules, recognizing Chinese characters (usually corresponding to 2 to 4 bytes) or basic ASCII codes (single byte). After successful parsing, the character is mapped to the specific storage address of the dot matrix font library, and the corresponding preset dot matrix bitmap (font pattern) is directly retrieved.

[0070] Step 5: Vector font shaping and rendering processing, corresponding to the vector channel conversion logic in step 140 above.

[0071] Select the most suitable font library based on language characteristics:

[0072] If the configuration information points to Thai (UTF-8), the data stream is directed to the vector font rendering engine. The system parses the UTF-8 sequence and identifies the Thai code points. At this point, the text shaping engine and the vector rendering engine work together: the text shaping engine outputs specific glyphs and corresponding positions according to Thai writing rules; the vector rendering engine retrieves the corresponding data from the vector font library according to this instruction, performs shape planning and rendering, and binarizes the result into monochrome dot matrix data.

[0073] Step 6: Mix layout and cursor positioning, corresponding to the layout processing before printing in step 150 above.

[0074] All dot matrix data (font patterns) output from the processing channels are submitted to the unified typesetting engine. This engine, as the layout control core, reads the current cursor position, the user-defined alignment (such as left, center, or right alignment), and the physical width of the font pattern. It calculates the precise coordinates of each character in the print buffer and processes the automatic line wrapping logic in real time according to the line width limit.

[0075] Step 7: Output printing and hardware driver, corresponding to the printing action in step 150 above.

[0076] Once the layout calculation for an entire line or page is complete, the layout engine sends the arranged bitmap data sequence to the underlying print driver hardware. The print hardware then drives the thermal head to physically output the data according to the bitmap, completing the final printing process.

[0077] In summary, this application establishes a hybrid printing architecture that integrates bitmap and vector fonts, achieving intelligent scheduling of multiple encoding systems and multilingual texts. The bitmap channel ensures printing efficiency and layout neatness for fixed-shape characters such as Chinese and Western characters. Simultaneously, the collaborative processing of a text shaping engine and a vector rendering engine solves the technical challenges of positional deformation and stacking rendering for complex characters such as Thai and Arabic. This solution, through a logical combination of layered processing and unified layout, ensures optimized processing speed, character accuracy, and visual clarity for printed content on resource-constrained embedded devices.

[0078] Please refer to Figure 3 The present invention also provides an electronic device 400, including a memory 401 and a processor 402, and a computer program stored on the memory 401 and running on the processor 402. When the processor 402 executes the computer program, it implements the various steps in the printing control method described above.

[0079] The beneficial effects of the electronic device of the present invention are the same as those of the method described above, and will not be repeated here.

[0080] The above are merely embodiments of the present invention and do not limit the patent scope of the present invention. Any equivalent modifications made based on the content of the present invention's specification and drawings, or direct or indirect applications in related technical fields, are similarly included within the patent protection scope of the present invention.

Claims

1. A printing control method, characterized in that, Applied to electronic devices, including: Get the data to be printed; Parse the encoding type and language type of the data to be printed; The font processing channel is selected based on the encoding type and language type; the font processing channel includes a bitmap font processing channel and a vector font processing channel; the vector font processing channel includes the processing of complex characters and includes an integer rendering process; The data to be printed is converted into print dot matrix data through the font processing channel; Printing is completed based on the print dot matrix data.

2. The printing control method according to claim 1, characterized in that, The selection of the character processing channel based on the encoding type and language type includes: If the encoding type is code page or GB18030, then select the dot matrix font processing channel; If the encoding type is UTF-8, then the font processing channel is selected according to the language type of the data to be printed.

3. The printing control method according to claim 2, characterized in that, The step of selecting the font processing channel according to the language type corresponding to the data to be printed includes: If the language type is a glyph-variant language, then select the vector font processing channel; If the language type is a fixed-graph language, then select the dot matrix font processing channel.

4. The printing control method according to claim 1, characterized in that, The process of converting the data to be printed into printable dot matrix data through the font processing channel includes: If the font processing channel is a dot matrix font processing channel, then the character encoding is obtained by parsing the data to be printed according to the encoding type; Based on the character encoding, the corresponding font data is obtained from the dot matrix font library, and all the font data are combined to obtain the printed dot matrix data.

5. The printing control method according to claim 1, characterized in that, The process of converting the data to be printed into printable dot matrix data through the font processing channel includes: If the font processing channel is a vector font processing channel, then the text shaping engine processes the data to be printed to obtain the target font and target position. The vector rendering engine retrieves the glyph data corresponding to the target glyph from the vector font library, and renders the glyph data according to the target position to obtain the rendering result; The rendering result is converted into printable bitmap data.

6. The printing control method according to claim 5, characterized in that, The step of processing the text to be printed data using a text shaping engine to obtain the target glyph and target position includes: Obtain the text writing rules corresponding to the language type of the data to be printed; The text shaping engine adjusts the glyphs and positions of the characters in the data to be printed according to the text writing rules to obtain the target glyphs and target positions.

7. The printing control method according to claim 1, characterized in that, The process of printing based on print dot matrix data includes: Determine whether a line break is needed based on the current printing position and the width of the character to be placed; When a line break is required, the starting printing position of the current line within the preset printing area is determined according to the set alignment. Based on the starting printing position and the current printing position, place each character pattern in the printing dot matrix data sequentially; Reset the current print position to the beginning of the next line.

8. A printing control method according to claim 7, characterized in that, Determining the starting printing position of the current line within the printing area according to the set alignment method includes: Calculate the sum of the widths of all fonts in the current line as the total width of the line content; When the alignment is right-aligned, the starting printing position is the preset line width minus the total width of the line content; When the alignment is centered, the starting printing position is the preset line width minus the total width of the line content, divided by two.

9. A printing control method according to claim 1, characterized in that, Also includes: The encoding type and language type are determined by the configuration information; The configuration information is transmitted via escape codes or interface parameters.

10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that, When the processor executes the computer program, it implements each step of the printing control method according to any one of claims 1-9.