Font rendering method and device, electronic equipment and readable storage medium

By querying and using the glyph metric information in memory in electronic devices to render fonts, the problem of frequent external memory reading and writing during font rendering is solved, and the rendering efficiency is improved.

CN120012714APending Publication Date: 2025-05-16VIVO MOBILE COMM CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510184790.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-19
Publication Date
2025-05-16

AI Technical Summary

Technical Problem

Electronic devices need to frequently perform external memory read and write operations when rendering fonts, resulting in increased processing time and increased performance burden, thereby reducing rendering speed and efficiency.

Method used

By determining the glyph index information corresponding to the characters, the glyph information is queried based on the glyph metric table stored in the memory area of ​​the electronic device, and the glyph bitmap is rendered based on the information to reduce external memory read and write operations.

Benefits of technology

This method reduces external memory read and write operations during font rendering and improves the efficiency of electronic devices during font rendering.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120012714A_ABST
    Figure CN120012714A_ABST
Patent Text Reader

Abstract

The invention discloses a font rendering method and device, electronic equipment and a readable storage medium, and belongs to the technical field of electronic equipment. The method comprises the following steps: determining index information of a first font corresponding to a first character, wherein the first font is a font corresponding to the first character in a first font file; according to the index information, querying font information of the first font based on a first font measurement table, the first font measurement table being a font measurement table corresponding to the target font file and stored in a first memory area of the electronic device; and rendering the bitmap of the first font according to the font information.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the technical field of electronic devices, and specifically relates to a font rendering method, device, electronic device and readable storage medium. Background Art

[0002] With the development of electronic device technology, users' requirements for the performance of electronic devices are constantly increasing. Currently, electronic devices need to perform font rendering based on font files in external memory.

[0003] However, since electronic devices need to perform frequent external memory read and write operations when rendering fonts, such as rendering vector fonts, font files need to be read and written from the external memory multiple times. Therefore, frequent external memory read and write operations not only increase processing time, but also increase the performance burden of the electronic device, resulting in low rendering speed of the electronic device when rendering fonts, and then resulting in poor rendering efficiency. Summary of the invention

[0004] The purpose of the embodiments of the present application is to provide a font rendering method, device, electronic device and readable storage medium, which can reduce the external memory read and write operations when the electronic device performs font rendering, thereby improving the efficiency of the electronic device performing font rendering.

[0005] In a first aspect, an embodiment of the present application provides a font rendering method, the method comprising: determining index information of a first glyph corresponding to a first character, the first glyph being the glyph corresponding to the first character in a first font file; querying glyph information of the first glyph based on a first glyph measurement table according to the index information, the first glyph measurement table being the glyph measurement table corresponding to the first font file and stored in a first memory area of ​​the electronic device; and rendering a bitmap of the first glyph according to the glyph information.

[0006] In a second aspect, an embodiment of the present application provides a font rendering device, which includes: a processing module; the processing module is used to determine the index information of a first glyph corresponding to a first character, the first glyph being the glyph corresponding to the first character in a first font file; the processing module is used to query the glyph information of the first glyph based on a first glyph measurement table according to the index information determined by the processing module, the first glyph measurement table being the glyph measurement table corresponding to the first font file and stored in the first memory area of ​​the electronic device; the processing module is used to render a bitmap of the first glyph according to the glyph information queried by the processing module.

[0007] In a third aspect, an embodiment of the present application provides an electronic device, which includes a processor and a memory, wherein the memory stores programs or instructions that can be run on the processor, and when the program or instructions are executed by the processor, the steps of the method described in the first aspect are implemented.

[0008] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, the steps of the method described in the first aspect are implemented.

[0009] In a fifth aspect, an embodiment of the present application provides a chip, comprising a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run a program or instruction to implement the method described in the first aspect.

[0010] In a sixth aspect, an embodiment of the present application provides a computer program product, which is stored in a storage medium and is executed by at least one processor to implement the method described in the first aspect.

[0011] In an embodiment of the present application, the electronic device determines the index information of the first glyph corresponding to the first character, the first glyph being the glyph corresponding to the first character in the first font file; based on the index information, the glyph information of the first glyph is queried based on the first glyph measurement table, the first glyph measurement table being the glyph measurement table corresponding to the first font file and stored in the first memory area of ​​the electronic device; and based on the glyph information, the bitmap of the first glyph is rendered. Through this method, the electronic device can query the glyph information based on the glyph measurement table stored in the memory area of ​​the electronic device according to the glyph index information, and render the glyph bitmap according to the glyph information, thereby reducing the external memory read and write operations during font rendering, thereby improving the efficiency of font rendering by the electronic device. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] Figure 1 A flowchart of a font rendering method provided for some embodiments of the present application;

[0013] Figure 2 A flowchart of a font rendering method provided for some embodiments of the present application;

[0014] Figure 3 A flowchart of a font rendering method provided for some embodiments of the present application;

[0015] Figure 4 A flowchart of a font rendering method provided for some embodiments of the present application;

[0016] Figure 5A schematic diagram of the structure of a font rendering device provided in some embodiments of the present application;

[0017] Figure 6 A schematic diagram of the structure of an electronic device provided for some embodiments of the present application;

[0018] Figure 7 A schematic diagram of the hardware structure of an electronic device provided for some embodiments of the present application. DETAILED DESCRIPTION

[0019] The following will be combined with the drawings in the embodiments of the present application to clearly describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the present application belong to the scope of protection of this application.

[0020] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the terms used in this way are interchangeable where appropriate, so that the embodiments of the present application can be implemented in an order other than those illustrated or described herein, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.

[0021] The terms "at least one (item)", "at least one of" and the like in the specification and claims of the present application refer to any one, any two or a combination of more than two of the objects included therein. For example, at least one (item) of a, b, and c can be represented by: "a", "b", "c", "a and b", "a and c", "b and c" and "a, b and c", where a, b, and c can be single or multiple. Similarly, "at least two (items)" refers to two or more, and its meaning is similar to that of "at least one (item)".

[0022] The font rendering method provided in the embodiment of the present application can be applied to the scenario of rendering the vector font "Songti" by an electronic device.

[0023] When rendering the vector font "SimSun" through an electronic device, if the character to be rendered at this time is "中", first, the Unicode of "中" is "U+4E2D". Based on this encoding, query the CMAP table to determine the index information of the glyph "中" corresponding to the character "中" in "SimSun". Then, according to this index information, query the glyph information of the above glyph "中" based on the HMTX table, VMTX table, and LOCA table in the memory of the electronic device. Then, the electronic device renders the bitmap of "中" according to the above glyph information. In this way, when the electronic device queries the glyph information, it can be based on the font table data in the memory, without having to query the font table from the font file in the external memory. After that, the electronic device can render the bitmap of the glyph according to the queried glyph information, thereby reducing the read and write operations of the external memory during font rendering, and further improving the efficiency of the electronic device during font rendering.

[0024] The execution subject of the font rendering method provided by the embodiments of the present application can be a font rendering device, and this font rendering device can be an electronic device, or a functional module or functional entity in the electronic device. The following takes an electronic device executing the font rendering method as an example to illustrate the font rendering method provided by the embodiments of the present application.

[0025] The following combines the drawings and details the font rendering method provided by the embodiments of the present application through specific embodiments and their application scenarios.

[0026] Figure 1 For the flowchart of the font rendering method provided by the embodiments of the present application, as Figure 1 shown, this font rendering method may include the following steps 201 to step 203:

[0027] Step 201: The electronic device determines the index information of the first glyph corresponding to the first character.

[0028] Wherein, the above first glyph is the glyph corresponding to the above first character in the first font file.

[0029] In some embodiments of the present application, the above first glyph may include the glyph to be rendered by the electronic device.

[0030] In some embodiments of the present application, the above first font file may include various font data and tables.

[0031] Exemplarily, the first font file may be the SimSun.ttf file stored on the electronic device, and this file includes tables such as the CMAP table, HMTX table, VMTX table, and GLYF table that conform to the TrueType font standard structure.

[0032] Exemplarily, the first glyph may be the corresponding glyph of the Chinese character "中" in the SimSun font file.

[0033] In some embodiments of the present application, the first character may include basic letters, symbols, numbers of various languages to be rendered by the electronic device, and characters of writing systems of specific cultures or regions.

[0034] Exemplarily, the first character may be Unicode encoding U+4E2D, representing the Chinese character "中".

[0035] Exemplarily, assuming the character to be rendered by the electronic device is "中", first use Unicode encoding to identify the character. The electronic device determines that the Unicode encoding of "中" is U+4E2D; then, the electronic device accesses the CMAP table in the font file. The electronic device can map the Unicode encoding to a glyph index by querying the CMAP table. After finding the entry corresponding to the Unicode encoding U+4E2D in the CMAP table, the electronic device obtains the index information of the glyph of "中" in the font file to obtain the index of "中".

[0036] Step 202: The electronic device queries the glyph information of the first glyph based on the index information and the first glyph metric table.

[0037] Wherein, the first glyph metric table corresponds to the first font file and is stored in the first memory area of the electronic device.

[0038] In some embodiments of the present application, the glyph metric table may include a table for storing glyph metric information in the font file.

[0039] Exemplarily, the glyph metric table may include an HMTX table, and the HMTX table is used to record the horizontal metric information of the glyph.

[0040] In some embodiments of the present application, the first glyph metric table may include an HMTX table, a VMTX table, a LOCA table, or other tables in the first font file.

[0041] Exemplarily, the first glyph metric table may be an HMTX table, which stores the horizontal metric information of the glyph, including width information (advance width) and left sidebearing information.

[0042] In some embodiments of the present application, the first metric table includes at least one set of metric records. When the first metric table is an HMTX table, one set of metric records is used to indicate a set of width information and left sidebearing information; when the first metric table is a VMTX table, one set of metric records is used to indicate a set of height information and top sidebearing information.

[0043] Exemplarily, a set of metric records of the first glyph is included in the HMTX table, and a set of metric records of the first glyph is included in the VMTX table.

[0044] In some embodiments of the present application, the above glyph information may include at least one of the following: width information, height information, contour information, position offset, etc., which are information for rendering the glyph bitmap.

[0045] Exemplarily, the glyph information may include that the width information of the glyph "中" is 1000 units, and the left boundary information is 50 units.

[0046] In some embodiments of the present application, the above first memory area may include memory areas such as the random access memory (RAM) of the electronic device, video memory, or a dedicated graphics processing memory area.

[0047] Exemplarily, the first memory area may be the system RAM of the electronic device, and the electronic device may pre-load the data of the first glyph metric table therein.

[0048] Exemplarily, the electronic device looks up the CMAP table to obtain that the glyph index corresponding to "中" is a. Since "中" is a horizontally written character, the electronic device uses the HMTX table to query the horizontal metric information of the character "中". First, the electronic device accesses the pre-loaded HMTX table in the memory according to the index a. The HMTX table contains the width information and left boundary information of the glyph "中". Then, the electronic device calculates the offset in the HMTX table according to the glyph index. Each set of width information and left boundary information in the HMTX table, that is, each set of metric records occupies 4 bytes. Then, for the index a, the offset is a * 4 bytes. Then, the electronic device uses the calculated offset to read the width information of the glyph "中" from the HMTX table, assuming it is 100px, and the left boundary information is 50px. Finally, the electronic device queries the LOCA table in the memory to determine the position of the contour data of the glyph "中" in the GLYF table, and finds the specific contour data information of "中" in the GLYF table according to the offset provided by the LOCA table. Step 203: The electronic device renders the bitmap of the first glyph according to the glyph information.

[0049] In some embodiments of the present application, the above bitmap may include a bitmap containing the pixel representation, color information, transparency, and contour details of the first glyph after being rendered by the electronic device.

[0050] Exemplarily, the electronic device rasterizes the glyph according to glyph information such as the horizontal measurement information and contour information of the Chinese character '中', converting the vector contour into pixel data. After rasterization, the electronic device generates a bitmap of the character '中' and sends the generated bitmap data to the display buffer of the electronic device for the electronic device to render the character '中' on the display area.

[0051] In the font rendering method provided by the embodiments of the present application, the electronic device determines the index information of the first glyph corresponding to the first character, where the first glyph is the glyph corresponding to the first character in the first font file. According to the index information, the glyph information of the first glyph is queried based on the first glyph metric table, and the first glyph metric table is the glyph metric table corresponding to the first font file and stored in the first memory area of the electronic device. According to the glyph information, the bitmap of the first glyph is rendered. Through this method, the electronic device can query the glyph information based on the glyph metric table stored in the memory area of the electronic device according to the index information of the glyph, and render the bitmap of the glyph according to the glyph information, thereby reducing the external memory read and write operations during font rendering, and further improving the efficiency of the electronic device for font rendering.

[0052] In some embodiments of the present application, before step 202, the font rendering method provided by the embodiments of the present application may further include the following step 204:

[0053] Step 204: The electronic device loads the first glyph metric table into the first memory area.

[0054] Exemplarily, assume that the electronic device needs to render the target character in the 'Song typeface' font. First, the electronic device reads the header information of the font file to determine the format and structure of the font file, including the position and size of the glyph metric table. Then, the electronic device selects the metric tables that need to be loaded into the memory according to the requirements of font rendering, such as the HMTX table, the VMTX table, and the LOCA table. Then, the electronic device extracts the data of these metric tables from the font file and loads them into a specific area in the memory, and this memory area can be a specific area in the RAM for storing the data of the glyph metric table.

[0055] In this way, by loading the HMTX, VMTX, and LOCA tables into the memory, the electronic device can directly look up the tables in the memory instead of looking up the tables in the font file in the external memory, thereby reducing the external memory read and write operations during font rendering, and further improving the efficiency of the electronic device for font rendering.

[0056] In some embodiments of the present application, the glyph information includes size information and boundary information, and step 202 may include the following step 202a or step 202b:

[0057] Step 202a: If the index information is less than the first value, the electronic device determines a first offset according to the index information, and reads size information and boundary information of the first glyph in the first glyph measurement table from the first memory area according to the first offset.

[0058] Step 202b: If the index information is greater than or equal to the first value, the electronic device determines a second offset based on the index information, and reads size information of the first glyph in the first glyph measurement table from the first memory area based on the second offset, and determines a third offset based on the index information, and reads boundary information of the first glyph in the first glyph measurement table from the first memory area based on the third offset.

[0059] The first value is the number of data in the first glyph metric table, and the first glyph metric table includes an HMTX table or a VMTX table.

[0060] In some embodiments of the present application, the first glyph measurement table is an HMTX table, and the size information is width information and left boundary information; the first glyph measurement table is a VMTX table, and the size information is height information and upper boundary information.

[0061] In some embodiments of the present application, the first offset is used to indicate the starting position of the size information of the first glyph in the HMTX table or the VMTX table.

[0062] Exemplarily, the first offset may be the product of the glyph index (glyph Index) and the number of bytes occupied by a single metric record in the HMTX table, or the product of the glyph index (glyph Index) and the size of each metric record in the VMTX table.

[0063] Exemplarily, assuming that each metric record occupies 4 bytes, that is, the metric record size is 4, the first offset is 4*glyphIndex.

[0064] In some embodiments of the present application, the second offset may be the location of the size information pointing to after the last metric record in the HMTX table or the VMTX table, which may be calculated by 4*(k-1), where k is the number of metric records in the HMTX table or the VMTX table.

[0065] Exemplarily, assuming that there are 100 metric records in the HMTX table (ie, k=100), the second offset may be 4*(100-1)=396 bytes.

[0066] In some embodiments of the present application, the third offset may be used to read the boundary information of a specific glyph from the sidebearing area of the HMTX table or the VMTX table, and can be calculated by 4*k + 2*(glyph Index - k) or simplified to 2*(k + glyph Index).

[0067] Exemplarily, assuming there are 100 metric records (k = 100) in the HMTX table and the glyph index is 105, the third offset is 2*(100 + 105) = 410 bytes.

[0068] In some embodiments of the present application, the first glyph metric table is the HMTX table, and the above-mentioned dimension information is width information and left boundary information.

[0069] The following is an exemplary description of the process of querying the glyph information of the first glyph based on the first glyph metric table in conjunction with the accompanying drawings.

[0070] As Figure 2 shown, in some examples, the process of querying the glyph information of the first glyph based on the first glyph metric table may include the following steps:

[0071] Step 21: Determine whether to query the VMTX table or the HMTX table.

[0072] Exemplarily, the electronic device first determines whether to query the VMTX table or the HMTX table according to the text direction. Since "中" is a character that needs to be written horizontally, the electronic device will query the HMTX table to obtain horizontal metric information.

[0073] It should be noted that assuming that a certain vertically written character needs to be rendered, the electronic device first needs to query the VMTX table to obtain vertical metric information.

[0074] Step 22: Determine the size of the first value (k).

[0075] Exemplarily, the first value (k) is the number of records in the metric records (HMetrics) area of the HMTX table, and these records contain the width information (advance) and left boundary information (bearing) of the glyph.

[0076] Exemplarily, the first value is the number of records in the metric records (VMetrics) area of the VMTX table, and these records contain the height information (advance) and upper boundary information (bearing) of the glyph.

[0077] Step 23: Compare the size relationship between the glyph index and k.

[0078] Exemplarily, the electronic device can determine whether the metric information of the glyph is located in the metric recording area or the side bearing area by comparing the glyph index and the first value (k).

[0079] Step 24: When the glyph index is less than the first value (k), calculate a first offset = 4*glyph index.

[0080] Exemplarily, if the glyph index is less than k, the electronic device calculates a first offset, and the calculation method is first offset = glyph index * size of the measurement record. Usually, the size of the measurement record is 4 bytes, then the first offset = 4 * glyph index. The calculated first offset is used to locate the measurement information of the glyph in the measurement record area.

[0081] Step 25: Check whether the first offset is out of bounds.

[0082] Exemplarily, when querying the HMTX table, the electronic device checks whether the first offset is out of bounds, that is, checks whether the calculated first offset exceeds the actual size of the storage area of ​​the HMTX table in the memory. If an out-of-bounds is detected, the electronic device will take corresponding error handling measures, such as recording an error log, throwing an exception, using alternative measurement information, or simply skipping the rendering of the glyph. If the first offset is not out of bounds, the electronic device will proceed to the next step.

[0083] Exemplarily, when querying the VMTX table, the electronic device checks whether the first offset is out of bounds, that is, checks whether the calculated first offset exceeds the actual size of the storage area of ​​the VMTX table in the memory. If an out-of-bounds error is detected, the electronic device will take corresponding error handling measures, such as recording an error log, throwing an exception, using alternative measurement information, or simply skipping the rendering of the glyph. If the first offset is not out of bounds, the electronic device will proceed to the next step.

[0084] Step 26: Obtain size information and boundary information according to the first offset.

[0085] Exemplarily, the electronic device reads the width information and left boundary information of the glyph from the HMTX table in the first memory area according to the first offset; or, the electronic device reads the height information and upper boundary information of the glyph from the VMTX table in the first memory area according to the first offset.

[0086] Step 27: Return the size information and boundary information.

[0087] Exemplarily: the electronic device returns the queried width information and left boundary information, or the electronic device returns the queried height information and upper boundary information for subsequent rasterization and rendering.

[0088] Step 28: When the glyph index is greater than or equal to the first value (k), calculate the second offset = 4*(k-1).

[0089] Exemplarily, if the glyph index is greater than or equal to k, the electronic device will calculate the second offset to read the width information, the calculation method is second offset = 4*(k-1), the purpose is to use the value after the last measurement record in the measurement record area as the width information.

[0090] Step 29: Check whether the second offset is out of bounds.

[0091] Exemplarily, when querying the HMTX table, the electronic device checks whether the second offset is out of bounds, that is, checks whether the calculated second offset exceeds the actual size of the storage area of ​​the HMTX table in the memory. If an out-of-bounds is detected, the electronic device will take corresponding error handling measures, such as recording an error log, throwing an exception, using alternative measurement information, or simply skipping the rendering of the glyph. If the offset is not out of bounds, the electronic device will proceed to the next step.

[0092] Exemplarily, when querying the VMTX table, the electronic device checks whether the second offset is out of bounds, that is, checks whether the calculated second offset exceeds the actual size of the storage area of ​​the VMTX table in the memory. If an out-of-bounds is detected, the electronic device will take corresponding error handling measures, such as recording an error log, throwing an exception, using alternative measurement information, or simply skipping the rendering of the glyph. If the offset is not out of bounds, the electronic device will proceed to the next step.

[0093] Step 210: Acquire size information according to the second offset, calculate a third offset, and acquire boundary information according to the third offset.

[0094] Exemplarily, when querying the HMTX table, the electronic device reads the width information from the HMTX table according to the second offset. Then, the electronic device calculates the third offset to read the left boundary information. The calculation method is third offset = 4*k + 2* (glyph index - k), which is simplified to third offset = 2* (k + glyph index). Then, the electronic device reads the left boundary information from the HMTX table according to the third offset.

[0095] Exemplarily, when querying the VMTX table, the electronic device reads the height information from the VMTX table according to the second offset. Then, the electronic device calculates the third offset to read the upper boundary information. The calculation method is third offset = 4*k + 3* (glyph index - k), which is simplified to third offset = 3* (k + glyph index). Then, the electronic device reads the upper boundary information from the VMTX table according to the third offset.

[0096] In this way, when the electronic device queries the glyph information, it can be based on the HMTX table or VMTX table in the memory, without having to query the HMTX table or VMTX table from the font file in the external memory. The electronic device can then render the bitmap of the glyph according to the glyph information obtained from the query, thereby reducing the external memory read and write operations during font rendering, thereby improving the efficiency of the electronic device when performing font rendering.

[0097] In some embodiments of the present application, the first glyph measurement table includes a LOCA table; the glyph information includes contour information, and the step 202 may include the following steps 202c-202f:

[0098] Step 202c: The electronic device determines a fourth offset according to the index information.

[0099] Step 202d: The electronic device reads the start address and the end address of the outline information of the first glyph in the LOCA table from the first memory area according to the fourth offset.

[0100] Step 202e: The electronic device determines the fifth offset according to the start address and determines the data size of the outline information according to the start address and the end address.

[0101] Step 202f: The electronic device reads the outline information of the first glyph in the GLYF table according to the fifth offset and the data size of the outline information.

[0102] In some embodiments of the present application, the LOCA table may include a table in a font file for storing position information of glyph outline data in a GLYF table.

[0103] Exemplarily, the LOCA table may include a mapping relationship between a glyph index and an offset of its corresponding outline data in the GLYF table, wherein the offset indicates a starting position of each glyph outline data.

[0104] In some embodiments of the present application, the above-mentioned outline information may include geometric description information of the glyph.

[0105] For example, the outline information may include a series of point data and Bezier curves, which define the boundary and shape of the glyph and are used by the rendering engine to generate a bitmap of the glyph.

[0106] In some embodiments of the present application, the above-mentioned start address and end address may include a storage range of the glyph outline data in the GLYF table.

[0107] Exemplarily, the start address may be the position of the first byte of the glyph outline data, and the end address may be the position of the last byte, and the two together define the boundary of the entire glyph outline data.

[0108] In some embodiments of the present application, the GLYF table may include a TrueType font table storing all glyph outline data.

[0109] Exemplarily, a GLYF table may contain contour data of multiple glyphs, where the data of each glyph consists of a series of records that describe the contour points, line segments, and curves of the glyph, and how to connect these elements to form a complete glyph.

[0110] The process of querying the glyph information of the first glyph based on the first glyph measurement table is exemplarily described below with reference to the accompanying drawings.

[0111] In some embodiments of the present application, the first glyph metric table includes a LOCA table, and the glyph information includes contour information.

[0112] For example, Figure 3 As shown, the process of querying the outline information of the first glyph based on the first glyph measurement table may include the following steps:

[0113] Step 31: Check the format of the LOCA table.

[0114] Exemplarily, the electronic device checks the format of the LOCA table, which indicates the manner of storing offsets in the table and the manner of reading the start address and the end address of the profile information.

[0115] Step 32: When the format of the LOCA table is not 0, calculate the fourth offset = glyph index * 4.

[0116] Exemplarily, if the format of the LOCA table is not 0, it means that the offset of each glyph outline information is stored in 4 bytes. At this time, the electronic device calculates the fourth offset = glyph index * 4 according to the index information.

[0117] Step 33: According to the fourth offset, obtain the start address and the end address of the outline information.

[0118] Exemplarily, the electronic device reads the starting address (pos1) of the profile information according to the address pointed to by the fourth offset, and reads the ending address (pos2) after a length of 4 bytes.

[0119] Step 34: When the format of the LOCA table is 0, calculate the fourth offset = glyph index * 2.

[0120] Exemplarily, if the format of the LOCA table is 0, it means that the offset of each glyph outline information is stored in 2 bytes, and the electronic device calculates the fourth offset=glyph index*2.

[0121] Step 35: According to the fourth offset, obtain the start address and the end address of the outline information.

[0122] Exemplarily, the electronic device reads the starting address (pos1) of the profile information according to the address pointed to by the fourth offset, and reads the ending address (pos2) after a length of 2 bytes, then multiplies both pos1 and pos2 by 2 and shifts the result left by one bit to obtain the actual address value.

[0123] Step 36: Compare the size relationship between the start address and the end address.

[0124] Exemplarily, the electronic device compares the size relationship between pos1 and pos2.

[0125] Step 37: When the start address is smaller than the end address, the data size of the outline information is calculated.

[0126] Exemplarily, when pos1 is smaller than pos2, the data size of the profile information = pos2 - pos1.

[0127] Step 38: When the start address is greater than or equal to the end address, the data size of the outline information is calculated.

[0128] Exemplarily, when pos1 is greater than or equal to pos2, the data size of the outline information=glyfLen-pos1, where glyfLen represents the total data length of the GLYF table.

[0129] Step 39: Determine the starting address as the fifth offset, and return the fifth offset and the data size of the outline information.

[0130] Exemplarily, the electronic device returns the starting address pos1 and the data size of the outline information, wherein pos1 is the fifth offset.

[0131] Then, the electronic device may query and read the outline information of the glyph in the GLYF table according to the fifth offset and the data size of the outline information.

[0132] In this way, when the electronic device queries the glyph information, it can be based on the LOCA table data in the memory, without having to query the LOCA table from the font file in the external memory, thereby reducing the external memory read and write operations during font rendering, thereby improving the efficiency of the electronic device during font rendering.

[0133] In some embodiments of the present application, after the above step 202f, the font rendering method provided in the embodiment of the present application may further include the following step 202f1:

[0134] Step 202f1: the electronic device saves the outline information of the first glyph into the second memory area of ​​the electronic device.

[0135] In some embodiments of the present application, the above-mentioned second memory area may include a cache area specifically allocated for glyph information in the RAM of the electronic device.

[0136] Exemplarily, the second memory area may be a glyph information cache area in the memory of the electronic device or the GPU video memory.

[0137] Exemplarily, after the above steps 202c to 202f, the electronic device obtains the first glyph, such as the outline information of "中", from the GLYF table. Then, the electronic device copies or moves the obtained glyph outline information to the second memory area, such as the glyph information cache area in the memory.

[0138] In this way, the electronic device can save the outline information (glyph data) to a specific memory area, so that when the electronic device needs to read the same outline information next time, it does not need to execute the outline information loading process again, thereby effectively reducing the performance loss caused by the miss of the glyph bitmap cache, and further improving the efficiency of the electronic device for font rendering.

[0139] In some embodiments of the present application, the font rendering method provided by the embodiments of the present application may further include the following step 205:

[0140] Step 205: When the electronic device renders the first glyph, query the outline information of the first glyph from the second memory area of the electronic device according to the index information of the first glyph.

[0141] The following is an exemplary description of the process in which the above-mentioned electronic device queries the outline information of the first glyph from the second memory area of the electronic device according to the index information of the first glyph when rendering the first glyph in conjunction with the accompanying drawings.

[0142] Exemplarily, as Figure 4 shown, the process of querying the outline information of the first glyph from the second memory area of the electronic device according to the index information of the first glyph may include the following steps:

[0143] Step 41: Query whether there is an outline information cache.

[0144] Exemplarily, the electronic device queries whether there is the outline information of the glyph in the second memory area according to the glyph index.

[0145] Step 42: When the cache hits, obtain the outline information.

[0146] Exemplarily, if the cache hits, the electronic device directly obtains the outline information from the Least Recently Used (LRU) cache.

[0147] Step 43: In case of a cache miss, re-read the contour information.

[0148] Exemplarily, if the cache misses, the electronic device needs to re-read the contour information from the GLYF table.

[0149] Step 44: Save the profile information to the LRU cache.

[0150] Exemplarily, when a cache miss occurs, the electronic device re-reads the outline information and saves the outline information data into the LRU cache using the font path+glyph index as a key value, for use the next time the same outline information is read.

[0151] Step 45: Rasterize the glyph according to the outline information.

[0152] Exemplarily, the electronic device performs rasterization processing on the glyph according to the acquired outline information.

[0153] In this way, when the electronic device queries the outline information of the first glyph, it preferentially queries and uses the outline information of the first glyph stored in the second memory area, thereby effectively reducing the performance loss caused by the glyph bitmap cache miss, thereby improving the efficiency of font rendering of the electronic device.

[0154] The above-mentioned method embodiments, or various possible implementation methods in each method embodiment, can be executed separately, or, under the premise that there is no contradiction, can also be executed in combination with each other. The specific implementation can be determined according to actual usage requirements, and the embodiments of the present application do not limit this.

[0155] The font rendering method provided in the embodiment of the present application can be executed by a font rendering device. In the embodiment of the present application, the font rendering device provided in the embodiment of the present application is described by taking the font rendering method executed by the font rendering device as an example.

[0156] Figure 5 A schematic diagram of the structure of a font rendering device provided in an embodiment of the present application is shown in FIG. Figure 5 As shown, the font rendering device 500 may include a processing module 501, wherein: the above-mentioned processing module is used to determine the index information of the first glyph corresponding to the first character, and the above-mentioned first glyph is the glyph corresponding to the above-mentioned first character in the first font file; the above-mentioned processing module is used to query the glyph information of the above-mentioned first glyph based on the first glyph measurement table according to the above-mentioned index information determined by the above-mentioned processing module, and the above-mentioned first glyph measurement table is the glyph measurement table corresponding to the above-mentioned first font file and stored in the first memory area of ​​the above-mentioned electronic device; the above-mentioned processing module is used to render the bitmap of the above-mentioned first glyph according to the above-mentioned glyph information queried by the above-mentioned processing module.

[0157] In some embodiments of the present application, the processing module is further configured to load the first glyph measurement table into the first memory area before querying the glyph information of the first glyph based on the first glyph measurement table according to the index information.

[0158] In some embodiments of the present application, the above-mentioned glyph information includes size information and boundary information; the above-mentioned processing module is specifically used to determine the first offset according to the above-mentioned index information when the above-mentioned index information is less than the first value, and read the size information and boundary information of the above-mentioned first glyph in the above-mentioned first glyph measurement table from the above-mentioned first memory area according to the above-mentioned first offset; or, when the above-mentioned index information is greater than or equal to the above-mentioned first value, determine the second offset according to the above-mentioned index information, and read the size information of the above-mentioned first glyph in the above-mentioned first glyph measurement table from the above-mentioned first memory area according to the above-mentioned second offset, and determine the third offset according to the above-mentioned index information, and read the boundary information of the above-mentioned first glyph in the above-mentioned first glyph measurement table from the above-mentioned first memory area according to the above-mentioned third offset; wherein the above-mentioned first value is the number of data in the above-mentioned first glyph measurement table, and the above-mentioned first glyph measurement table includes an HMTX table or a VMTX table.

[0159] In some embodiments of the present application, the above-mentioned first glyph measurement table includes a LOCA table; the above-mentioned glyph information includes contour information; the above-mentioned processing module is specifically used to determine a fourth offset according to the above-mentioned index information; the above-mentioned processing module is specifically used to read the starting address and the ending address of the contour information of the above-mentioned first glyph in the above-mentioned LOCA table from the above-mentioned first memory area according to the fourth offset; the above-mentioned processing module is specifically used to determine a fifth offset according to the above-mentioned starting address and determine the data size of the above-mentioned contour information according to the above-mentioned starting address and the ending address; the above-mentioned processing module is specifically used to read the contour information of the above-mentioned first glyph in the above-mentioned GLYF table according to the above-mentioned fifth offset and the data size of the above-mentioned contour information.

[0160] In some embodiments of the present application, the processing module is further used to save the contour information of the first glyph into the second memory area of ​​the electronic device after reading the contour information of the first glyph in the GLYF table according to the fifth offset and the data size of the contour information.

[0161] In some embodiments of the present application, the processing module is further used to query the outline information of the first glyph from the second memory area of ​​the electronic device according to the index information of the first glyph when rendering the first glyph.

[0162] The font rendering device provided in the embodiment of the present application determines the index information of the first glyph corresponding to the first character, the first glyph being the glyph corresponding to the first character in the first font file; queries the glyph information of the first glyph based on the first glyph measurement table according to the index information, the first glyph measurement table being the glyph measurement table corresponding to the first font file and stored in the first memory area of ​​the electronic device; renders the bitmap of the first glyph according to the glyph information. Through this method, the font rendering device can query the glyph information based on the glyph measurement table stored in the memory area of ​​the electronic device according to the glyph index information, and render the glyph bitmap according to the glyph information, thereby reducing the external memory read and write operations during font rendering, thereby improving the efficiency of font rendering by the electronic device.

[0163] The font rendering device in the embodiment of the present application can be an electronic device, or a component in the electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal, or other devices other than a terminal. Exemplarily, the electronic device can be a mobile phone, a tablet computer, a notebook computer, a palmtop computer, a vehicle-mounted electronic device, a mobile Internet device (Mobile Internet Device, MID), an augmented reality (augmented reality, AR) / virtual reality (virtual reality, VR) device, a robot, a wearable device, an ultra-mobile personal computer (ultra-mobile personal computer, UMPC), a netbook or a personal digital assistant (personal digital assistant, PDA), etc., and can also be a server, a network attached storage (Network Attached Storage, NAS), a personal computer (personal computer, PC), a television (television, TV), a teller machine or a self-service machine, etc., and the embodiment of the present application is not specifically limited.

[0164] The font rendering device in the embodiment of the present application may be a device having an operating system. The operating system may be an Android operating system, an iOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.

[0165] The font rendering device provided in the embodiment of the present application can implement each process implemented in the above-mentioned font rendering method embodiment, and will not be described again here to avoid repetition.

[0166] Alternatively, if Figure 6As shown, an embodiment of the present application further provides an electronic device 600, including a processor 601 and a memory 602, wherein the memory 602 stores a program or instruction that can be executed on the processor 601, and when the program or instruction is executed by the processor 601, each step of the above-mentioned font rendering method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0167] It should be noted that the electronic devices in the embodiments of the present application include the mobile electronic devices and non-mobile electronic devices mentioned above.

[0168] Figure 7 A schematic diagram of the hardware structure of an electronic device to implement an embodiment of the present application.

[0169] The electronic device 100 includes but is not limited to components such as a radio frequency unit 101, a network module 102, an audio output unit 103, an input unit 104, a sensor 105, a display unit 106, a user input unit 107, an interface unit 108, a memory 109, and a processor 110.

[0170] Those skilled in the art will appreciate that the electronic device 100 may also include a power source (such as a battery) for supplying power to various components, and the power source may be logically connected to the processor 110 through a power management system, thereby implementing functions such as managing charging, discharging, and power consumption management through the power management system. Figure 7 The electronic device structure shown in the figure does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently, which will not be described in detail here.

[0171] Among them, the above-mentioned processor 110 is used to determine the index information of the first glyph corresponding to the first character, and the above-mentioned first glyph is the glyph corresponding to the above-mentioned first character in the first font file; the above-mentioned processor 110 is used to query the glyph information of the above-mentioned first glyph based on the first glyph measurement table according to the above-mentioned index information determined by the above-mentioned processor 110, and the above-mentioned first glyph measurement table is the glyph measurement table corresponding to the above-mentioned first font file and stored in the first memory area of ​​the above-mentioned electronic device; the above-mentioned processor 110 is used to render the bitmap of the above-mentioned first glyph according to the above-mentioned glyph information queried by the above-mentioned processor 110.

[0172] In some embodiments of the present application, the processor 110 is further configured to load the first glyph metric table into the first memory area before querying the glyph information of the first glyph based on the first glyph metric table according to the index information.

[0173] In some embodiments of the present application, the glyph information includes size information and boundary information; the processor 110 is specifically used to determine a first offset according to the index information when the index information is less than a first value, and read the size information and boundary information of the first glyph in the first glyph measurement table from the first memory area according to the first offset; or, when the index information is greater than or equal to the first value, determine a second offset according to the index information, and read the size information of the first glyph in the first glyph measurement table from the first memory area according to the second offset, and determine a third offset according to the index information, and read the boundary information of the first glyph in the first glyph measurement table from the first memory area according to the third offset; wherein the first value is the number of data in the first glyph measurement table, and the first glyph measurement table includes an HMTX table or a VMTX table.

[0174] In some embodiments of the present application, the above-mentioned first glyph measurement table includes a LOCA table; the above-mentioned glyph information includes contour information; the above-mentioned processor 110 is specifically used to determine a fourth offset according to the above-mentioned index information; the above-mentioned processor 110 is specifically used to read the starting address and the ending address of the contour information of the above-mentioned first glyph in the above-mentioned LOCA table from the above-mentioned first memory area according to the fourth offset; the above-mentioned processor 110 is specifically used to determine a fifth offset according to the above-mentioned starting address and determine the data size of the above-mentioned contour information according to the above-mentioned starting address and the ending address; the above-mentioned processor 110 is specifically used to read the contour information of the above-mentioned first glyph in the above-mentioned GLYF table according to the above-mentioned fifth offset and the data size of the above-mentioned contour information.

[0175] In some embodiments of the present application, the processor 110 is further used to save the contour information of the first glyph into the second memory area of ​​the electronic device after reading the contour information of the first glyph in the GLYF table according to the fifth offset and the data size of the contour information.

[0176] In some embodiments of the present application, the processor 110 is further used to query the outline information of the first glyph from the second memory area of ​​the electronic device according to the index information of the first glyph when rendering the first glyph.

[0177] The electronic device provided in the embodiment of the present application determines the index information of the first glyph corresponding to the first character, the first glyph being the glyph corresponding to the first character in the first font file; queries the glyph information of the first glyph based on the first glyph measurement table according to the index information, the first glyph measurement table being the glyph measurement table corresponding to the first font file and stored in the first memory area of ​​the electronic device; renders the bitmap of the first glyph according to the glyph information. Through this method, the electronic device can query the glyph information based on the glyph measurement table stored in the memory area of ​​the electronic device according to the glyph index information, and render the glyph bitmap according to the glyph information, thereby reducing the external memory read and write operations during font rendering, thereby improving the efficiency of font rendering by the electronic device.

[0178] It should be understood that in the embodiment of the present application, the input unit 104 may include a graphics processor (Graphics Processing Unit, GPU) 1041 and a microphone 1042, and the graphics processor 1041 processes the image data of the static picture or video obtained by the image capture device (such as a camera) in the video capture mode or the image capture mode. The display unit 106 may include a display panel 1061, and the display panel 1061 may be configured in the form of a liquid crystal display, an organic light emitting diode, etc. The user input unit 107 includes at least one of a touch panel 1071 and other input devices 1072. The touch panel 1071 is also called a touch screen. The touch panel 1071 may include two parts: a touch detection device and a touch controller. Other input devices 1072 may include, but are not limited to, a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, and a joystick, which will not be repeated here.

[0179] The memory 109 can be used to store software programs and various data. The memory 109 may mainly include a first storage area for storing programs or instructions and a second storage area for storing data, wherein the first storage area may store an operating system, an application program or instruction required for at least one function (such as a sound playback function, an image playback function, etc.), etc. In addition, the memory 109 may include a volatile memory or a non-volatile memory, or the memory 109 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), a static random access memory (SRAM), a dynamic random access memory (DRAM), a synchronous dynamic random access memory (SDRAM), a double data rate synchronous dynamic random access memory (DDRSDRAM), an enhanced synchronous dynamic random access memory (ESDRAM), a synchronous link dynamic random access memory (SLDRAM) and a direct memory bus random access memory (DRRAM). The memory 109 in the embodiment of the present application includes but is not limited to these and any other suitable types of memories.

[0180] The processor 110 may include one or more processing units; optionally, the processor 110 integrates an application processor and a modem processor, wherein the application processor mainly processes operations related to an operating system, a user interface, and application programs, and the modem processor mainly processes wireless communication signals, such as a baseband processor. It is understandable that the modem processor may not be integrated into the processor 110.

[0181] An embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, each process of the above-mentioned font rendering method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0182] The processor is the processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory ROM, a random access memory RAM, a magnetic disk or an optical disk.

[0183] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned font rendering method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0184] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.

[0185] An embodiment of the present application provides a computer program product, which is stored in a storage medium. The program product is executed by at least one processor to implement the various processes of the above-mentioned font rendering method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0186] It should be noted that, in this article, the terms "comprise", "include" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise one..." do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.

[0187] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, a disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application.

[0188] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.

Claims

1. A font rendering method, characterized in that: The method comprises: Determine index information of a first glyph corresponding to a first character, where the first glyph is a glyph corresponding to the first character in a first font file; According to the index information, querying the glyph information of the first glyph based on a first glyph metric table, where the first glyph metric table is a glyph metric table corresponding to the first font file and stored in a first memory area of ​​the electronic device; Rendering a bitmap of the first glyph according to the glyph information.

2. The method according to claim 1, characterized in that Before querying the glyph information of the first glyph based on the first glyph metric table according to the index information, the method further includes: The first glyph metric table is loaded into the first memory area.

3. The method according to claim 1, characterized in that The glyph information includes size information and boundary information; The querying the glyph information of the first glyph based on the first glyph metric table according to the index information includes: If the index information is less than the first value, determining a first offset according to the index information, and reading size information and boundary information of the first glyph in the first glyph metric table from the first memory area according to the first offset; Alternatively, if the index information is greater than or equal to the first value, determining a second offset according to the index information, and reading the size information of the first glyph in the first glyph metric table from the first memory area according to the second offset, and determining a third offset according to the index information, and reading the boundary information of the first glyph in the first glyph metric table from the first memory area according to the third offset; The first value is the number of data in the first glyph metric table, and the first glyph metric table includes an HMTX table or a VMTX table.

4. The method according to claim 1, characterized in that: The first glyph measurement table includes a LOCA table; the glyph information includes contour information; The querying the glyph information of the first glyph based on the first glyph metric table according to the index information includes: Determine a fourth offset according to the index information; Reading, from the first memory area, a starting address and an ending address of the outline information of the first glyph in the LOCA table according to a fourth offset; Determine a fifth offset according to the start address and determine the data size of the outline information according to the start address and the end address; The outline information of the first glyph in the GLYF table is read according to the fifth offset and the data size of the outline information.

5. The method according to claim 4, characterized in that After reading the outline information of the first glyph in the GLYF table according to the fifth offset and the data size of the outline information, the method further includes: storing the outline information of the first glyph in a second memory area of ​​the electronic device; In the case of rendering the first glyph, the outline information of the first glyph is queried from the second memory area of ​​the electronic device according to the index information of the first glyph.

6. A font rendering device, characterized in that: The device comprises: a processing module; The processing module is used to determine index information of a first glyph corresponding to a first character, where the first glyph is a glyph corresponding to the first character in a first font file; The processing module is configured to query the glyph information of the first glyph based on a first glyph metric table according to the index information determined by the processing module, wherein the first glyph metric table is a glyph metric table corresponding to the first font file and stored in a first memory area of ​​the electronic device; The processing module is used to render the bitmap of the first glyph according to the glyph information queried by the processing module.

7. The device according to claim 6, characterized in that The processing module is further configured to load the first glyph metric table into the first memory area before querying the glyph information of the first glyph based on the first glyph metric table according to the index information.

8. The device according to claim 6, characterized in that The glyph information includes size information and boundary information; The processing module is specifically configured to determine a first offset according to the index information when the index information is less than a first value, and read the size information and boundary information of the first glyph in the first glyph metric table from the first memory area according to the first offset; Alternatively, when the index information is greater than or equal to the first value, a second offset is determined according to the index information, and size information of the first glyph in the first glyph metric table is read from the first memory area according to the second offset, and a third offset is determined according to the index information, and boundary information of the first glyph in the first glyph metric table is read from the first memory area according to the third offset; The first value is the number of data in the first glyph metric table, and the first glyph metric table includes an HMTX table or a VMTX table.

9. The device according to claim 6, characterized in that The first glyph measurement table includes a LOCA table; the glyph information includes contour information; The processing module is specifically configured to determine a fourth offset according to the index information; The processing module is specifically configured to read the start address and the end address of the outline information of the first glyph in the LOCA table from the first memory area according to the fourth offset; The processing module is specifically used to determine a fifth offset according to the starting address and determine a data size of the outline information according to the starting address and the ending address; The processing module is specifically configured to read the outline information of the first glyph in the GLYF table according to the fifth offset and the data size of the outline information.

10. The device according to claim 9, characterized in that The processing module is further configured to save the outline information of the first glyph into a second memory area of ​​the electronic device after reading the outline information of the first glyph in the GLYF table according to the fifth offset and the data size of the outline information; The processing module is further configured to query the outline information of the first glyph from the second memory area of ​​the electronic device according to the index information of the first glyph when rendering the first glyph.

11. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores a program or instruction that can be run on the processor, and when the program or instruction is executed by the processor, the steps of the font rendering method according to any one of claims 1 to 5 are implemented.