Method and device for determining font width of widened font and electronic equipment

By performing bitwise or calculation and offset traversal processing on the dot matrix font row sequence, the width of each font is determined, and the glyph distortion problem caused by changes in font size, thickness or inclination in the prior art is solved, and faster font parsing speed and better display effect are achieved.

CN119988703APending Publication Date: 2025-05-13FOSHAN PINE TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202311510496.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-11-13
Publication Date
2025-05-13

AI Technical Summary

Technical Problem

When using dot matrix font library to display character strings, it is difficult to effectively solve the changes in font size, thickness or inclination, resulting in glyph distortion and the inability to display non-uniform fonts, which are poor in versatility and compatibility.

Method used

By performing bitwise or operation on each font in the dot matrix font row sequence, the calculation result is obtained, and each byte is traversed based on the calculation result, the right-biased movement amount and the left-biased movement amount of the font are obtained, and the width of each font is determined based on the difference between the number of bytes and the offset.

Benefits of technology

The width of the widening font is determined, and the time complexity is reduced to O(n), which is faster in the font parsing of dot matrix fonts with larger width and height, solving the problem of poor font display effect.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119988703A_ABST
    Figure CN119988703A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of mobile communication, in particular to a method and device for determining the font width of a widened font and electronic equipment when a dot matrix font library is used for displaying character strings. The method comprises the following steps: performing bitwise OR operation on each font in a dot matrix font row sequence to obtain an operation result, performing traversal processing on each byte in the row sequence on the basis of the operation result to obtain a right offset movement amount and a left offset movement amount of the font, and then acquiring the number of bytes occupied by the font in each row sequence to obtain the left offset movement amount and the right offset movement amount of the font. And determining the width of each font according to the byte number and the difference between the right offset movement amount and the left offset movement amount to solve the font width. According to the technical scheme provided by the invention, the time complexity for solving the font width is O (n), and the speed in font analysis of a dot matrix font library with relatively large width and height is higher.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of mobile communications, and in particular to a method, device and electronic device for determining the font width of a variable width font when a dot matrix font library is used to display a character string. Background Art

[0002] In the dot matrix font file, each font is stored in a way that 1 bit represents one pixel, and a line that is less than 1 byte is counted as 1 byte. The dot matrix font only stores the bitmap information of the matching size, and the size, thickness or tilt cannot be freely changed, otherwise it will cause distortion of the font. Therefore, when fonts of different sizes, thicknesses or tilts are required, the font display module in the POS platform needs to be modified or the corresponding font library support is required, which is very complicated to operate and the display effect is poor. In addition, the dot matrix font cannot set a separate size for a single font, and can only display monospaced fonts but not non-monospaced fonts such as Arabic. It is not very versatile and has poor compatibility.

[0003] In order to solve this technical problem, the prior art patent CN200810207948.9 provides a method for calculating the display width of a dot matrix font. The method calculates the width of each row of the dot matrix, compares the maximum width, and calculates the width of the font. However, this method needs to calculate the width of each row of the font, and needs to traverse rows and columns, with a time complexity of O(n^2), and FreeType requires large memory consumption and slow speed. Summary of the invention

[0004] In order to solve the above technical problems, the embodiments of the present application provide a method, device and electronic device for determining the font width of a variable width font, which adopt the following technical solutions:

[0005] In a first aspect, a method for determining the font width of a variable width font is provided, the method comprising: performing a bitwise OR operation on each font in a dot matrix font row sequence to obtain an operation result, the operation result comprising 0 and non-0; based on the operation result, traversing each byte in the row sequence respectively to obtain the right offset movement rightOffset and the left offset movement leftOffset of the font; obtaining the number of bytes occupied by each font in the row sequence, and determining the width of each font according to the difference between the number of bytes and the right offset movement and the left offset movement, based on the following formula: d=a*8-rightOffset-leftOffset; wherein d represents the width of each font, and a represents the number of bytes.

[0006] Furthermore, traversing each byte in the row sequence based on the calculation result to obtain the rightward movement of the font includes: traversing each byte in the row sequence forward based on the calculation result to obtain the rightward movement of the font.

[0007] Furthermore, each byte in the row sequence is traversed forward based on the calculation result to obtain the right offset of the font, including: when the calculation result is 0, the right offset of the font is rightOffset+8.

[0008] Furthermore, each byte in the row sequence is traversed forward based on the operation result to obtain the right shift of the font, including: when the operation result is non-zero, starting from the MSB of the byte, accessing the array max_index by indexing to obtain the bit offset bitOffset, and combining the bit offset with the right shift to obtain the target right shift, based on the following formula: rightOffset′=rightOffset+bitOffset, where rightOffset′ represents the target right shift.

[0009] Furthermore, the traversing each byte in the row sequence based on the calculation result to obtain the left shift amount of the font includes: performing reverse traversing processing on each byte in the row sequence based on the calculation result to obtain the left shift amount of the font.

[0010] Furthermore, based on the calculation result, each byte in the row sequence is reversely traversed to obtain the left offset of the font, including: when the calculation result is 0, the left offset of the font is leftOffset+8.

[0011] Furthermore, based on the calculation result, each byte in the row sequence is reversely traversed to obtain the left offset of the font, including: when the calculation result is non-zero, indexing the array min_index from LSB to obtain bitOffset, and combining the bit offset with the left offset to obtain the target left offset, based on the following formula: lfetOffset′=leftOffset+bitOffset, where lfetOffset′ represents the target left offset.

[0012] In a second aspect, a device for determining the font width of a variable width font is provided, the device comprising: a bitwise OR operation module, used to compare each font in a dot matrix font row sequence and perform a bitwise OR operation to obtain an operation result, wherein the operation result includes 0 and non-0; an offset operation module, which traverses each byte in the row sequence based on the operation result to obtain the right offset rightOffset and the left offset leftOffset of the font; a width determination module, used to obtain the number of bytes occupied by the font in each of the row sequences, and determine the width of each font according to the difference between the number of bytes and the right offset and the left offset.

[0013] Furthermore, the offset calculation module includes a left offset movement determination submodule and a right offset movement determination submodule.

[0014] According to a third aspect, an electronic device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements any of the above-described methods when executing the computer program.

[0015] In a fourth aspect, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, any of the methods described above is implemented.

[0016] In the technical solution provided by the embodiment of the present application, a bitwise OR operation is performed on each font in a dot matrix font row sequence to obtain an operation result, and each byte in the row sequence is traversed and processed based on the operation result to obtain the right offset and left offset of the font, and then the font width is obtained by obtaining the number of bytes occupied by the font in each row sequence and determining the width of each font according to the difference between the number of bytes and the right offset and left offset. The time complexity of the technical solution provided by the present application for calculating the font width is O(n), and the speed is faster in parsing dot matrix fonts with larger width and height. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0018] The methods, systems and / or programs in the accompanying drawings will be further described according to exemplary embodiments. These exemplary embodiments will be described in detail with reference to the drawings. These exemplary embodiments are non-limiting exemplary embodiments, wherein example numbers represent similar mechanisms in the various views of the accompanying drawings.

[0019] Figure 1 It is a flowchart of a method for determining the font width of a variable width font provided in an embodiment of the present application.

[0020] Figure 2 It is a flow chart of the method for determining the rightward movement amount provided in an embodiment of the present application.

[0021] Figure 3 It is a flow chart of the method for determining the left deviation movement amount provided in an embodiment of the present application.

[0022] Figure 4 It is a structural diagram of a device for determining the font width of a variable width font provided in an embodiment of the present application.

[0023] Figure 5 It is a structural diagram of the offset calculation module provided in an embodiment of the present application.

[0024] Figure 6 It is a schematic diagram of the structure of a device for determining the font width of a variable width font provided in an embodiment of the present application. DETAILED DESCRIPTION

[0025] In order to better understand the above technical scheme, the technical scheme of the present application is described in detail below through the accompanying drawings and specific embodiments. It should be understood that the embodiments of the present application and the specific features in the embodiments are detailed descriptions of the technical scheme of the present application, rather than limitations on the technical scheme of the present application. In the absence of conflict, the embodiments of the present application and the technical features in the embodiments can be combined with each other.

[0026] In the following detailed description, numerous specific details are set forth by way of example in order to provide a comprehensive understanding of the relevant guidance. However, it will be apparent to those skilled in the art that the present application may be practiced without these details. In other cases, well-known methods, procedures, systems, compositions and / or circuits have been described at a relatively high level, without detail, in order to avoid unnecessarily obscuring aspects of the present application.

[0027] Flowcharts are used in the present application to illustrate the execution process performed by the system according to the embodiment of the present application. It should be clearly understood that the execution process of the flowchart may not be performed in order. On the contrary, these execution processes may be performed in reverse order or simultaneously. In addition, at least one other execution process may be added to the flowchart. One or more execution processes may be deleted from the flowchart.

[0028] Before further describing the embodiments of the present invention in detail, the nouns and terms involved in the embodiments of the present invention are described. The nouns and terms involved in the embodiments of the present invention are subject to the following interpretations.

[0029] (1) In response, it is used to indicate the conditions or states on which the executed operations depend. When the dependent conditions or states are met, one or more operations executed may be in real time or with a set delay. Unless otherwise specified, there is no restriction on the order in which the multiple operations executed are executed.

[0030] (2) Based on is used to indicate the conditions or states on which the executed operations depend. When the dependent conditions or states are met, one or more operations executed may be in real time or have a set delay. Unless otherwise specified, there is no restriction on the order in which the multiple operations executed are executed.

[0031] In order to determine the font width in a bitmap font library, an embodiment of the present application provides a method for determining the font width of a variable width font, which specifically includes the following method:

[0032] Step S110: Perform a bitwise OR operation on each font in the dot matrix font row sequence to obtain an operation result.

[0033] The bitwise OR operation in the embodiment of the present application can be performed using the method in the prior art. The logic of the bitwise OR operation is that the binary bits corresponding to the two numbers participating in the operation are ORed. As long as one of the two corresponding binary bits is 1, the result bit is 1, and the two numbers participating in the operation appear in the complement code. The result of the bitwise OR operation in the embodiment of the present application includes 0 and non-0.

[0034] Step S120: Based on the calculation result, each byte in the row sequence is traversed and processed to obtain the rightward movement amount and the leftward movement amount of the font.

[0035] In the embodiment of the present application, the traversal processing and processing process for the right offset movement amount and the left offset movement amount have different processing logics, but the core processing logic is that when the calculation result in step S110 is 0, the corresponding left offset movement amount and right offset movement amount are determined, and when the calculation result in step S110 is not 0, the corresponding left offset movement amount and right offset movement amount are determined. The right offset movement amount is obtained by traversing each byte in the row sequence in a forward direction, and the left offset movement amount is obtained by traversing each font in the row sequence in a reverse direction.

[0036] The acquisition of the above leftward movement amount and rightward movement amount is explained respectively.

[0037] The determination of the right deviation amount includes the following steps:

[0038] Step S120-1. When the operation result is 0, the right offset of the font is rightOffset+8;

[0039] Step S120-2. When the operation result is non-zero, starting from the MSB of the byte, the array max_index is accessed by indexing to obtain the bit offset bitOffset, and the bit offset is combined with the right shift amount to obtain the target right shift amount, which is expressed based on the following formula:

[0040] rightOffset′=rightOffset+bitOffset, where rightOffset′ represents the rightward movement of the target.

[0041] The determination of the left deviation amount includes the following steps:

[0042] Step S120-3. When the calculation result is 0, the left offset of the font is leftOffset+8.

[0043] Step S120-4. When the operation result is non-zero, index the array min_index from LSB to obtain bitOffset, and combine the bit offset with the left shift amount to obtain the target left shift amount, which is expressed based on the following formula:

[0044] lfetOffset′=leftOffset+bitOffset, where lfetOffset′ represents the leftward movement of the target.

[0045] Step S130: Obtain the number of bytes occupied by the font in each row sequence, and determine the width of each font according to the difference between the number of bytes and the right offset and the left offset.

[0046] In the embodiment of the present application, the number of bytes occupied by the font in the line sequence is further determined by the unit characteristics of the dot matrix font. This process can be implemented by using the corresponding method in the prior art.

[0047] The processing process for this step can be expressed based on the following formula:

[0048] d=a*8-rightOffset-leftOffset;

[0049] Wherein d represents the width of each font, and a represents the number of bytes.

[0050] See also Figure 4 , a device 400 for determining the font width of a variable width font is provided, the device comprising:

[0051] A bitwise OR operation module 410 is used to compare each font in the dot matrix font row sequence and perform a bitwise OR operation to obtain an operation result, wherein the operation result includes 0 and non-0;

[0052] The offset calculation module 420 performs traversal processing on each byte in the row sequence based on the calculation result to obtain the right offset rightOffset and the left offset leftOffset of the font;

[0053] The width determination module 430 is used to obtain the number of bytes occupied by the font in each of the line sequences, and determine the width of each font according to the difference between the number of bytes and the right offset and the left offset.

[0054] In the embodiment of the present application, the structure of the offset calculation module 420 can be referred to. Figure 5 , including a left-biased movement amount determination submodule 421 and a right-biased movement amount determination submodule 422.

[0055] See also Figure 6 , the above method can also be integrated into the provided device 600 for determining the font width of a variable-width font. In view of the fact that the device may have relatively large differences due to different configurations or performances, it can include one or more processors 601 and a memory 602, and the memory 602 can store one or more storage applications or data. Among them, the memory 602 can be a temporary storage or a permanent storage. The application stored in the memory 602 can include one or more modules (not shown in the figure), and each module can include a series of computer executable instructions in the device for determining the font width of a variable-width font. Furthermore, the processor 601 can be configured to communicate with the memory 602, and the device for determining the font width of a variable-width font executes a series of computer executable instructions in the memory 602. The device for determining the font width of a variable-width font can also include one or more power supplies 603, one or more wired or wireless network interfaces 604, one or more input / output interfaces 605, one or more keyboards 606, etc.

[0056] In a specific embodiment, a device for determining a font width of a variable width font includes a memory and one or more programs, wherein the one or more programs are stored in the memory, and the one or more programs may include one or more modules, and each module may include a series of computer executable instructions for determining a font width of a variable width font in the device, and the one or more programs are configured to be executed by one or more processors, including computer executable instructions for performing the following:

[0057] Compare each font in the dot matrix font row sequence and perform a bitwise OR operation to obtain an operation result;

[0058] Based on the calculation result, each byte in the row sequence is traversed and processed respectively to obtain the right deviation and left deviation of the font;

[0059] The number of bytes occupied by the font in each row sequence is obtained, and the width of each font is determined according to the difference between the number of bytes and the right offset shift amount and the left offset shift amount.

[0060] The following is a detailed introduction to the various components of the processor:

[0061] In this embodiment, the processor is an application specific integrated circuit (ASIC), or is configured to implement one or more integrated circuits of the embodiments of the present application, such as one or more microprocessors (digital signal processor, DSP), or one or more field programmable gate arrays (field programmable gate array, FPGA).

[0062] Optionally, the processor may execute various functions by running or executing a software program stored in the memory and calling data stored in the memory, such as executing the above-mentioned Figure 1 The method shown.

[0063] In a specific implementation, as an embodiment, the processor may include one or more microprocessors.

[0064] Among them, the memory is used to store the software program that executes the solution of the present application, and the execution is controlled by the processor. The specific implementation method can refer to the above method embodiment and will not be repeated here.

[0065] Optionally, the memory may be a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM) or other types of dynamic storage devices that can store information and instructions, or an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical disc, laser disc, optical disc, digital versatile disc, Blu-ray disc, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory may be integrated with the processor, or may exist independently and be coupled to the processing unit through the interface circuit of the processor, and the embodiments of the present application do not specifically limit this.

[0066] It should be noted that the structure of the processor shown in this embodiment does not constitute a limitation on the device, and the actual device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.

[0067] In addition, the technical effects of the processor can refer to the technical effects of the method described in the above method embodiment, which will not be repeated here.

[0068] It should be understood that the processor in the embodiments of the present application may be other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.

[0069] It should also be understood that the memory in the embodiments of the present application may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of random access memory (RAM) are available, such as static RAM (SRAM), dynamic random access memory (DRAM), synchronous DRAM (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link DRAM (SLDRAM), and direct rambus RAM (DR RAM).

[0070] The above embodiments can be implemented in whole or in part by software, hardware (such as circuits), firmware or any other combination. When implemented using software, the above embodiments can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions or computer programs. When the computer instructions or computer programs are loaded or executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from one website site, computer, server or data center to another website site, computer, server or data center by wired (such as infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that contains one or more available media sets. The available medium can be a magnetic medium (for example, a floppy disk, a hard disk, a tape), an optical medium (for example, a DVD), or a semiconductor medium. The semiconductor medium can be a solid-state hard disk.

[0071] In this application, "at least one" means one or more, and "more" means two or more. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, or c can be represented by: a, b, c, ab, ac, bc, or abc, where a, b, c can be single or multiple.

[0072] It should be understood that in the various embodiments of the present application, the size of the serial numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0073] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0074] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0075] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0076] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0077] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0078] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage media include: various media that can store program codes, such as USB flash drives, mobile hard disks, read-only memories (ROM), random access memories (RAM), magnetic disks or optical disks.

[0079] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A method for determining the font width of a variable width font, characterized in that: The method comprises: Performing a bitwise OR operation on each font in the dot matrix font row sequence to obtain an operation result, wherein the operation result includes 0 and non-0; Based on the calculation result, each byte in the row sequence is traversed and processed respectively to obtain the right offset rightOffset and the left offset leftOffset of the font; The number of bytes occupied by the font in each row sequence is obtained, and the width of each font is determined according to the difference between the number of bytes and the right offset shift amount and the left offset shift amount. This process is expressed based on the following formula: d=a*8-rightOffset-leftOffset; wherein d represents the width of each font, and a represents the number of bytes.

2. The method for determining the font width of a variable width font according to claim 1, characterized in that: The traversing each byte in the row sequence based on the calculation result to obtain the rightward movement amount of the font includes: traversing each byte in the row sequence forward based on the calculation result to obtain the rightward movement amount of the font.

3. The method for determining the font width of a variable width font according to claim 2, characterized in that: The step of traversing each byte in the row sequence based on the calculation result to obtain the right offset of the font includes: when the calculation result is 0, the right offset of the font is rightOffset+8.

4. The method for determining the font width of a variable width font according to claim 3, characterized in that: The step of traversing each byte in the row sequence based on the operation result to obtain the right offset of the font includes: when the operation result is non-zero, starting from the MSB of the byte, accessing the array max_index by indexing to obtain the bit offset bitOffset, and combining the bit offset with the right offset to obtain the target right offset, which is expressed based on the following formula: rightOffset′=rightOffset+bitOffset, where rightOffset′ represents the rightward movement of the target.

5. The method for determining the font width of a variable width font according to claim 1, characterized in that: The traversing each byte in the row sequence based on the calculation result to obtain the left shift amount of the font includes: performing reverse traversing processing on each byte in the row sequence based on the calculation result to obtain the left shift amount of the font.

6. The method for determining the font width of a variable width font according to claim 5, characterized in that: The reverse traversal processing is performed on each byte in the row sequence based on the operation result to obtain the left offset of the font, including: when the operation result is 0, the left offset of the font is leftOffset+8.

7. The method for determining the font width of a variable width font according to claim 5, characterized in that: The reverse traversal processing is performed on each byte in the row sequence based on the operation result to obtain the left offset of the font, including: when the operation result is non-zero, indexing the array min_index from LSB to obtain bitOffset, and combining the bit offset with the left offset to obtain the target left offset, which is expressed based on the following formula: lfetOffset′=leftOffset+bitOffset, where lfetOffset′ Indicates the target's leftward movement.

8. A device for determining the font width of a variable width font, characterized in that: The device comprises: A bitwise OR operation module, used for comparing each font in the dot matrix font row sequence to perform a bitwise OR operation to obtain an operation result, wherein the operation result includes 0 and non-0; An offset calculation module, based on the calculation result, traverses each byte in the row sequence to obtain a right offset rightOffset and a left offset leftOffset of the font; The width determination module is used to obtain the number of bytes occupied by the font in each row sequence, and determine the width of each font according to the difference between the number of bytes and the right offset movement amount and the left offset movement amount.

9. The device for determining the font width of a variable width font according to claim 8, characterized in that: The offset calculation module includes a left offset movement determination submodule and a right offset movement determination submodule.

10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method for determining the font width of a variable width font according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Method for calculating the display width of characters in a dot matrix character library

    CN101763845A