Image processing method and apparatus

By recognizing and cropping excessively long characters, the problem of abnormal interface display caused by users inputting special characters has been solved, achieving higher character recognition accuracy and user experience.

CN122173172APending Publication Date: 2026-06-09HONOR DEVICE CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
HONOR DEVICE CO LTD
Filing Date
2024-12-04
Publication Date
2026-06-09

AI Technical Summary

Technical Problem

When users input special characters, the application cannot effectively recognize excessively long characters, resulting in abnormal interface display and affecting user experience.

Method used

By identifying and cropping excessively long glyphs, determining the side length relationship of their rectangular areas, cropping the excessively long glyphs to fit the preset size, and using a higher-priority font library for character recognition, normal display is ensured.

Benefits of technology

It reduced interface display anomalies and improved the accuracy of character recognition and user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122173172A_ABST
    Figure CN122173172A_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide an image processing method and device, and relate to the technical field of terminals. The method comprises: in the case where it is detected that a first character exists, recognizing the first character based on a first font library to obtain a first font texture, the first font texture comprising a first character shape and a second character shape; cropping the first character shape to obtain a second font texture; drawing a first image based on the second font texture; and displaying the first image. In this way, in the case where the electronic device recognizes that the first character shape is an overlong character shape, the cropping of the first character shape can reduce the case where the electronic device displays part of the first character shape and part of the second character shape as one character shape on the interface due to the overlong first character shape.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of terminal technology, and in particular to an image processing method and apparatus. Background Technology

[0002] With the development of terminal technology, users' functional needs for electronic devices are becoming more and more diversified. In order to meet users' personalized needs, many applications can support users to input characters. For example, applications can use the characters input by users as user identification numbers (ID) and display them on the interface.

[0003] Normally, when users input special characters into an application, the application can reduce the input of special characters through certain interception methods. However, when interception is not possible, the application can use a font library to recognize special characters as excessively long glyphs, which cause abnormal interface display. Summary of the Invention

[0004] This application provides an image processing method and apparatus, applied in the field of terminal technology, which can recognize and crop some ultra-long characters in the application, reducing the occurrence of abnormal interface display.

[0005] In a first aspect, embodiments of this application propose an image processing method, the method comprising: upon detecting the presence of a first character, recognizing the first character based on a first font library to obtain a first font texture, the first font texture comprising: a first glyph and a second glyph, the first glyph corresponding to a first rectangular region, the second glyph corresponding to a second rectangular region, the first side length of the first rectangular region being greater than a first value, and the second side length of the first rectangular region being less than or equal to the first value, the third side length of the second rectangular region being less than or equal to the first value, and the fourth side length of the second rectangular region being less than or equal to the first value; cropping the first glyph to obtain a second font texture, the second font texture comprising: a third glyph and the second glyph, the third glyph corresponding to a third rectangular region, the fifth side length of the third rectangular region being less than or equal to the first value, the fifth side length being the side length obtained after cropping the first side length; drawing a first image based on the second font texture, and displaying the first image.

[0006] The first glyph can be an extra-long glyph or an abnormal glyph as described in the embodiments of this application.

[0007] Electronic devices can crop the first glyph so that a portion of the first glyph (i.e., the third glyph) and the second glyph following the first glyph can be displayed normally on the interface, reducing the instances where a portion of the first glyph and a portion of the second glyph are displayed as a single glyph.

[0008] In one possible implementation, the second glyph is a glyph located after the first glyph, the texture coordinates of the first vertex of the first glyph are the first coordinates, the texture coordinates of the second vertex of the second glyph are the second coordinates, and the first glyph is cropped, including: cropping the first glyph according to the relationship between the first coordinates and the second coordinates.

[0009] Electronic devices can determine whether one of the two glyphs is abnormal by the relationship between the coordinates of a vertex in the two glyphs.

[0010] In one possible implementation, when the first and second glyphs are arranged horizontally, the first vertex is the bottom right vertex and the second vertex is the bottom left vertex, or the first vertex is the top right vertex and the second vertex is the top left vertex, and the x-coordinate of the first coordinate is greater than the x-coordinate of the second coordinate.

[0011] In this scenario, the first glyph can be glyph A, and the second glyph can be glyph B. With glyph A and glyph B arranged horizontally, the electronic device can determine whether glyph A is abnormal by analyzing the relationship between the horizontal coordinates of adjacent coordinates, thus enabling the recognition of abnormal glyphs.

[0012] In one possible implementation, when the first and second glyphs are arranged vertically, the first vertex is the bottom left vertex and the second vertex is the top left vertex, or the first vertex is the bottom right vertex and the second vertex is the top right vertex, and the ordinate of the first coordinate is less than the ordinate of the second coordinate.

[0013] In this scenario, the first glyph can be glyph A, and the second glyph can be glyph B. With glyph A and glyph B arranged vertically, the electronic device can determine whether glyph A is abnormal by analyzing the relationship between the vertical coordinates of adjacent coordinates, thus enabling the recognition of abnormal glyphs.

[0014] In one possible implementation, cropping the first glyph includes cropping the first glyph if the first font texture exceeds a first preset size.

[0015] The first preset size can be the preset size 1 described in the embodiments of this application, such as preset size 1 being 4096*4096.

[0016] In this way, electronic devices can determine whether there are abnormal glyphs in the font texture by recognizing the size of the font texture. If abnormal glyphs are found in the font texture, the abnormal glyphs can be further identified, simplifying the complexity of abnormal glyph search.

[0017] In one possible implementation, the electronic device further includes: a second font library, which recognizes the first character based on the first font library, including: recognizing the first character based on the first font library when the priority of the first font library is greater than the priority of the second font library; after cropping the first glyph, the method further includes: reducing the priority of the first font library.

[0018] In this way, electronic devices can use higher-priority font libraries for character recognition the next time they perform character recognition, thereby improving the accuracy of character recognition.

[0019] In one possible implementation, the value of the fifth side length is equal to the value of the second side length. The first character is then cropped, including cropping the first side length to the fifth side length based on the value of the second side length. In this way, if the electronic device detects that the first character is an abnormal character, it can crop it according to the shorter second side length as the side length of the square, thus cropping the first side length to the fifth side length.

[0020] In one possible implementation, detecting the presence of a first character includes: detecting the presence of a first character in a first application, the first application including a third font library; recognizing the first character based on the first font library includes: recognizing the first character based on the third font library to obtain a second character, wherein the second character includes: a fourth glyph recognized from the first character based on the third font library, and a third character that cannot be recognized based on the third font library; and recognizing the third character based on the first font library.

[0021] The first application can be the game application described in the embodiments of this application, and the third font library can be a game font library. That is, the electronic device can perform the first font recognition through the game font library. If the game font library cannot recognize the character, it can perform the second recognition based on the first font library to improve the accuracy of character recognition.

[0022] In one possible implementation, recognizing the first character based on a first font library includes: recognizing the first character based on the first font library upon receiving a first instruction, wherein the first instruction is used to initiate a screen refresh. The first instruction can be instruction 1 described in the embodiments of this application. In this way, the electronic device can perform character recognition each time the interface is refreshed.

[0023] Secondly, embodiments of this application provide an image processing apparatus, which may be an electronic device, a chip, or a chip system within an electronic device. The image processing apparatus may include a display unit and a processing unit. When the image processing apparatus is an electronic device, the display unit may be a display screen. The display unit is used to perform display steps to cause the electronic device to implement an image processing method described in the first aspect or any possible implementation of the first aspect. When the image processing apparatus is an electronic device, the processing unit may be a processor. The image processing apparatus may further include a storage unit, which may be a memory. The storage unit is used to store instructions, and the processing unit executes the instructions stored in the storage unit to cause the electronic device to implement an image processing method described in the first aspect or any possible implementation of the first aspect. When the image processing apparatus is a chip or a chip system within an electronic device, the processing unit may be a processor. The processing unit executes the instructions stored in the storage unit to cause the electronic device to implement an image processing method described in the first aspect or any possible implementation of the first aspect. The storage unit can be a storage unit inside the chip (e.g., a register, cache, etc.) or a storage unit located outside the chip within the electronic device (e.g., a read-only memory, random access memory, etc.).

[0024] Specifically, upon detecting the presence of a first character, the processing unit identifies the first character based on a first font library to obtain a first font texture. The first font texture includes a first glyph and a second glyph. The first glyph corresponds to a first rectangular area, and the second glyph corresponds to a second rectangular area. The first side length of the first rectangular area is greater than a first value, and the second side length of the first rectangular area is less than or equal to the first value. The third side length of the second rectangular area is less than or equal to the first value, and the fourth side length of the second rectangular area is less than or equal to the first value. The processing unit is also used to crop the first glyph to obtain a second font texture. The second font texture includes a third glyph and a second glyph. The third glyph corresponds to a third rectangular area, and the fifth side length of the third rectangular area is less than or equal to the first value. The fifth side length is the side length obtained after cropping the first side length. The processing unit is also used to draw a first image based on the second font texture, and the display unit is also used to display the first image.

[0025] Thirdly, embodiments of this application provide an electronic device, which includes: one or more processors and a memory; the memory is coupled to one or more processors, and the memory is used to store computer program code, the computer program code including computer instructions, and the one or more processors call the computer instructions to cause the electronic device to perform the methods described in the first aspect or any possible implementation of the first aspect.

[0026] Fourthly, embodiments of this application provide a computer-readable storage medium including computer instructions that, when executed on an electronic device, cause the electronic device to perform the methods described in the first aspect or any possible implementation thereof.

[0027] Fifthly, embodiments of this application provide a computer program product including a computer program. When the computer program product includes computer program code, when the computer program code is run on an electronic device, it causes the electronic device to perform the method described in the first aspect or any possible implementation of the first aspect.

[0028] Sixthly, this application provides a chip system applied to an electronic device. The chip system includes one or more processors, which are used to invoke computer instructions to cause the electronic device to perform the methods described in the first aspect or any possible implementation of the first aspect.

[0029] In one possible implementation, the chip system described above in this application further includes at least one memory storing instructions. The memory can be an internal storage unit of the chip system, such as a register or cache, or it can be a storage unit of the chip system itself (e.g., read-only memory, random access memory, etc.).

[0030] It should be understood that the second to sixth aspects of this application correspond to the technical solutions of the first aspect of this application, and the beneficial effects achieved by each aspect and the corresponding feasible implementation are similar, and will not be repeated here. Attached Figure Description

[0031] Figure 1 A scenario diagram provided for an embodiment of this application;

[0032] Figure 2 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of this application;

[0033] Figure 3 A schematic diagram of the software structure of an electronic device provided in an embodiment of this application;

[0034] Figure 4 A schematic flowchart of an image processing method provided in an embodiment of this application;

[0035] Figure 5 A schematic diagram illustrating the principle of an abnormal character shape provided in an embodiment of this application;

[0036] Figures 6A-6C This is a schematic diagram of a cropped abnormal character shape provided in an embodiment of this application;

[0037] Figure 7 A schematic diagram of module interaction for an image processing method provided in an embodiment of this application;

[0038] Figure 8 A flowchart illustrating another image processing method provided in an embodiment of this application;

[0039] Figure 9 This is a schematic diagram of the hardware structure of another electronic device provided in an embodiment of this application. Detailed Implementation

[0040] To facilitate a clear description of the technical solutions in the embodiments of this application, some terms and technologies involved in the embodiments of this application will be briefly introduced below:

[0041] 1. Font texture

[0042] Font texture typically refers to a texture image used to render text, which contains image data for displaying the text. Font texture may also be called font texture, texture map, texture image, glyph texture, glyph image, or texture map, etc., and this application embodiment does not limit the terminology.

[0043] For example, a font texture can consist of glyphs (or textures) that are allowed to be displayed on the interface. During the rendering process of a font texture, electronic devices can typically recognize input characters based on a font library and draw the recognized glyphs into the font texture. When the electronic device needs to display text, the glyphs can be cropped from the font texture according to a pre-set size and displayed on the interface.

[0044] 2. Font library

[0045] A font library provides vector graphic descriptions of characters. It can contain a character mapping table, which shows the correspondence between characters and glyphs within the font. This allows electronic devices to use the character mapping table to determine the glyph corresponding to the input character.

[0046] For example, a user can input characters through an input device. These characters can be represented in a certain encoding format (such as UTF-8 or UTF-16). The electronic device needs to correctly interpret these encodings in order to display the characters correctly. At this time, the electronic device can obtain a font library and use the character mapping table in the font library to determine the glyph corresponding to the input character. The electronic device can then perform steps such as rendering the glyph and drawing it onto an image.

[0047] 3. UV coordinates

[0048] UV coordinates can be a two-dimensional coordinate system used to locate pixel positions in an image file. The horizontal direction is the U-axis, and the vertical direction is the V-axis. Through this two-dimensional UV coordinate system, any pixel on the image can be located. UV coordinates are often used to sample textures and map them onto the surface of a model. The origin of the UV coordinates is usually located at the lower left corner, but the position of the origin may vary in different systems. In UV coordinates, the value range of any texture coordinate in the horizontal or vertical direction satisfies [0, 1].

[0049] UV coordinates differ from the XYZ coordinate system in spatial coordinates. UV coordinates can be applied to two-dimensional font textures, while XYZ coordinates can be used to indicate position and orientation in three-dimensional space.

[0050] 4. Other terms

[0051] In the embodiments of this application, terms such as "first" and "second" are used to distinguish identical or similar items with substantially the same function and purpose. For example, "first chip" and "second chip" are used only to distinguish different chips and do not limit their order of execution. Those skilled in the art will understand that terms such as "first" and "second" do not limit the quantity or execution order, and that "first" and "second" do not necessarily imply that they are different.

[0052] It should be noted that, in the embodiments of this application, the terms "exemplary" or "for example" are used to indicate examples, illustrations, or descriptions. Any embodiment or design scheme described as "exemplary" or "for example" in this application should not be construed as being more preferred or advantageous than other embodiments or design schemes. Specifically, the use of terms such as "exemplary" or "for example" is intended to present the relevant concepts in a specific manner.

[0053] In this application embodiment, "at least one" refers to one or more, and "more than one" refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one of the following" or similar expressions refer 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 represent: a, b, c, ab, a--c, bc, or abc, where a, b, and c can be single or multiple.

[0054] 5. Electronic equipment

[0055] The electronic devices in this application embodiment may include handheld devices with image processing capabilities, vehicle-mounted devices, etc. For example, some electronic devices are: mobile phones, tablet computers, PDAs, laptops, mobile internet devices (MIDs), wearable devices, virtual reality (VR) devices, augmented reality (AR) devices, wireless terminals in industrial control, wireless terminals in self-driving vehicles, handheld devices with wireless communication capabilities, computing devices or other processing devices connected to a wireless modem, vehicle-mounted devices, wearable devices, terminal devices in 5G networks, or terminal devices in future evolved public land mobile networks (PLMNs), etc., and this application embodiment is not limited to these.

[0056] By way of example and not limitation, in this embodiment, the electronic device may also be a wearable device. Wearable devices, also known as wearable smart devices, are a general term for devices that are intelligently designed and developed using wearable technology, such as glasses, gloves, watches, clothing, and shoes.

[0057] The electronic devices in the embodiments of this application may also be referred to as: terminal equipment, user equipment (UE), mobile station (MS), mobile terminal (MT), access terminal, user unit, user station, mobile station, mobile station, remote station, remote terminal, mobile device, user terminal, terminal, wireless communication equipment, user agent, or user device, etc.

[0058] The following is combined with Figure 1 The scenario shown is an example illustrating a situation where character display errors occur; this example does not constitute a limitation on the embodiments of this application. Figure 1 In the corresponding embodiment, a game application is used as an example to illustrate the situation of abnormal character display.

[0059] Typically, when a user enters their user ID in a game application, the electronic device can display that user ID on the interface. For example, a game application might display something like... Figure 1 The game settlement interface shown may include multiple user IDs pre-entered by the user, such as user ID101 and user ID102.

[0060] Some users can inject special characters into their user IDs using methods such as memory injection. These special characters can correspond to extremely long glyphs, causing anomalies in the display of user IDs by the game application.

[0061] For example, when a user inputs special characters, the electronic device can use a font library to recognize the special characters as glyphs, draw the glyphs into a font texture, and map the glyphs in the font texture to the display interface according to a preset size, thereby realizing the display of special characters.

[0062] However, special characters can correspond to extra-long glyphs. Extra-long glyphs are larger than the preset size. When the electronic device maps the glyphs in the font texture to the display interface according to the preset size, there may be situations where part of the extra-long glyph is displayed as a single glyph on the interface, and another part of the extra-long glyph and part of the glyph located after the extra-long glyph are displayed as a single glyph on the interface. In this case, both glyphs displayed on the interface are difficult for the user to recognize, affecting the user experience.

[0063] For example, when an electronic device can display the characters indicated by the arrow, it can display each character according to a preset size. In this case, there may be situations where a portion of an extra-long character and the character following the extra-long character are displayed as a single character on the interface, such as the character in the dashed box 1001. The preset size can be the size corresponding to a rectangular area (such as a square area).

[0064] Understandable Figure 1 The scenarios provided are merely examples and are not intended to limit the embodiments of this application.

[0065] In view of this, embodiments of this application provide an image processing method that enables electronic devices to identify and crop abnormal characters so that some characters in the abnormal characters, as well as characters located after the abnormal characters, can be displayed normally on the interface, reducing interface display abnormalities caused by abnormal characters and improving the user experience.

[0066] To better understand the embodiments of this application, the structure of the electronic device according to the embodiments of this application is described below. For example, Figure 2 This is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of this application.

[0067] The electronic device may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, a headphone jack 170D, a sensor module 180, buttons 190, an indicator 192, a camera 193, and a display screen 194, etc.

[0068] In this embodiment, the sensor module 180 may include one or more of the following: proximity light sensor, ambient light sensor, touch sensor, pressure sensor, gyroscope sensor, barometric pressure sensor, magnetic sensor, accelerometer, distance sensor, fingerprint sensor, temperature sensor, or bone conduction sensor, etc. Figure 2 (not shown in the text), and this application does not impose specific limitations on this aspect in the embodiments.

[0069] It is understood that the structures illustrated in the embodiments of this application do not constitute a specific limitation on the electronic device. In other embodiments of this application, the electronic device may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

[0070] The processor 210 may include one or more processing units, such as an application processor (AP), a modem processor, a central processing unit (CPU), a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural network processing unit (NPU). These different processing units may be independent devices or integrated into one or more processors.

[0071] The processor 110 can perform steps such as size recognition of font texture, recognition and detection of abnormal glyphs in font texture in the image processing method.

[0072] USB interface 130 is an interface that conforms to the USB standard specification, specifically it can be a Mini USB interface, Micro USB interface, USB Type C interface, etc.

[0073] The charging management module 140 is used to receive charging input from the charger. The power management module 141 is used to connect the charging management module 140 and the processor 110.

[0074] The wireless communication function of electronic devices can be realized through antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modem processor and baseband processor, etc.

[0075] Electronic devices utilize GPUs, displays (194), and application processors to achieve display functions. The GPU is a microprocessor for image processing, connecting the displays (194) and the application processor.

[0076] Display screen 194 is used to display images and videos, for example, display screen 194 can display such as Figure 1 The application interface is shown. The GPU is used to perform mathematical and geometric calculations and for graphics rendering. The processor 210 may include one or more GPUs, which execute program instructions to generate or modify display information.

[0077] Electronic devices can perform shooting functions through ISP, camera 193, video codec, GPU, display 194, and application processor. Camera 193 is used to capture still images or videos.

[0078] The external storage interface 120 can be used to connect an external storage card.

[0079] Internal memory 121 can be used to store computer executable program code, which includes instructions.

[0080] Electronic devices can implement audio functions such as music playback and recording through audio modules 170, speakers 170A, receivers 170B, microphones 170C, headphone jacks 170D, and application processors.

[0081] A touch sensor can be installed on the display screen 194, and the touch sensor and the display screen 194 together form a touch screen, or "touchscreen". The touch sensor can detect the user's touch operation on the display screen 194.

[0082] Button 190 includes the power button, volume buttons, etc.

[0083] The software systems of electronic devices can adopt layered architecture, event-driven architecture, microkernel architecture, microservice architecture, or cloud architecture, etc., which will not be elaborated here.

[0084] For example, Figure 3 This is a schematic diagram of the software structure of an electronic device provided in an embodiment of this application. Figure 3 As shown, the layered architecture divides the software into several layers, each with a clear role and function. Layers communicate with each other through software interfaces.

[0085] In some embodiments, the Android system is divided into multiple layers, from top to bottom: application (APP) layer, application framework layer, library, and driver layer, etc. This application embodiment does not limit this.

[0086] The application layer may include a series of application packages. The application layer may include one or more of the following: game applications and other applications, etc., which are not limited in this embodiment.

[0087] Game applications may include: a game font library, which can be used to recognize certain characters.

[0088] The application framework layer provides application programming interfaces (APIs) and programming frameworks for applications in the application layer.

[0089] The application framework layer includes some predefined interfaces. It may include one or more of the following: an abnormal glyph filtering module and an Android font library, etc.

[0090] The abnormal character shape filtering module can be used to adjust the priority of font libraries in the Android font library and recognize input characters based on font libraries with different priorities.

[0091] Android font libraries can be used to recognize all characters. For example, electronic devices can use game font libraries to initially recognize input characters, and then use Android font libraries to further recognize characters that cannot be recognized in the game font library, thus obtaining the recognition result. In short, to enable character display, Android font libraries can recognize all characters, allowing the recognition results to be displayed on the interface.

[0092] In possible implementations, FWK may also include a display compositor, window manager, content provider, resource manager, view system, or notification manager, etc. Figure 3 (Not shown in the image).

[0093] Libraries can provide various services to higher layers (such as application framework layers). For example, a library may include: an embedded graphics library (libEGL for short), a font texture anomaly detection module, an anomaly glyph clipping module, and an image synthesizer (surfaceflinger), etc.

[0094] libEGL can be used for graphics rendering and image processing in the system, as well as for drawing font textures.

[0095] libEGL may include a main scene drawing module. This module is used to draw the main scene in the application. The main scene can be understood as the scene corresponding to the visuals in the display interface, excluding UI images. For example, in a game application, the main scene can be understood as the game screen. This embodiment does not specifically limit the meaning of the main scene.

[0096] The font texture anomaly detection module can be used to detect abnormal font textures, such as determining whether a font texture exceeds a preset size of 1.

[0097] The abnormal glyph clipping module can be used to identify and clip abnormal glyphs in the font texture. The method for identifying abnormal glyphs can be found in the description in S405, and will not be repeated here.

[0098] Image compositors can be used for refresh rate control, image compositing control, and more. For example, SurfaceFlinger can make decisions to assign compositing tasks to a hardware compositor (HWC) or a GPU.

[0099] The driver layer is the layer between hardware and software. It drives the hardware to function. The driver layer can include one or more of the following: GPU driver, display driver, etc. A display driver drives the screen to display images. A GPU driver drives the GPU to perform tasks such as image compositing.

[0100] It is understood that the embodiments of this application do not specifically limit the software layers involved in the software architecture, the modules contained in the software layers, and the functions of the modules.

[0101] Combination Figure 3In a corresponding embodiment, when a game application is rendering images, the electronic device can use a game font library to recognize some characters in the input characters, and then use an Android font library to recognize another part of the input characters to obtain glyphs. The electronic device then renders a font texture based on the glyphs, and finally obtains the target image by combining the font texture, user interface (UI) image, and main scene.

[0102] Among them, there may be special characters in the input characters. These special characters correspond to extra-long glyphs. When the electronic device crops the glyphs in the font texture according to the preset size, there may be a situation where part of the extra-long glyph is displayed as a glyph on the interface, and another part of the extra-long glyph and part of the glyph located after the extra-long glyph are displayed as a glyph on the interface. In this case, it is difficult for the user to recognize the two glyphs displayed on the interface.

[0103] Combination Figure 1 as well as Figure 3 The following describes the technical solutions of this application and how they solve the aforementioned technical problems using specific embodiments. These specific embodiments can be implemented independently or in combination with each other. Similar or identical concepts or processes may not be described again in some embodiments.

[0104] Figure 4 This is a schematic flowchart illustrating an image processing method provided in an embodiment of this application. Figure 4 In the corresponding embodiments, the example of using a game application to implement the image processing method and a game font library set in the game application is used for illustration. This example does not constitute a limitation on the embodiments of this application.

[0105] like Figure 4 As shown, the image processing method may include the following steps:

[0106] S401. Upon receiving instruction 1, the game font library is used to parse a portion of the characters in the initial characters to obtain character 1.

[0107] Command 1 can be used to instruct the splash screen to be drawn or refreshed. Command 1 can be triggered periodically.

[0108] Initial characters can be understood as characters pre-entered by the user into the game application, such as a user ID. For example, the user can input initial characters into the game application through methods such as memory injection. In essence, memory injection can be understood as a method of inputting initial characters into the application by modifying memory.

[0109] For example, in response to instruction 1, the electronic device can acquire the initial character and retrieve the game font library from the game application. Using the character mapping table in the game font library, it can recognize all characters in the initial character to obtain character 1. It is understandable that if the game font library cannot recognize all characters in the initial character, character 1 may include: glyph 0 recognized based on the game font library, and some glyphs of character 0 that cannot be recognized.

[0110] S402. Based on the first priority in the Android font library, use font library 1 in the Android font library to parse the remaining characters in character 1 to obtain glyph 1.

[0111] An Android font library can include multiple font libraries. The first priority can be understood as the priority of character recognition based on a specific font library within the Android font library. For example, an Android font library may include font library 1, font library 2, and font library 3, etc. The first priority could be: font library 1 has a higher priority than font library 2, font library 2 has a higher priority than font library 3, and so on. The Android font library can be located in the system / fonts directory, and the priority can be set in a separate XML file.

[0112] For example, an electronic device can parse the remaining characters (i.e., character 0) in character 1 based on the highest-priority font library 1 to obtain glyph 1. Glyph 1 can then include glyph 0 recognized based on the game font library and glyph 2 recognized based on font library 1. It can be understood that, to achieve character recognition, the Android font library can recognize all characters. While the game font library can only recognize some characters, the Android font library can recognize the remaining characters to ensure that the characters can be displayed on the interface.

[0113] S403, Draw font texture1 based on glyph 1.

[0114] Font texture1 can be used to represent text display in the interface, and font texture1 can include glyphs. For example, if the interface contains glyphs, each interface can correspond to one font texture.

[0115] The process of drawing a font texture may include: binding a texture object, setting texture parameters, setting the texture coordinates of the vertices at the location of the glyph, setting the position of the lower left vertex of the glyph in the font texture, setting fonttexture variables, and setting the width and height of the glyph.

[0116] Binding a texture object can be used to set the correspondence between the font texture (including the glyphs in the font texture) and the screen where the main scene is located. For example, you can bind a texture object by calling glBindTexture().

[0117] Setting texture parameters can be used to set the transparency, size, and display position of each glyph in the font texture. For example, texture parameters can be set by calling gltexParameteri().

[0118] The texture coordinates of the vertices where the glyph is located can include the coordinates of the glyph at its four vertices, including the texture coordinates of the vertex at the top left corner, the vertex at the bottom left corner, the vertex at the top right corner, and the vertex at the bottom right corner.

[0119] Typically, the texture coordinates of the vertex where the glyph is located can also include the coordinates of the glyph at two vertices, such as the texture coordinates of the vertex at the bottom left corner and the vertex at the top right corner. Texture coordinates can be understood as UV coordinates. For example, texture coordinates can be set by calling glTexCoord2(u,v).

[0120] Set the position of the bottom left vertex of the glyph in the font texture. For example, you can set the position of the glyph in the font texture by calling glVertex3(x,y,z). In a two-dimensional font texture, z can be 0.

[0121] The XYZ coordinates of a glyph are related to the size of the font texture. For example, if the font texture is 4096*4096, when an electronic device determines that the bottom left corner of a glyph is located at (2000, 2000, 0), it can determine the exact position of the glyph in the font texture.

[0122] It can be understood that in a font texture, there is a correspondence between the (u,v) coordinates of any glyph and its corresponding (x,y,z) coordinates. Alternatively, it can be understood that electronic devices can locate the position of a glyph within the font texture using either UV coordinates or XYZ coordinates.

[0123] Setting the `font texture` variable allows you to configure parameters such as the rotation direction and scaling of each glyph within the font texture. For example, you can use the `glUniform()` function to set how the font texture changes.

[0124] The width and height of a character can be set using glGetTexLevelParameteriv(), or calculated using the character's UV coordinates.

[0125] S404. Identify whether font texture1 exceeds the preset size 1.

[0126] The preset size 1 can be understood as the maximum size of the font texture. It's understood that if at least one abnormal glyph exists in the font texture, the font texture's size will exceed the preset size 1. Therefore, electronic devices can use the preset size 1 to detect the presence of abnormal glyphs in the font texture.

[0127] For example, if the preset size 1 is 4096*4096, the electronic device can detect the XYZ coordinates of each glyph in font texture 1. If the X-axis (or Y-axis) value of any glyph in the XYZ coordinates is greater than 4096, it can be determined that font texture 1 exceeds the preset size 1.

[0128] If it is determined that font texture1 exceeds the preset size 1, execute S405-S406 or execute S408; if it is determined that font texture1 does not exceed the preset size 1, execute S407.

[0129] S405. Identify abnormal glyphs in font texture1 and crop them according to the preset size 2 to obtain font texture2.

[0130] Abnormal glyphs can be the extra-long glyphs described in the embodiments of this application.

[0131] In one implementation, abnormal glyphs can be understood as glyphs with conflicting UV coordinates.

[0132] For example, in font texture1, which includes adjacent glyphs A and B, glyph A can be called an abnormal glyph when the texture coordinate of the lower right corner vertex of glyph A (or simply coordinate 1) is greater than the texture coordinate of the lower left corner vertex of glyph B (or simply coordinate 2).

[0133] In this context, coordinate 1 can be (u1, v1), and coordinate 2 can be (u2, v2). When glyphs A and B are arranged horizontally (or horizontally), v1 and v2 are the same, and coordinate 1 being greater than coordinate 2 can be understood as u1 being greater than u2. That is, when glyphs A and B are arranged horizontally, the magnitude of the coordinates can be understood as the magnitude of the horizontal coordinate. See details... Figure 5 The description in the text.

[0134] Alternatively, electronic devices can determine whether glyph A has an anomaly based on the relationship between the texture coordinates of the top right corner vertex of glyph A (or simply coordinate 3, which can be (u3, v3)) and the texture coordinates of the top left corner vertex of glyph B (or simply coordinate 4, which can be (u4, v4)). For example, when glyphs A and B are arranged horizontally, v3 and v4 are the same, and coordinate 3 being greater than coordinate 4 can be understood as u3 being greater than u4. That is, when glyphs A and B are arranged horizontally, the size of the coordinates can be understood as the size of the horizontal coordinate.

[0135] It should be noted that when the electronic device identifies abnormal glyphs in font texture 1, it can perform glyph recognition according to pre-set rules. For example, for text glyphs or other glyphs, the electronic device can identify them using a square area with a side length of 1, or for number glyphs, it can identify them using a rectangular area with a long side of length 2 and a short side of length 3, etc. Other glyphs may include glyphs containing symbols, etc.

[0136] like Figure 5 As shown, glyph A can be a glyph defined by a solid line area, and glyph B can be a glyph defined by a dashed line area. Glyph A and glyph B are arranged adjacent to each other.

[0137] When an electronic device recognizes glyphs A and B, it can recognize them using a square area with a side length of 1. In this case, three scenarios may occur. It is understood that the recognition methods for glyphs A and B are merely examples. When glyphs A and B are of different types, the electronic device can also perform glyph recognition in other ways. This application does not limit this approach.

[0138] Case 1: When coordinate 1 equals coordinate 2, both glyphs A and B can be recognized by the electronic device, and both glyphs are displayed normally.

[0139] Scenario 2: When coordinate 1 is greater than coordinate 2, the longer side of character A is greater than length 1. When the electronic device recognizes the character, character A has an excessively long size, and coordinate 1 is greater than coordinate 2. When the electronic device displays the character, it may display a portion of character A as character A (such as the black area) and a portion of character A as character B (such as the area with diagonal lines). In this case, both characters are displayed abnormally, and the user cannot accurately recognize the true meaning of the characters.

[0140] In fact, in case 2, glyph A is an extra-long glyph, and glyph B is located after glyph A. Therefore, glyph B is not an extra-long glyph.

[0141] Case 3: When coordinate 1 is less than coordinate 2, the length of the longer side of character A is less than 1. In this case, both characters are displayed normally.

[0142] Therefore, in case 2, the electronic device can trim the character A according to the preset size 2 so that the length of the long side of the character A is equal to the length 1. In this way, even if the trimmed part of the character A cannot be displayed normally, the character B and the non-abnormal characters after the character B can be displayed in the interface in a normal form.

[0143] In the case of detecting and cropping abnormal characters, the preset size 2 can be the size of a square, and the side length of the square can be the length of the shorter side of the abnormal character.

[0144] Optionally, when glyph A and glyph B are arranged perpendicularly (or vertically), the electronic device can determine whether glyph A has an anomaly based on the relationship between the texture coordinates of the lower left corner vertex of glyph A (or simply coordinate 5, which can be (u5, v5)) and the texture coordinates of the upper left corner vertex of glyph B (or simply coordinate 6, which can be (u6, v6)). For example, if u5 and u6 are the same, and coordinate 5 is less than coordinate 6, it can be understood that v5 is less than v6.

[0145] Alternatively, when glyph A and glyph B are arranged perpendicularly (or vertically), the electronic device can determine whether glyph A has an anomaly based on the relationship between the texture coordinates of the bottom right vertex of glyph A (or simply coordinate 7, which can be (u7, v7)) and the texture coordinates of the top right vertex of glyph B (or simply coordinate 8, which can be (u8, v8)). For example, if u7 and u8 are the same, and coordinate 7 is less than coordinate 8, it can be understood that v7 is less than v8.

[0146] It is understood that the embodiments of this application do not limit the arrangement of the characters.

[0147] In another implementation, an abnormal glyph can be understood as a glyph whose rectangular region contains one side (e.g., width) exceeding length 4, while the other side (e.g., height) does not exceed length 4. Correspondingly, a non-abnormal glyph can be understood as a glyph whose rectangular region contains two sides whose lengths do not exceed length 4. Here, length 4 can also be referred to as the first value.

[0148] It should be noted that there may be no special character shapes in the rectangular area whose two sides both exceed the length of 4. In such cases, this special character shape can be temporarily ignored.

[0149] For example, abnormal glyphs are often excessively long glyphs. The area containing an excessively long glyph is typically a rectangular region. Electronic devices can determine whether an abnormal glyph has been detected by detecting this rectangular region. An abnormal glyph is defined as one side of the rectangular region containing the glyph exceeding a length of 4, while the other side does not. If both sides of the rectangular region containing the glyph (such as the width and height of the rectangle) exceed a length of 4, then the glyph may not be considered abnormal.

[0150] It is understandable that regardless of the arrangement of the characters or the type of characters, electronic devices can identify abnormal characters by detecting the rectangular area where the characters are located.

[0151] It is understood that the embodiments of this application do not specifically limit the detection method of abnormal character shapes.

[0152] For example, electronic devices can set the cropping rectangle area by calling glScissor(), thereby cropping abnormal glyphs in fonttexture1.

[0153] S406, based on font texture2, UI Figure 1 The target image 2 is obtained by combining the main scene image with the target image 2.

[0154] For example, UI Figure 1 This can include elements such as UI control icons. In game applications, the main scene can be displayed as the game screen.

[0155] S407, based on font texture1, UI Figure 1 The target image 1 is obtained by combining the main scene image with the target image 2.

[0156] Understandably, if font texture1 does not exceed the preset size 1, the electronic device can draw a UI image based on font texture1. The drawing process and the process of compositing the target image 1 can be similar to those described in S406, and will not be repeated here.

[0157] S408, Adjust the first priority to the second priority.

[0158] For example, if the electronic device identifies abnormal character shapes based on steps S404 and S405, it can determine that font library 1 cannot accurately recognize all characters. In this case, the electronic device can lower the priority of font library 1, obtaining the priority of each font library, i.e., the second priority. Subsequently, when the electronic device receives instruction 1 again, it can utilize the higher-priority font library in the Android font library to parse the characters, thereby improving the accuracy of character shape recognition.

[0159] Optionally, if the electronic device can identify special characters causing abnormal glyphs based on other font libraries in the Android font library and / or a font library obtained through online updates (or simply a new font library), the electronic device can then identify the special characters based on the new font library to obtain normal glyphs. The electronic device can then save the correspondence between the special characters and the normal glyphs. This way, when the electronic device detects a special character again, it can obtain the normal glyph without having to perform the identification process again. For example, the correspondence between special characters and normal glyphs can be stored in the abnormal glyph filtering module. After S401, the electronic device can detect some special characters in the initial characters based on this correspondence. If a glyph corresponding to a special character is detected, the electronic device can execute S402 to continue identifying other characters in the initial characters.

[0160] In this scenario, the font texture containing the normal font does not exceed the preset size of 1, and the normal font does not require the cropping steps described in S405.

[0161] based on Figure 4 The description in [the document], and some of the glyphs in font texture1 can be found in [the document]. Figure 6A As shown. In electronic devices based on Figure 4 The corresponding embodiment, after recognizing and cropping some of the glyphs in font texture1, can obtain the following: Figure 6B The font texture2 shown here demonstrates that after character recognition and cropping, font texture2 can include more characters that users can recognize, thus improving the accuracy of character recognition.

[0162] For example, see the dashed frame 6001 before and the dashed frame 6002 after the character is clipped.

[0163] The dashed box 6001 can display glyphs recognized by the electronic device based on the internally set font library. Abnormal glyphs may cause font texture1 to exceed the preset size 1.

[0164] The dashed box 6002 can display more characters that users can recognize. Electronic devices can be based on... Figure 6B The font texture2 in the text is displayed as follows: Figure 6C The interface shown, in which the font displayed within the dashed box 6002 can be compared with... Figure 6B The content within the dashed box 6002 is consistent. Thus, electronic devices can be based on... Figure 4 The system identifies and trims abnormal characters, reducing display issues caused by excessively long abnormal characters. This allows some characters within the abnormal characters to be displayed on the screen, and characters following the abnormal characters after trimming can also be displayed normally.

[0165] It should be noted that, Figure 6A Abnormal glyphs in font texture1 may cause font texture1 to be larger than the preset size 1. After abnormal glyphs are identified and cropped, font texture2 can be smaller than or equal to the preset size 1. Figure 6A as well as Figure 6B The content displayed and the size of the font texture are merely examples and do not constitute a limitation on the embodiments of this application.

[0166] exist Figure 4 Based on this, the embodiments of this application illustrate the module interaction process for implementing the image processing method. Figure 7 This is a schematic diagram illustrating the module interaction of an image processing method provided in an embodiment of this application. Figure 7 In a corresponding embodiment, the electronic device may include:

[0167] S701. When the game application receives instruction 1, the game application parses part of the characters in the initial characters through the game font library to obtain character 1.

[0168] The meanings of instruction 1, the initial character, and character 1 can be found in the description in S401.

[0169] S702, The game application sends instruction 2 to the Android font library.

[0170] Command 2 is used to instruct the highest priority font library to be retrieved from the Android font library, such as font library 1.

[0171] S703, the game application obtains font library 1 from the Android font library.

[0172] S704. The game application uses font library 1 in the Android font library to parse the remaining characters in character 2 and obtain glyph 1.

[0173] The meanings of First Priority, Font Library 1, Character 2, and Glyph 1 can be found in the description in S402.

[0174] S705 and libEGL obtain glyph 1 from the game application.

[0175] S706 and libEGL draw font texture1 based on glyph1.

[0176] The process of libEGL drawing font texture1 can be found in the description in S403.

[0177] S707, the font texture anomaly detection module obtains font texture1 from libEGL.

[0178] S708, the font texture anomaly detection module identifies whether font texture1 exceeds the preset size 1.

[0179] If the font texture anomaly detection module detects that font texture1 exceeds the preset size 1, execute the steps shown in S709-S713 or S714. If the font texture anomaly detection module detects that font texture1 does not exceed the preset size 1, execute the steps shown in S715-S716.

[0180] The meaning of preset size 1 can be found in the description in S404.

[0181] S709, the font texture anomaly detection module identifies abnormal font shapes in font texture1.

[0182] The meaning of abnormal glyphs and the methods for identifying abnormal glyphs can be found in the description in S405.

[0183] Optionally, if the electronic device determines, based on S708 and S709, that font texture1 does not exceed the preset size 1 and no abnormal glyphs are identified, the electronic device can store the correspondence between glyphs and characters identified by font library 1 into the abnormal glyph filtering module so that the electronic device can quickly identify the glyphs in the future.

[0184] S710, the abnormal font clipping module obtains font texture1 and abnormal fonts from the font texture anomaly detection module.

[0185] S711, the abnormal character shape trimming module trims abnormal characters according to the standard size to obtain fonttexture2.

[0186] For the standard size, the meaning of font texture2, and the method for cropping abnormal fonts, please refer to the description in S405.

[0187] S712, The main scene drawing module obtains font texture2 from the abnormal font clipping module.

[0188] S713, Main scene rendering module based on font texture2, UI Figure 1 The target image 2 is obtained by combining the main scene image with the target image 2.

[0189] S714, The main scene drawing module obtains font texture1 from the font texture anomaly detection module.

[0190] S715, main scene rendering module based on font texture1, UI Figure 1 The target image 1 is obtained by combining the main scene image with the target image 2.

[0191] Based on this, a font texture detection module and an abnormal character shape clipping module can be added to the electronic device. The electronic device can use the font texture detection module to detect whether the font texture exceeds the normal size (i.e., the preset size 1) and to identify abnormal characters. The abnormal character shape clipping module can clip the abnormal characters, and the characters after the clipped abnormal characters can be displayed normally on the interface.

[0192] Based on the above Figures 4-7 The description in the text, Figure 8 This is a schematic flowchart illustrating another image processing method provided in an embodiment of this application. Figure 8 As shown, the image processing method may include the following steps:

[0193] S801. When the presence of the first character is detected, the first character is identified based on the first font library to obtain the first font texture.

[0194] The first font texture includes: a first glyph and a second glyph. The first glyph corresponds to a first rectangular area, and the second glyph corresponds to a second rectangular area. The first side length in the first rectangular area is greater than a first value, and the second side length in the first rectangular area is less than or equal to the first value. The third side length in the second rectangular area is less than or equal to the first value, and the fourth side length in the second rectangular area is less than or equal to the first value.

[0195] The first character can be a user-input character, such as the initial character described in the embodiments of this application. The first font library can be font library 1 described in the embodiments of this application, and the first font texture can be fonttexture1 described in the embodiments of this application.

[0196] When the first glyph is glyph A and the second glyph is glyph B, glyph A can be the extra-long glyph (or abnormal glyph) described in the embodiments of this application.

[0197] In one implementation, when the first glyph is an abnormal glyph, there is a situation in the rectangular region containing the abnormal glyph where one side length (e.g., the first side length) exceeds the length of 4, while the other side length (e.g., the second side length) does not exceed the length of 4. The length of 4 can be referred to as the first value. In the rectangular region containing the second glyph, there will be a situation where two side lengths (e.g., the third and fourth side lengths) do not exceed the length of 4.

[0198] In another implementation, the electronic device can also determine whether glyph A is an abnormal glyph by comparing the vertex coordinates in glyph A and glyph B, as described in S405.

[0199] S802. Cut the first glyph to obtain the second font texture.

[0200] The second font texture includes a third glyph and a second glyph. The third glyph corresponds to a third rectangular area. The fifth side length in the third rectangular area is less than or equal to the first value. The fifth side length is the side length obtained after cropping the first side length. The third glyph is the glyph obtained after cropping the first glyph.

[0201] For example, an electronic device can trim the length of the first side to be the same as the value of the second side based on the value of the second side to obtain a third glyph. The trimmed font texture is the second font texture, such as font texture2 described in the embodiments of this application.

[0202] S803: Draw the first image based on the second font texture and display the first image.

[0203] For example, an electronic device can draw a first image based on a second font texture, a UI image, and a main scene image. The first image can be the target image 1 described in the embodiments of this application.

[0204] Based on this, electronic devices can identify and crop abnormal glyphs in font textures, so that some glyphs in the abnormal glyphs, as well as the glyphs behind the abnormal glyphs, can be displayed normally on the interface, reducing the interface display abnormalities caused by abnormal glyphs and improving the user experience.

[0205] It should be noted that the interface provided in this application embodiment is only an example and does not constitute a limitation on the embodiments of this application.

[0206] It should be noted that the module names involved in the embodiments of this application can all be defined as other names, as long as they can achieve the function of each module, and no specific restrictions are placed on the module names.

[0207] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in the embodiments of this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and corresponding operation entry points are provided for users to choose to authorize or refuse.

[0208] The image processing method of the present application embodiments has been described above. The apparatus for performing the above method provided in the present application embodiments is described below. Those skilled in the art will understand that the methods and apparatus can be combined with and referenced by each other, and the related apparatus provided in the present application embodiments can perform the steps in the above list sorting method.

[0209] Figure 9 This is a schematic diagram of the hardware structure of another electronic device provided in an embodiment of this application.

[0210] The electronic device includes a processor 901, a communication line 904, and at least one communication interface. Figure 9 The example provided uses communication interface 903 as an example.

[0211] The processor 901 may be a general-purpose CPU, a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits used to control the execution of the program of the present application.

[0212] Communication line 904 may include circuitry for transmitting information between the aforementioned components.

[0213] The communication interface 903 uses any transceiver-like device for communicating with other devices or communication networks, such as Ethernet, wireless local area networks (WLAN), etc.

[0214] Possibly, the electronic device may also include a memory 902.

[0215] The memory 902 may be a read-only memory (ROM) or other type of static storage device capable of storing static information and instructions, random access memory (RAM) or other type of dynamic storage device capable of storing information and instructions, or electrically erasable programmable read-only memory (EEPROM), compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical discs, laser discs, optical discs, digital versatile optical discs, Blu-ray discs, etc.), magnetic disk storage media or other magnetic storage devices, or any other medium capable of carrying or storing desired program code in the form of instructions or data structures and accessible by a computer, but not limited thereto. The memory may exist independently and be connected to the processor via communication line 904. The memory may also be integrated with the processor.

[0216] The memory 902 stores computer execution instructions for implementing the scheme of this application, and its execution is controlled by the processor 901. The processor 901 executes the computer execution instructions stored in the memory 902 to implement the method provided in the embodiments of this application.

[0217] It is possible that the computer execution instructions in the embodiments of this application may also be referred to as application code, and the embodiments of this application do not specifically limit this.

[0218] In a specific implementation, as one example, the processor 901 may include one or more CPUs, for example... Figure 9 CPU0 and CPU1 in the CPU.

[0219] In a specific implementation, as one example, an electronic device may include multiple processors, for example... Figure 9 Processors 901 and 905 are mentioned. Each of these processors can be a single-core (single-CPU) processor or a multi-core (multi-CPU) processor. A processor here can refer to one or more devices, circuits, and / or processing cores used to process data (such as computer program instructions).

[0220] The image processing method provided in this application can be applied to electronic devices with communication functions. The electronic devices include terminal devices, and the specific device form of the terminal devices can be referred to the above-described related descriptions, which will not be repeated here.

[0221] This application provides a terminal device, which includes a processor and a memory; the memory stores computer execution instructions; the processor executes the computer execution instructions stored in the memory, causing the terminal device to perform the above-described method.

[0222] This application provides a chip. The chip includes a processor, which is used to call a computer program in memory to execute the technical solutions in the above embodiments. Its implementation principle and technical effects are similar to those in the related embodiments described above, and will not be repeated here.

[0223] This application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program. When the computer program is executed by a processor, it implements the methods described above. The methods described in the above embodiments can be implemented wholly or partially by software, hardware, firmware, or any combination thereof. If implemented in software, the functionality can be stored as one or more instructions or code on or transmitted over the computer-readable medium. The computer-readable medium can include computer storage media and communication media, and can also include any medium that can transfer a computer program from one place to another. The storage medium can be any target medium accessible by a computer.

[0224] In one possible implementation, a computer-readable medium may include RAM, ROM, compact disc read-only memory (CD-ROM) or other optical disc storage, disk storage or other magnetic storage devices, or any other medium targeted to carry or to store the required program code in the form of instructions or data structures, and accessible by a computer. Furthermore, any connection is appropriately referred to as a computer-readable medium. For example, if software is transmitted from a website, server, or other remote source using coaxial cable, fiber optic cable, twisted pair, DSL, or wireless technologies such as infrared, radio, and microwave, then coaxial cable, fiber optic cable, twisted pair, DSL, or wireless technologies such as infrared, radio, and microwave are included in the definition of medium. As used herein, disks and optical discs include optical discs, laser discs, optical discs, Digital Versatile Discs (DVDs), floppy disks, and Blu-ray discs, where disks typically reproduce data magnetically, while optical discs optically reproduce data using lasers. Combinations of the above should also be included within the scope of computer-readable media.

[0225] This application provides a computer program product, which includes a computer program that, when run, causes a computer to perform the above-described method.

[0226] This application describes embodiments of methods, apparatus (systems), and computer program products according to embodiments of this application with reference to flowchart illustrations and / or block diagrams. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processing unit of a general-purpose computer, special-purpose computer, embedded processor, or other programmable device to produce a machine, such that the instructions, which execute via the processing unit of the computer or other programmable data processing device, generate instructions for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0227] The above specific embodiments further illustrate the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above are merely specific embodiments of the present invention and are not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made on the basis of the technical solution of the present invention should be included within the scope of protection of the present invention.

Claims

1. An image processing method, characterized in that, Applied to electronic devices, the method includes: When the presence of a first character is detected, the first character is identified based on a first font library to obtain a first font texture. The first font texture includes a first glyph and a second glyph. The first glyph corresponds to a first rectangular area, and the second glyph corresponds to a second rectangular area. The first side length of the first rectangular area is greater than a first value, and the second side length of the first rectangular area is less than or equal to the first value. The third side length of the second rectangular area is less than or equal to the first value, and the fourth side length of the second rectangular area is less than or equal to the first value. The first glyph is cropped to obtain a second font texture. The second font texture includes a third glyph and the second glyph. The third glyph corresponds to a third rectangular area. The fifth side length in the third rectangular area is less than or equal to the first value. The fifth side length is the side length obtained after cropping the first side length. A first image is drawn based on the second font texture, and the first image is displayed.

2. The method according to claim 1, characterized in that, The second glyph is located after the first glyph. The texture coordinates of the first vertex of the first glyph are the first coordinates, and the texture coordinates of the second vertex of the second glyph are the second coordinates. The cropping of the first glyph includes: The first glyph is cropped based on the relationship between the first coordinate and the second coordinate.

3. The method according to claim 2, characterized in that, When the first and second glyphs are arranged horizontally, the first vertex is the bottom right vertex and the second vertex is the bottom left vertex, or the first vertex is the top right vertex and the second vertex is the top left vertex, and the x-coordinate of the first coordinate is greater than the x-coordinate of the second coordinate.

4. The method according to claim 2, characterized in that, When the first and second glyphs are arranged vertically, the first vertex is the bottom left vertex and the second vertex is the top left vertex, or the first vertex is the bottom right vertex and the second vertex is the top right vertex, and the ordinate of the first coordinate is less than the ordinate of the second coordinate.

5. The method according to any one of claims 1-4, characterized in that, The first glyph is cropped, including: If the first font texture exceeds the first preset size, the first glyph is cropped.

6. The method according to any one of claims 1-5, characterized in that, The electronic device also includes: a second font library. Recognizing the first character based on the first font library includes: recognizing the first character based on the first font library when the priority of the first font library is greater than the priority of the second font library; After cropping the first glyph, the method further includes: reducing the priority of the first font library.

7. The method according to any one of claims 1-6, characterized in that, The value of the fifth side length is equal to the value of the second side length, and the step of cropping the first glyph includes: Based on the value of the second side length, the first side length of the first character is trimmed to the fifth side length.

8. The method according to any one of claims 1-7, characterized in that, The detection of the presence of the first character includes: the first application detects the presence of the first character, and the first application includes a third font library; The process of recognizing the first character based on the first font library includes: The first character is identified based on the third font library to obtain the second character, wherein the second character includes: a fourth glyph identified from the first character based on the third font library, and a third character that cannot be identified based on the third font library; The third character is identified based on the first font library.

9. The method according to any one of claims 1-8, characterized in that, The process of recognizing the first character based on the first font library includes: Upon receiving the first instruction, the first character is recognized based on the first font library. The first instruction is used to initiate a screen refresh.

10. An electronic device, characterized in that, The electronic device includes: one or more processors and memory; The memory is coupled to the one or more processors, the memory being used to store computer program code, the computer program code including computer instructions, the one or more processors invoking the computer instructions to cause the electronic device to perform the method as described in any one of claims 1 to 9.

11. A chip system, characterized in that, The chip system is applied to an electronic device, the chip system including one or more processors, the one or more processors being used to invoke computer instructions to cause the electronic device to perform the method as described in any one of claims 1 to 9.

12. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes computer instructions that, when executed on an electronic device, cause the electronic device to perform the method as described in any one of claims 1 to 9.

13. A computer program product, characterized in that, The computer program product includes computer program code that, when run on an electronic device, causes the electronic device to perform the method as described in any one of claims 1 to 9.