Page rendering method, device, electronic device, and storage medium

By extracting and converting the file path information of custom fonts during installation of the application, the problem that the rendering framework cannot support the custom fonts of applets is solved, and the effective rendering of custom fonts in any rendering framework is achieved, meeting user needs and improving rendering efficiency.

CN114218890BActive Publication Date: 2025-08-01BEIJING BAIDU NETCOM SCI & TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202111516467.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-09
Publication Date
2025-08-01
Estimated Expiration
2041-12-09

AI Technical Summary

Technical Problem

The existing rendering framework cannot effectively support page rendering based on applet custom fonts, especially the NaView rendering framework cannot support the font-face interface, resulting in the inability to meet users' rendering needs for custom fonts.

Method used

During the installation of the target application, extract and save the file path information of the custom font, obtain the font source file through the path information and convert it into a rendering file, and directly use custom fonts in the rendering framework for page rendering to avoid registering to the device system.

Benefits of technology

It realizes page rendering of customized fonts in any rendering framework, meeting users' rendering needs for customized fonts and improving rendering efficiency and flexibility.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114218890B_ABST
    Figure CN114218890B_ABST
Patent Text Reader

Abstract

The present disclosure provides a page rendering method, apparatus, electronic device, and storage medium. The present disclosure relates to the field of computer technologies, specifically to the technical fields of information flow and web page processing, and can be applied to scenarios such as page rendering. The specific implementation solution is as follows: In response to a page rendering trigger event for a target application, determine a target font to be used from at least one custom font of the target application; read the file path information of the target font from a first storage location, and obtain the target font source file through the file path information of the target font; convert the target font source file into a target font rendering file; and render the text content of the current page of the target application based on the target font rendering file. The above method can obtain a font rendering file that can convert the font source file into a file that can be used for page rendering without registering the custom font to the device system, and this method can be applicable to any type of rendering framework.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technologies, specifically to the fields of information flow and web page processing, and can be applied to scenarios such as page rendering. Background Art

[0002] When it is necessary to display a page of an application, it is necessary to render the content of the page based on a rendering framework. During the page rendering process of the application, it is usually necessary to render the text content in the page based on a specified font. For some applications, developers configure custom fonts for them, and users may expect to render the text content in the page based on the custom fonts. However, some existing rendering frameworks support rendering the text content in the page based on the custom fonts of the application, which cannot meet the user requirements. Summary of the Invention

[0003] The present disclosure provides a page rendering method, apparatus, electronic device, and storage medium.

[0004] According to a first aspect of the present disclosure, there is provided a page rendering method, including:

[0005] Responding to a page rendering trigger event for a target application, determining a target font to be used from at least one custom font of the target application;

[0006] Reading file path information of the target font from a first storage location, and obtaining a target font source file through the file path information of the target font; wherein, the file path information corresponding to each custom font is extracted from an installation file and saved in the first storage location during the installation of the target application;

[0007] Converting the target font source file into a target font rendering file;

[0008] Rendering the text content of the current page of the target application based on the target font rendering file.

[0009] According to a second aspect of the present disclosure, there is provided a page rendering apparatus, including:

[0010] A font determination module, configured to respond to a page rendering trigger event for a target application, and determine a target font to be used from at least one custom font of the target application;

[0011] A source file acquisition module, configured to read file path information of the target font from a first storage location, and obtain a target font source file through the file path information of the target font; wherein, the file path information corresponding to each custom font is extracted from an installation file and saved in the first storage location during the installation of the target application;

[0012] A rendering file acquisition module, configured to convert a target font source file into a target font rendering file;

[0013] A page rendering module, configured to render the text content of the current page of a target application based on the target font rendering file.

[0014] According to a third aspect of the present disclosure, there is provided an electronic device, including:

[0015] At least one processor; and a memory communicatively connected to the at least one processor; wherein, the memory stores instructions executable by the at least one processor, and when the instructions are executed by the at least one processor, the at least one processor is enabled to execute the above-mentioned page rendering method.

[0016] According to a fourth aspect of the present disclosure, there is provided a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to cause the computer to execute the above-mentioned page rendering method.

[0017] According to a fifth aspect of the present disclosure, there is provided a computer program product, including a computer program, and when the computer program is executed by a processor, the above-mentioned page rendering method is implemented.

[0018] It should be understood that the content described in this part is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it used to limit the scope of the present disclosure. Other features of the present disclosure will become easily understandable through the following description.

[0019] The beneficial effects brought by the technical solution provided by the present disclosure are:

[0020] In the technical solution of the present disclosure, during the installation of a target application, the path information of a custom font can be saved in advance. Without registering the custom font to the device system, the font source file of the custom font can be obtained through the path information, and the font source file can be converted into a font rendering file that can be used for page rendering. This method can be applied to any type of rendering framework, ensuring that users can render the text content in a page with the custom font selected according to their wishes, greatly meeting the user's needs. Description of the Drawings

[0021] The drawings are used to better understand the present solution and do not constitute a limitation to the present disclosure. Among them:

[0022] Figure 1 Shows a schematic flowchart of a page rendering method provided by an embodiment of the present disclosure;

[0023] Figure 2Shows a schematic flowchart of another page rendering method provided by an embodiment of the present disclosure;

[0024] Figure 3 Shows one of the schematic diagrams of a page rendering device provided by an embodiment of the present disclosure;

[0025] Figure 4 Shows another schematic diagram of a page rendering device provided by an embodiment of the present disclosure;

[0026] Figure 5 Shows yet another schematic diagram of a page rendering device provided by an embodiment of the present disclosure;

[0027] Figure 6 Shows a schematic block diagram of an example electronic device that can be used to implement the page rendering method provided by an embodiment of the present disclosure. Detailed implementation manners

[0028] The following describes exemplary embodiments of the present disclosure with reference to the accompanying drawings. Various details of the embodiments of the present disclosure are included to facilitate understanding, and they should be considered merely exemplary. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.

[0029] When a page of an application needs to be displayed, it is necessary to render the content of the page based on a rendering framework. During the page rendering process of an application, it is usually necessary to render the text content in the page based on a specified font. For some applications, developers configure custom fonts for them, and users may expect to render the text content in the page based on the custom fonts. However, some existing rendering frameworks support rendering the text content in the page based on the custom fonts of the application, which cannot meet the user's needs.

[0030] Taking the page rendering scenario of a small program as an example, the rendering method of the page of the small program has always been to use the WebView rendering framework to render the page. Here, WebView refers to a web view. It can be embedded in a mobile device to achieve hybrid front-end development, and most hybrid development frameworks are secondary developed based on the WebView mode.

[0031] With the continuous development of mini-programs, the usage scenarios of mini-programs are becoming increasingly rich. In order to achieve smoother page rendering on low-end devices or in-vehicle systems, developers choose to use other types of rendering frameworks, such as using the NaView rendering framework to render the pages of mini-programs to improve the rendering performance of mini-program pages. However, the NaView rendering framework can support rendering the pages of mini-programs based on the system fonts of the device, but often cannot support rendering the pages based on the custom fonts configured for the mini-programs. Specifically, if a rendering framework can support the font-face interface, it can render the pages of mini-programs based on the custom fonts configured for the mini-programs. However, the NaView rendering framework itself does not support the font-face interface. Although the NaView rendering framework provides an Add Rule interface to load custom fonts, the Add Rule interface requires the Postscript (page description language) of the custom font to be special enough to avoid conflicts with the fonts of the device system. Generally, developers often cannot provide fonts with special Postscripts.

[0032] The page rendering method, device, electronic device, and storage medium provided by the embodiments of the present disclosure aim to solve at least one of the above technical problems in the prior art.

[0033] Figure 1 The flowchart of a page rendering method provided by the embodiments of the present disclosure is shown, as Figure 1 shown, the method mainly may include the following steps:

[0034] S110: In response to a page rendering trigger event for a target application, determine a target font to be used from at least one custom font of the target application.

[0035] In the embodiments of the present disclosure, a developer configures at least one custom font for the target application. When displaying the page of the target application, the text content in the page can be drawn based on the custom font.

[0036] Optionally, the target font may be the default font among at least one custom font configured for the target application. For example, when a developer configures a custom font for the target application, a custom font can be selected as the default font. When displaying the page of the target application, the text content in the page can be automatically drawn based on the default font.

[0037] Optionally, the target font may be a font determined from at least one custom font based on the user's font selection operation. For example, during the installation or running of the target application, a font selection interface may be presented, which includes each custom font configured for the target application. The user can select a custom font from the custom fonts, and the custom font selected by the user may be determined as the target font.

[0038] In the embodiments of the present disclosure, the page rendering trigger event may be any event that can indicate the application to display a page. For example, the page rendering trigger event can indicate the application to display a new page or redisplay the current page. The page rendering trigger event may include: starting the target application, refreshing the page of the target application, replacing the page of the target application, and opening the detail page of the page of the target application. Here, starting the target application means that the user opens the target application that is in an unrun state, and at this time, the target application needs to display the content of the home page; refreshing the page of the target application means updating the content of the page currently displayed by the target application; replacing the page of the target application means performing operations such as turning pages, scrolling pages, or jumping pages to display other pages; opening the detail page of the page of the target application means displaying the sub-page included in the current page. It can be understood that the page rendering trigger event is not limited to this, and the embodiments of the present disclosure do not make any restrictions on this.

[0039] S120: Read the file path information of the target font from the first storage location, and obtain the target font source file through the file path information of the target font.

[0040] In the embodiments of the present disclosure, the file path information corresponding to each custom font is the first storage location extracted and saved from the installation file during the installation of the target application. It can be understood that each custom font has a corresponding font source file. For the convenience of understanding and expression, the embodiments of the present disclosure define the target font as the target font source file. The file path information of each custom font can indicate the storage location of the source file of the font. Therefore, the target font source file can be obtained from the specified storage location through the file path information of the target font.

[0041] It can be understood that before performing step S110, the target application needs to be installed on the device. Specifically, the embodiments of the present disclosure may respond to the installation trigger event for the target application, read the names and path information of at least one custom font from the installation file; after reading the names and path information of each custom font, the names and path information of each custom font may be associated and stored in the first storage location. At the same time, when installing the target application, the source files of each custom font configured for the target application may be stored in the second storage location. It should be noted here that when installing the target application on the device, it is not necessary to register the custom font with the device system.

[0042] Taking the target application as a small program as an example, when installing the small program on the device, the font names and path information of each custom font defined by font-face in the installation package of the small program can be read, and then the font names and path information of each custom font are saved in the first storage location in the form of a map. Here, font-face is a module in the Cascading Style Sheet (CSS3) that allows the use of custom fonts, mainly for embedding the self-defined Web fonts into the page; the storage of Map is implemented by means of an array and a linked list.

[0043] Optionally, in step S120, the embodiments of the present disclosure may determine the name of the target font; based on the name of the target font, read the corresponding file path information from the first storage location; determine the second storage location based on the file path information, and obtain the target font source file from the second storage location.

[0044] S130: Convert the target font source file into a target font rendering file.

[0045] The embodiments of the present disclosure may create a directly accessible data provider (Data Provider) for the target font source file by using Core Graphics functions, and then create a font object, and convert the font object into a target font rendering file. Here, the target font rendering file is Font, which is used to specify information such as the font, font size, and font color of the text.

[0046] S140: Render the text content of the current page of the target application based on the target font rendering file.

[0047] It can be understood that after obtaining the target font rendering file, the text content in the current page can be drawn in the target font corresponding to the target font rendering file.

[0048] Optionally, before step S140, the target font rendering file and the target font may also be associated and stored in a third storage location. After the target font rendering file and the target font are associated and stored in the third storage location, in response to a page rendering trigger event for the target application again, the target font rendering file may be called from the third storage location; based on the target font rendering file, the text content of the current page of the target application is rendered.

[0049] The page rendering method provided by the embodiments of the present disclosure can pre-save the path information of the custom font during the installation of the target application. Without registering the custom font to the device system, the font source file of the custom font can be obtained through the path information, and the font source file can be converted into a font rendering file that can be used for page rendering. This method can be applied to any type of rendering framework, ensuring that users can render the text content on the page with the custom font selected according to their wishes, greatly meeting the user's needs.

[0050] Figure 2 The flowchart of another page rendering method provided by the embodiments of the present disclosure is shown in Figure 2 As shown, this method mainly includes the following steps:

[0051] S210: In response to a page rendering trigger event for the target application, determine the target font to be used from at least one custom font of the target application.

[0052] S220: Read the file path information of the target font from the first storage location, and obtain the target font source file through the file path information of the target font.

[0053] S230: Convert the target font source file into a target font rendering file.

[0054] S240: Render the text content of the current page of the target application based on the target font rendering file.

[0055] In the embodiments of the present disclosure, for the specific content of steps S210 to S240, reference may be made to the corresponding descriptions in steps S110 to S140, which will not be elaborated here.

[0056] S250: Associatively store the target font rendering file and the target font in the third storage location.

[0057] In the present disclosure, after obtaining the target font rendering file, the target font rendering file is associated with the target font. For example, the target font rendering file is associated with the name of the target font, and then the target font rendering file and the target font are stored in the third storage location, so that when the text content on the page needs to be rendered with the target font next time, the target font rendering file can be directly called from the third storage location.

[0058] S260: In response to a page rendering trigger event for the target application, call the target font rendering file from the third storage location.

[0059] It can be understood that during the running of the target application, page rendering operations can be performed multiple times. After obtaining the target font rendering file, when the page rendering trigger event of the target application is detected again, there is no need to regenerate the target font rendering file. Instead, the previously generated target font rendering file can be called, saving computing resources and rendering time and improving the rendering efficiency.

[0060] S270: Render the text content of the current page of the target application based on the target font rendering file.

[0061] It can be understood that after obtaining the target font rendering file, the text content in the current page can be drawn in the target font corresponding to the target font rendering file.

[0062] Based on the same principle as the above page rendering method, an embodiment of the present disclosure further provides a page rendering device. Figure 3 FIG. 1 shows a schematic diagram of a page rendering device provided by an embodiment of the present disclosure. Figure 4 FIG. 2 shows a schematic diagram of a page rendering device provided by an embodiment of the present disclosure. Figure 5 FIG. 3 shows a schematic diagram of a page rendering device provided by an embodiment of the present disclosure.

[0063] As Figure 3 shown, the page rendering device 300 includes a font determination module 310, a source file acquisition module 320, a rendering file acquisition module 330, and a page rendering module 340.

[0064] The font determination module 310 is configured to determine a target font to be used from at least one custom font of the target application in response to a page rendering trigger event for the target application.

[0065] The source file acquisition module 320 is configured to read the file path information of the target font from a first storage location, and obtain the target font source file through the file path information of the target font. The file path information corresponding to each custom font is extracted from the installation file and saved in the first storage location during the installation of the target application.

[0066] The rendering file acquisition module 330 is configured to convert the target font source file into a target font rendering file.

[0067] The page rendering module 340 is configured to render the text content of the current page of the target application based on the target font rendering file.

[0068] The page rendering device provided by the embodiments of the present disclosure can pre-save the path information of custom fonts during the installation of the target application. Without registering the custom fonts to the device system, the font source files of the custom fonts can be obtained through the path information, and the font source files can be converted into font rendering files that can be used for page rendering. This method can be applied to any type of rendering framework, ensuring that users can render the text content on the page with the custom fonts selected according to their wishes, greatly meeting the user requirements.

[0069] Optionally, as Figure 4 shown, in addition to the font determination module 310, the source file acquisition module 320, the rendering file acquisition module 330, and the page rendering module 340, the page rendering device 300 of the embodiments of the present disclosure further includes a font information extraction module 350, and the font information extraction module 350 is configured to:

[0070] In response to an installation trigger event for the target application, read the names and path information of at least one custom font from the installation file;

[0071] Associate and store the name and path information of each custom font at a first storage location.

[0072] In the embodiments of the present disclosure, when the source file acquisition module 320 is configured to read the file path information of the target font from the first storage location and obtain the target font source file through the file path information of the target font, it is specifically configured to:

[0073] Determine the name of the target font;

[0074] Based on the name of the target font, read the corresponding file path information from the first storage location;

[0075] Determine a second storage location based on the file path information, and obtain the target font source file from the second storage location.

[0076] Optionally, as Figure 5 shown, in addition to the font determination module 310, the source file acquisition module 320, the rendering file acquisition module 330, and the page rendering module 340, the page rendering device 300 of the embodiments of the present disclosure further includes a rendering file storage module 360, and the rendering file storage module 360 is configured to associate and store the target font rendering file with the target font at a third storage location.

[0077] In the embodiments of the present disclosure, the page rendering module 340 is further configured to:

[0078] In response to a page rendering trigger event for the target application, call the target font rendering file from the third storage location;

[0079] Render the text content of the current page of the target application based on the target font rendering file.

[0080] In the embodiments of the present disclosure, the page rendering trigger events include: starting the target application, refreshing the page of the target application, replacing the page of the target application, and opening the detail page of the page of the target application.

[0081] In the embodiments of the present disclosure, the target font is the default font among at least one custom font; or, the target font is a font determined from at least one custom font based on the user's font selection operation.

[0082] It can be understood that each of the above modules of the page rendering device in the embodiments of the present disclosure has the function of implementing the corresponding steps of the above page rendering method. This function can be implemented by hardware or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above functions. The above modules can be software and / or hardware, and the above modules can be implemented separately or integrated by multiple modules. For the function descriptions of each module of the above page rendering device, reference can be specifically made to the corresponding descriptions of the above page rendering method, which will not be elaborated here.

[0083] In the technical solution of the present disclosure, the collection, storage, use, processing, transmission, provision, and disclosure of the user's personal information involved are all in compliance with the provisions of relevant laws and regulations and do not violate public order and good customs.

[0084] According to the embodiments of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium, and a computer program product.

[0085] Figure 6 A schematic block diagram of an example electronic device that can be used to implement the embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as, laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as, personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or claimed herein.

[0086] As Figure 6As shown, device 600 includes a computing unit 601, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 602 or a computer program loaded from a storage unit 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the device 600 can also be stored. The computing unit 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.

[0087] Multiple components in the device 600 are connected to the I / O interface 605, including: an input unit 606, such as a keyboard, a mouse, etc.; an output unit 607, such as various types of displays, speakers, etc.; a storage unit 608, such as a magnetic disk, an optical disc, etc.; and a communication unit 609, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 609 allows the device 600 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.

[0088] The computing unit 601 can be various general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 601 include but are not limited to a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The computing unit 601 executes the various methods and processes described above, such as the page rendering method. For example, in some embodiments, the page rendering method can be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as the storage unit 608. In some embodiments, part or all of the computer program can be loaded and / or installed onto the device 600 via the ROM 602 and / or the communication unit 609. When the computer program is loaded into the RAM 603 and executed by the computing unit 601, one or more steps of the page rendering method described above can be executed. Alternatively, in other embodiments, the computing unit 601 can be configured to execute the page rendering method by any other appropriate means (e.g., by means of firmware).

[0089] The various embodiments of the systems and techniques described above in this document can be implemented in digital electronic circuitry, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on a chip (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include: being implemented in one or more computer programs that are executable and / or interpretable on a programmable system including at least one programmable processor, which can be a special-purpose or general-purpose programmable processor that receives data and instructions from a storage system, at least one input device, and at least one output device, and transmits the data and instructions to the storage system, the at least one input device, and the at least one output device.

[0090] The program code for implementing the methods of the present disclosure can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when the program codes are executed by the processor or controller, the functions / operations specified in the flowcharts and / or block diagrams are implemented. The program code can be executed entirely on the machine, partially on the machine, as a stand-alone software package partially on the machine and partially on a remote machine, or entirely on a remote machine or server.

[0091] In the context of the present disclosure, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in connection with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0092] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the computer. Other kinds of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0093] The systems and techniques described herein can be implemented in a computing system including backend components (e.g., as a data server), or a computing system including middleware components (e.g., an application server), or a computing system including frontend components (e.g., a user computer having a graphical user interface or a web browser through which the user can interact with an implementation of the systems and techniques described herein), or a computing system including any combination of such backend components, middleware components, or frontend components. The components of the system can be interconnected to each other by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local area network (LAN), wide area network (WAN), and the Internet.

[0094] A computer system can include a client and a server. The client and the server are generally far from each other and usually interact through a communication network. The relationship between the client and the server is generated by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, or a server of a distributed system, or a server incorporating a blockchain.

[0095] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps recited in this disclosure can be executed in parallel, sequentially, or in a different order, as long as the desired results of the technical solution disclosed in this disclosure can be achieved, and no limitation is imposed herein.

[0096] The above specific embodiments do not constitute a limitation on the protection scope of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure shall be included within the protection scope of this disclosure.

Claims

1. A page rendering method, comprising: In response to an installation trigger event for a target application, reading the name and path information of at least one custom font defined by a client font module from an installation file; storing the name and path information of each said custom font in an associated manner through an array and a linked list at a first storage location; The client font module is a module in a cascading style sheet that allows the use of custom fonts; In response to a page rendering trigger event for the target application, determining a target font to be used from at least one custom font of the target application; Reading the file path information of the target font from the first storage location, and obtaining a target font source file through the file path information of the target font; wherein, the file path information corresponding to each said custom font is extracted from the installation file and saved at the first storage location during the installation of the target application; Creating a direct access data provider for the target font source file, creating a font object, and converting the font object into a target font rendering file; the target font rendering file is used to specify the font, font size, and font color of text; Based on the target font rendering file, rendering the text content of the current page of the target application.

2. The method according to claim 1, wherein, The reading the file path information of the target font from the first storage location and obtaining a target font source file through the file path information of the target font includes: Determining the name of the target font; Based on the name of the target font, reading the corresponding file path information from the first storage location; Determining a second storage location based on the file path information, and obtaining a target font source file from the second storage location.

3. The method according to claim 1, after converting the target font source file into a target font rendering file, further includes: Associatively storing the target font rendering file with the target font at a third storage location.

4. According to the method described in claim 3, after associatively storing the target font rendering file with the target font at the third storage location, further comprising: In response to a page rendering trigger event for the target application, calling the target font rendering file from the third storage location; Based on the target font rendering file, rendering the text content of the current page of the target application.

5. The method according to any one of claims 1-4, wherein the page rendering trigger event includes: Starting the target application, refreshing the page of the target application, replacing the page of the target application, or opening the details page of the page of the target application.

6. According to the method described in any one of claims 1-4, the target font is the default font among the at least one custom font; or, the target font is a font determined from the at least one custom font based on a user's font selection operation.

7. A page rendering device, comprising: A font information extraction module, configured to, in response to an installation trigger event for a target application, read the name and path information of at least one custom font defined by a client font module from an installation file; store the name and path information of each said custom font in an associated manner through an array and a linked list at a first storage location; The client font module is a module in a cascading style sheet that allows the use of custom fonts; A font determination module, configured to determine a target font to be used from at least one custom font of the target application in response to a page rendering trigger event for the target application; A source file acquisition module, configured to read file path information of the target font from a first storage location, and obtain a target font source file through the file path information of the target font; wherein, the file path information corresponding to each custom font is extracted from an installation file and saved in the first storage location during the installation of the target application; A rendering file acquisition module, configured to create a direct access data provider for the target font source file, create a font object, and convert the font object into a target font rendering file; the target font rendering file is used to specify the font, font size, and font color of text; A page rendering module, configured to render the text content of the current page of the target application based on the target font rendering file.

8. The device according to claim 7, wherein When the source file acquisition module is configured to read file path information of the target font from a first storage location and obtain a target font source file through the file path information of the target font, it is specifically configured to: Determine the name of the target font; Based on the name of the target font, read the corresponding file path information from the first storage location; Determine a second storage location based on the file path information, and obtain a target font source file from the second storage location.

9. The apparatus according to claim 7, further comprising a rendering file storage module, configured to associate and store the target font rendering file with the target font in a third storage location.

10. The apparatus according to claim 9, wherein the page rendering module is further configured to: In response to a page rendering trigger event for the target application, call the target font rendering file from the third storage location; Based on the target font rendering file, render the text content of the current page of the target application.

11. The apparatus according to any one of claims 7-10, wherein the page rendering trigger event includes: Start the target application, refresh the page of the target application, replace the page of the target application, or open the detail page of the page of the target application.

12. The apparatus according to any one of claims 7-10, wherein the target font is the default font among the at least one custom font; or, the target font is a font determined from the at least one custom font based on a user's font selection operation.

13. An electronic device, comprising: At least one processor; And A memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, and when the instructions are executed by the at least one processor, the at least one processor is enabled to execute the method according to any one of claims 1-6.

14. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to cause the computer to execute the method according to any one of claims 1-6.

15. A computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the method according to any one of claims 1-6 is implemented.

Citation Information

Patent Citations

  • Page display method and device for application program (APP), equipment and storage medium

    CN107704299A