Method and device for simulating system fonts in browser environment, equipment and medium

By selecting an open-source font that covers both Chinese and English in the browser environment, and modifying and installing the font file using the font server interface, the issues of high network traffic and privacy security are resolved, achieving abnormal display and privacy protection.

CN121542525APending Publication Date: 2026-02-17ZIXUN TECHNOLOGY (FUJIAN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511345475.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-09-19
Publication Date
2026-02-17

AI Technical Summary

Technical Problem

Existing technologies require downloading all fonts during browser spoofing, resulting in high network traffic and easy identification by websites, thus affecting user privacy and security.

Method used

Select an open-source font that covers both Chinese and English, send metadata information through the font server interface, modify and save it as a TTF file, install and clear the cache to ensure the font file is effective, and simulate fonts from other systems.

Benefits of technology

It eliminates the need to download all fonts, reduces network traffic, avoids abnormal text display, and ensures user privacy and security by preventing website detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121542525A_ABST
    Figure CN121542525A_ABST
Patent Text Reader

Abstract

The invention provides a method, a device, equipment and a medium for simulating system fonts in a browser environment, and the method comprises the following steps: selecting an open source font covering Chinese and English, and downloading the open source font to a user side; issuing first metadata information of fonts of a system to be simulated through a set font server interface; loading the open source fonts, modifying second metadata information in the open source fonts into first metadata information, and storing the first metadata information as a font file in a ttf format; copying the font file to a font directory for installation; the font cache is cleared, the font corresponding to the font file takes effect, and when the fingerprint browser needs to be disguised as a browser of other systems, it is guaranteed that the fingerprint browser is not identified by a site, and privacy security of a user is guaranteed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of browser technology, and in particular to a method, apparatus, device, and medium for simulating system fonts in a browser environment. Background Technology

[0002] Currently, fingerprint browsers on the market need to download and install every single font to avoid being identified by websites through font fingerprinting. However, fonts vary greatly across different platforms, and downloading every font would require several gigabytes of network traffic every time the system changes. Therefore, existing technologies mainly use font forgery, but this method can cause some text on the page to be displayed as "□". At the same time, if a website uses a combination of multiple recognition methods to brute-force enumerate the supported fonts, it can also mark the browser's font characteristics. Summary of the Invention

[0003] The technical problem to be solved by the present invention is to provide a method, apparatus, device and medium for simulating system fonts in a browser environment, so as to ensure that the fingerprint browser is not identified by the site when it needs to disguise itself as a browser of other systems, thus ensuring the privacy and security of users.

[0004] In a first aspect, the present invention provides a method for simulating system fonts in a browser environment, comprising the following steps:

[0005] Step 1: Select an open-source font that covers both Chinese and English, and download it to the user's device;

[0006] Step 2: Send the first metadata information of the font of the system to be simulated through the set font server interface;

[0007] Step 3: Load the open-source font, modify the second metadata information in the open-source font to the first metadata information, and save it as a font file in TTF format;

[0008] Step 4: Copy the font file to the font directory and install it;

[0009] Step 5: Clear the font cache to make the font file corresponding to the font effective.

[0010] Secondly, the present invention provides an apparatus for simulating system fonts in a browser environment, comprising:

[0011] Download the open-source font module, select an open-source font that covers both Chinese and English, and download it to the user's device;

[0012] The font information acquisition module sends the first metadata information of the font to be simulated through the set font server interface;

[0013] Modify the metadata module, load the open-source font, modify the second metadata information in the open-source font to the first metadata information, and save it as a font file in TTF format;

[0014] To install the font module, copy the font file to the font directory and install it.

[0015] The font activation module clears the font cache and activates the font corresponding to the font file.

[0016] Thirdly, the present invention provides an electronic device including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the method described in the first aspect.

[0017] Fourthly, the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described in the first aspect.

[0018] One or more technical solutions provided by this invention have at least the following technical effects or advantages:

[0019] The font simulation method of this invention conforms to the normal font installation process, avoiding the situation where the browser displays text as "□" due to the absence of fonts; it also solves the problem of needing to download all relevant font files; and when the fingerprint browser needs to disguise itself as a browser of other systems, it ensures that it is not recognized by the site, thus guaranteeing the user's privacy and security.

[0020] The above description is merely an overview of the technical solution of the present invention. In order to better understand the technical means of the present invention and to implement it in accordance with the contents of the specification, and to make the above and other objects, features and advantages of the present invention more apparent and understandable, specific embodiments of the present invention are described below. Attached Figure Description

[0021] The present invention will be further described below with reference to the accompanying drawings and embodiments.

[0022] Figure 1 This is a flowchart of the method in Embodiment 1 of the present invention;

[0023] Figure 2 This is a schematic diagram of the device in Embodiment 2 of the present invention. Detailed Implementation

[0024] The overall concept of the technical solution in this application is as follows:

[0025] To avoid potential font copyright issues, we can choose an open-source font that covers both Chinese and English; let's assume that the font is OpenA.

[0026] Step 1: The font server interface sends the metadata information of the font list for the corresponding system. Assuming the interface is APIA, the format is as follows:

[0027]

[0028] Step 2: Run the local Python script as administrator. Based on the array returned by API A, iterate through the metadata list, load OpenA, and modify and save the font metadata according to API A into a compatible .ttf format font file. The core code is as follows:

[0029]

[0030]

[0031] Step 3: Copy the generated font files to the font directory for installation, and record the font list at this time (list of installed fonts).

[0032] Step 4: Clear the font cache to make the font take effect; the core code is:

[0033]

[0034]

[0035]

[0036] If you need to add fonts for other system versions at this time, first delete the installed font list 1 recorded in step 3, and then repeat steps 1 to 4.

[0037] Example 1

[0038] like Figure 1 As shown, this embodiment provides a method for simulating system fonts in a browser environment, including the following steps:

[0039] Step 1: Select an open-source font that covers both Chinese and English, and download it to the user's device;

[0040] Step 2: Send the first metadata information of the font of the system to be simulated through the set font server interface;

[0041] Step 3: Load the open-source font, modify the second metadata information in the open-source font to the first metadata information, and save it as a font file in TTF format;

[0042] Step 4: Copy the font file to the font directory and install it;

[0043] Step 5: Clear the font cache to activate the font corresponding to the font file. Since the font of this invention is actually installed, no matter what method a website uses, it cannot detect the font spoofing method of this invention, thus ensuring user privacy and security.

[0044] In this embodiment, preferably, step 2 specifically involves: sending the first metadata information of the font to be simulated through the set font server interface, wherein the first metadata information is the attribute values ​​of the font_name and family_name of the font.

[0045] In this embodiment, preferably, step 3 specifically involves: loading the open-source font, modifying the second metadata information in the open-source font to the first metadata information, wherein the second metadata information is the attribute values ​​of font_name and family_name of the open-source font; and saving it as a font file in TTF format.

[0046] In this embodiment, preferably, step 4 specifically involves: copying the font file to the font directory for installation and recording it in the list of installed fonts;

[0047] Step 5 specifically involves: first, stopping the font caching service; then, obtaining the font cache file; if the cache file exists, deleting it; if it does not exist, doing nothing; and finally, restarting the font caching service.

[0048] Based on the same inventive concept, this application also provides an apparatus corresponding to the method in Embodiment 1, as detailed in Embodiment 2.

[0049] Example 2

[0050] like Figure 2 As shown, this embodiment provides a device for simulating system fonts in a browser environment, including: downloading an open-source font module, selecting an open-source font that covers both Chinese and English, and downloading it to the user's terminal;

[0051] The font information acquisition module sends the first metadata information of the font to be simulated through the set font server interface;

[0052] Modify the metadata module, load the open-source font, modify the second metadata information in the open-source font to the first metadata information, and save it as a font file in TTF format;

[0053] To install the font module, copy the font file to the font directory and install it.

[0054] The font activation module clears the font cache and activates the font corresponding to the font file.

[0055] In this embodiment, preferably, the module for obtaining font information specifically involves: sending the first metadata information of the font to be simulated through a set font server interface, wherein the first metadata information is the attribute values ​​of the font_name and family_name of the font.

[0056] In this embodiment, preferably, the modification of metadata module specifically involves: loading the open-source font, modifying the second metadata information in the open-source font to the first metadata information, wherein the second metadata information is the attribute values ​​of font_name and family_name of the open-source font; and saving it as a font file in TTF format.

[0057] In this embodiment, preferably, the font installation module specifically involves: copying the font file to the font directory for installation, and recording it in the list of installed fonts;

[0058] The font activation module works as follows: first, the font caching service is disabled; then, the font cache file is retrieved. If the cache file exists, it is deleted; otherwise, no action is taken; finally, the font caching service is restarted.

[0059] Since the apparatus described in Embodiment 2 of the present invention is an apparatus used to implement the method of Embodiment 1 of the present invention, those skilled in the art can understand the specific structure and variations of the apparatus based on the method described in Embodiment 1 of the present invention, and therefore will not be described again here. All apparatuses used in the method of Embodiment 1 of the present invention fall within the scope of protection of the present invention.

[0060] Based on the same inventive concept, this application provides an electronic device embodiment corresponding to Embodiment 1, as detailed in Embodiment 3.

[0061] Example 3

[0062] This embodiment provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it can implement any of the implementation methods in Embodiment 1.

[0063] Since the electronic device described in this embodiment is the device used to implement the method in Embodiment 1 of this application, those skilled in the art can understand the specific implementation method and various variations of the electronic device in this embodiment based on the method described in Embodiment 1 of this application. Therefore, how the electronic device implements the method in the embodiment of this application will not be described in detail here. Any device used by those skilled in the art to implement the method in the embodiment of this application falls within the scope of protection of this application.

[0064] Based on the same inventive concept, this application provides a storage medium corresponding to Embodiment 1, as detailed in Embodiment 4.

[0065] Example 4

[0066] This embodiment provides a computer-readable storage medium storing a computer program thereon. When the computer program is executed by a processor, it can implement any of the implementation methods in Embodiment 1.

[0067] The technical solutions provided in this application embodiment have at least the following technical effects or advantages:

[0069] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

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

[0071] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0072] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1The steps of the function specified in one or more boxes.

[0073] While specific embodiments of the present invention have been described above, those skilled in the art should understand that the specific embodiments described are merely illustrative and not intended to limit the scope of the present invention. Equivalent modifications and variations made by those skilled in the art in accordance with the spirit of the present invention should be covered within the scope of protection of the claims of the present invention.

Claims

1. A method for emulating system fonts in a browser environment, the method comprising: It comprises the following steps: ​ Step 1, select a cover Chinese and English open source font, download it to the user end; Step 2, the first metadata information of the font of the system to be simulated is issued through the set font server interface; Step 3, load the open source font, modify the second metadata information in the open source font to the first metadata information, save it as a ttf format font file; Step 4, copy the font file to the font directory for installation; Step 5, clear the font cache, and make the font corresponding to the font file effective.

2. The method for emulating system fonts in a browser environment according to claim 1, wherein: The step 2 is specifically: the first metadata information of the font of the system to be simulated is issued through the set font server interface, and the first metadata information is the attribute value of font_name and family_name of the font.

3. The method for emulating system fonts in a browser environment according to claim 1, wherein: The step 3 is specifically: load the open source font, modify the second metadata information in the open source font to the first metadata information, and the second metadata information is the attribute value of font_name and family_name of the open source font; save it as a ttf format font file.

4. The method for emulating system fonts in a browser environment according to claim 1, wherein: The step 4 is specifically: copy the font file to the font directory for installation, and record it in the installed font list; The step 5 is specifically: first, stop the font cache service, then get the font cache file, if the cache file exists, delete it; if it does not exist, do not process; finally, restart the font cache service.

5. An apparatus for emulating system fonts in a browser environment, the apparatus comprising: a browser environment; a system font; a font emulation module; and a font emulation module interface. It comprises: The open source font downloading module selects a cover Chinese and English open source font, and downloads it to the user end; The font information acquisition module issues the first metadata information of the font of the system to be simulated through the set font server interface; The metadata modification module loads the open source font, modifies the second metadata information in the open source font to the first metadata information, and saves it as a ttf format font file; The font installation module copies the font file to the font directory for installation; The font effective module clears the font cache, and makes the font corresponding to the font file effective.

6. The apparatus for emulating system fonts in a browser environment of claim 5, wherein: The font information acquisition module is specifically: the first metadata information of the font of the system to be simulated is issued through the set font server interface, and the first metadata information is the attribute value of font_name and family_name of the font.

7. The apparatus for emulating system fonts in a browser environment of claim 5, wherein: The metadata modification module is specifically: load the open source font, modify the second metadata information in the open source font to the first metadata information, and the second metadata information is the attribute value of font_name and family_name of the open source font; save it as a ttf format font file.

8. The apparatus for emulating system fonts in a browser environment of claim 5, wherein: The font installation module is specifically: copy the font file to the font directory for installation, and record it in the installed font list; The font effective module is specifically: first, stop the font cache service, then get the font cache file, if the cache file exists, delete it; if it does not exist, do not process; finally, restart the font cache service.

9. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, The processor executes the program to realize the method of any one of claims 1 to 4.

10. A computer-readable storage medium having stored thereon a computer program, characterized in that, The program, when executed by the processor, implements the method of any one of claims 1 to 4.