Font detection method and device, equipment and medium

By scanning and comparing the hash values ​​and authorization periods of font files, the problem of unauthorized or expired font use in application development is solved, font compliance detection and management are achieved, and infringement is prevented.

CN120597243APending Publication Date: 2025-09-05BEIJING QIYI CENTURY SCI & TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510689451.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-27
Publication Date
2025-09-05

AI Technical Summary

Technical Problem

During the application development phase, developers may use fonts that are not authorized or have exceeded the authorization period, which may lead to font infringement.

Method used

By scanning the font file to be tested, calculating its hash value and comparing it with the hash value and authorization period of the authorized font in the database, a test report is output to determine whether it is a compliant font, and non-compliant fonts are deleted or replaced if necessary.

Benefits of technology

It effectively prevents font infringement caused by unauthorized fonts or overdue font use, and ensures compliance with font usage during application development.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120597243A_ABST
    Figure CN120597243A_ABST
Patent Text Reader

Abstract

The invention relates to a font detection method and device, equipment and a medium. The font detection method comprises the steps of scanning a to-be-detected font file in a code directory in response to a font detection trigger instruction, and calculating a first hash value corresponding to a to-be-detected font according to the to-be-detected font file; furthermore, second hash values and authorization deadlines corresponding to a plurality of authorization fonts are obtained from a database, the first hash value is compared with any second hash value, and if the first hash value is not consistent with the second hash value corresponding to any authorization font in the database, the authorization fonts are authorized. Or if the first hash value is consistent with a second hash value corresponding to any authorized font in the database and the current use time of the to-be-detected font is not within the authorization time limit, determining that the to-be-detected font is a non-compliant font. Therefore, the problem of font infringement caused by the fact that developers do not use authorized fonts or use fonts exceeding the authorization deadline in the development stage of the application program is effectively prevented.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of intelligent analysis, and in particular to a font detection method, device, equipment, and medium. Background Art

[0002] With the continuous development of technology, users can install various applications (APPs) with different functions on their terminal devices. However, during the development stage of the application, the fonts used by developers to write code may be unlicensed fonts or fonts whose license period has expired, thus causing font infringement issues. Summary of the Invention

[0003] In order to solve the above technical problems or at least partially solve the above technical problems, the present disclosure provides a font detection method, device, equipment and medium to effectively prevent font infringement caused by developers not using authorized fonts or using fonts that have exceeded the authorization period during the development stage of an application.

[0004] In a first aspect, an embodiment of the present disclosure provides a font detection method, the method comprising:

[0005] In response to the font detection trigger instruction, scanning the font file to be detected associated with the code, wherein the font file to be detected includes version information and identification information of the font to be detected;

[0006] Performing a hash calculation on the font file to be detected to obtain a first hash value corresponding to the font to be detected;

[0007] Obtaining second hash values ​​and authorization periods corresponding to a plurality of authorized fonts from a database, wherein the second hash value corresponding to any authorized font is obtained by performing a hash calculation on an authorized font file corresponding to the authorized font, the authorized font file including version information and identification information of the authorized font;

[0008] If the first hash value is inconsistent with the second hash value corresponding to any authorized font in the database, or the first hash value is consistent with the second hash value corresponding to any authorized font in the database and the current usage time of the font to be detected has exceeded the authorization period, then the font to be detected is determined to be a non-compliant font;

[0009] A first detection report is output, where the first detection report includes the to-be-detected font file or metadata of the to-be-detected font in the to-be-detected font file.

[0010] In a second aspect, an embodiment of the present disclosure provides a font detection device, the device comprising:

[0011] A scanning module, configured to scan a font file to be detected associated with the code in response to a font detection trigger instruction, wherein the font file to be detected includes version information and identification information of the font to be detected;

[0012] A calculation module, configured to perform a hash calculation on the font file to be detected to obtain a first hash value corresponding to the font to be detected;

[0013] an acquisition module, configured to acquire, from a database, second hash values ​​and authorization periods corresponding to a plurality of authorized fonts, respectively, wherein the second hash value corresponding to any authorized font is obtained by performing a hash calculation on an authorized font file corresponding to the authorized font, the authorized font file including version information and identification information of the authorized font;

[0014] a first determining module, configured to determine that the font to be detected is a non-compliant font when the first hash value is inconsistent with the second hash value corresponding to any authorized font in the database, or when the first hash value is consistent with the second hash value corresponding to any authorized font in the database and the current usage time of the font to be detected has exceeded the authorization period;

[0015] The output module is configured to output a first detection report, where the first detection report includes the font file to be detected or metadata of the font to be detected in the font file to be detected.

[0016] In a third aspect, an embodiment of the present disclosure provides an electronic device, including:

[0017] Memory;

[0018] processor; and

[0019] computer programs;

[0020] The computer program is stored in the memory and is configured to be executed by the processor to implement the method as described in the first aspect.

[0021] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program is executed by a processor to implement the method described in the first aspect.

[0022] In a fifth aspect, an embodiment of the present disclosure provides a computer program product, comprising a computer program, which implements the method described in the first aspect when executed by a processor.

[0023] The font detection method, apparatus, device and medium provided by the embodiments of the present disclosure scan the font file to be detected in the code directory in response to the font detection trigger instruction, and calculate the first hash value corresponding to the font to be detected based on the font file to be detected. Further, the second hash values ​​and authorization periods corresponding to multiple authorized fonts are obtained from the database, and the first hash value is compared with any second hash value. If the first hash value is inconsistent with the second hash value corresponding to any authorized font in the database, or the first hash value is consistent with the second hash value corresponding to any authorized font in the database and the current usage time of the font to be detected is not within the authorization period, it is determined that the font to be detected is a non-compliant font. Further, a first detection report is output, and the first detection report includes the font file to be detected or the metadata of the font to be detected. In order to delete the font file to be detected and avoid using non-compliant fonts again, the problem of font infringement caused by developers not using authorized fonts or using fonts that have exceeded the authorization period during the development stage of the application is effectively prevented. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.

[0025] In order to more clearly illustrate the embodiments of the present disclosure or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0026] Figure 1 A flowchart of a font detection method provided in an embodiment of the present disclosure;

[0027] Figure 2 A schematic diagram of an application scenario provided by an embodiment of the present disclosure;

[0028] Figure 3 A flowchart of a font detection method provided in an embodiment of the present disclosure;

[0029] Figure 4 A flowchart of a font detection method provided in an embodiment of the present disclosure;

[0030] Figure 5 A flowchart of a font detection method provided in an embodiment of the present disclosure;

[0031] Figure 6 A schematic structural diagram of a font detection device provided in an embodiment of the present disclosure;

[0032] Figure 7A schematic diagram of the structure of an electronic device embodiment provided by the present disclosure. DETAILED DESCRIPTION

[0033] In order to more clearly understand the above-mentioned objectives, features and advantages of the present disclosure, the scheme of the present disclosure will be further described below. It should be noted that the embodiments of the present disclosure and the features therein can be combined with each other in the absence of conflict.

[0034] In the following description, many specific details are set forth to facilitate a full understanding of the present disclosure, but the present disclosure may also be implemented in other ways different from those described herein; it is obvious that the embodiments in the specification are only part of the embodiments of the present disclosure, rather than all of the embodiments.

[0035] With the continuous development of technology, users can install various applications (Applications, APPs) with different functions on terminal devices. However, during the development stage of the application, the fonts used by developers to write code may be unauthorized fonts or fonts that have exceeded the authorization period, thus causing font infringement issues. To address this issue, the embodiments of the present disclosure provide a font detection method, which is described below in conjunction with specific embodiments.

[0036] Figure 1 A flow chart of the font detection method provided in the embodiment of the present disclosure. The method is applied to the target terminal. Specifically, the method can be executed by a font detection device, which can be implemented in software and / or hardware, and the device can be configured on a terminal device, a server or a server cluster. Among them, the terminal device can specifically be a mobile phone, a PDA, a tablet computer, a wearable device with a display screen, a desktop computer, a laptop computer, an all-in-one machine, a smart home device, etc. A server cluster can be a collection of multiple servers that perform the same service together, and it looks like there is only one server to the client. The server cluster can use multiple computers for parallel computing to obtain a higher computing speed, and can also use multiple computers for backup, so that the entire system can still operate normally after any machine breaks down. Specifically, the method described in the embodiment of the present disclosure can be applied to the following Figure 2The application scenario shown. Specifically, the application scenario includes a terminal device 20, a server 21 and a terminal device 22. Among them, the terminal device 20 can be a terminal device used by application developers. Normally, an application is developed by multiple developers. For example, different developers are responsible for developing different functional modules of the application. Each developer can submit the code of the functional module he is responsible for to the server 21, and the server 21 integrates the code of each functional module of the application to generate an installation package for the application. The terminal device 22 downloads the installation package from the server 21 or other servers. Further, the terminal device 22 installs the application locally according to the installation package, so that the user of the terminal device 22 can use the application. The font detection method provided in the embodiment of the present disclosure is introduced below with reference to the legend. Figure 1 As shown, the specific steps of this method are as follows:

[0037] S101 : In response to a font detection trigger instruction, scan a font file to be detected associated with a code, where the font file to be detected includes version information and identification information of the font to be detected.

[0038] For example, during the development phase of an application, the terminal device 20 stores code written by a developer. A font file to be detected is stored in a code directory. The font file to be detected is the font file to be detected associated with the code written by the developer. The font file to be detected is a file related to the font of the text information that the functional module corresponding to the code written by the developer needs to display or not display to the user in the application. The font file to be detected can specifically be a file in .ttf format or a file in .otf format. The font detection method described in the embodiment of the present disclosure can be implemented by the terminal device 20 running a font detection script. Specifically, the terminal device 20 scans the font file to be detected in the code directory in response to a font detection trigger instruction. The font file to be detected includes version information and identification information of the font to be detected. For example, the font file to be detected includes font metadata to be detected, and the font metadata to be detected includes version information (Name Table), copyright statement (Copyright), font family name (Font Family), subtype (FontSubfamily), unique identifier (UniqueID), font version number (Version), license type description (LicenseDescription), etc. of the font to be detected. Specifically, fields such as the font's version information (Name Table), copyright statement (Copyright), font family name (Font Family), subtype (Font Subfamily), unique identifier (UniqueID), font version number (Version), and license type description (License Description) are key fields in the font file to be tested. Furthermore, even if the font file to be tested is renamed, these key fields can still be retrieved from the file.

[0039] S102: Perform hash calculation on the font file to be detected to obtain a first hash value corresponding to the font to be detected.

[0040] Specifically, the terminal device 20 performs a hash calculation on the font file to be detected to obtain a first hash value corresponding to the font to be detected.

[0041] For example, a 256-bit cryptographic hash algorithm (SHA256) is used to perform a hash calculation on the font file to be detected to obtain a first hash value corresponding to the font to be detected. For example, the font file to be detected is recorded as "SourceHanSans.ttf", and a 256-bit cryptographic hash algorithm (SHA256) is used to perform a hash calculation on "SourceHanSans.ttf". The resulting hash value is a long string, such as "a1b2c3d4e5f699e9nhf923odj". This string is the hash value obtained after the hash calculation of the font file to be detected, and this hash value is recorded as the first hash value corresponding to the font to be detected.

[0042] S103. Obtain second hash values ​​and authorization periods corresponding to a plurality of authorized fonts from a database, wherein the second hash value corresponding to any authorized font is obtained by performing a hash calculation on an authorized font file corresponding to the authorized font, wherein the authorized font file includes version information and identification information of the authorized font.

[0043] For example, the embodiment of the present disclosure pre-constructs a database, which stores the second hash values ​​and authorization periods corresponding to a plurality of authorized fonts. The second hash value corresponding to any authorized font can be obtained by performing a hash calculation on the authorized font file corresponding to the any authorized font, and the authorized font file includes the version information and identification information of the any authorized font. For example, the authorized font file includes authorized font metadata, and the authorized font metadata includes the version information (Name Table), copyright statement (Copyright), font family name (Font Family), subtype (Font Subfamily), unique identifier (UniqueID), font version number (Version), license type description (License Description), etc. of the authorized font. Specifically, after the terminal device 20 calculates the first hash value corresponding to the font to be detected, it obtains the second hash values ​​and authorization periods corresponding to the plurality of authorized fonts from the database.

[0044] S104. If the first hash value is inconsistent with the second hash value corresponding to any authorized font in the database, or the first hash value is consistent with the second hash value corresponding to any authorized font in the database and the current usage time of the font to be detected has exceeded the authorization period, then determine that the font to be detected is a non-compliant font.

[0045] Specifically, the terminal device 20 compares the first hash value with the second hash value corresponding to any authorized font in the database, for example, compares the first hash value with any second hash value one by one. If the first hash value and the second hash value corresponding to any authorized font in the database are inconsistent, it is determined that the font to be detected is an illegal font. If the first hash value and the second hash value corresponding to any authorized font in the database are consistent, it is further determined whether the current usage time of the font to be detected is within the authorization period of any authorized font. If the current usage time of the font to be detected has exceeded the authorization period, it is determined that the font to be detected is an illegal font.

[0046] S105: Output a first detection report, where the first detection report includes the to-be-detected font file or metadata of the to-be-detected font in the to-be-detected font file.

[0047] For example, in the case where the font to be detected is a non-compliant font, a first detection report is output, and the first detection report includes the font file to be detected or the font metadata to be detected in the font file to be detected. If the first detection report includes the font file to be detected, the terminal device 20 can delete the font file to be detected in the code directory as described above to avoid subsequent reuse. Alternatively, the terminal device 20 displays the first detection report on the screen. If the first detection report includes the font file to be detected, the developer queries the code directory based on the font file to be detected in the first detection report, and deletes the font file to be detected in the code directory to avoid subsequent reuse.

[0048] If the first detection report includes metadata of the font to be detected, the terminal device 20 can query the database based on the metadata of the font to be detected, and the database stores the correspondence between the font file to be detected and the metadata of the font to be detected. After the terminal device 20 queries the database based on the metadata of the font to be detected, it obtains the font file to be detected corresponding to the metadata of the font to be detected, and further deletes the font file to be detected in the code directory as described above to avoid subsequent reuse. Alternatively, the developer deletes the font file to be detected in the code directory. The embodiment of the present disclosure scans the font file to be detected in the code directory in response to the font detection trigger instruction, and calculates the first hash value corresponding to the font to be detected based on the font file to be detected. Furthermore, the second hash values ​​and authorization periods corresponding to multiple authorized fonts are obtained from the database, and the first hash value is compared with any second hash value. If the first hash value is inconsistent with the second hash value corresponding to any authorized font in the database, or the first hash value is consistent with the second hash value corresponding to any authorized font in the database and the current usage time of the font to be detected is not within the authorization period, then it is determined that the font to be detected is an illegal font. Furthermore, a first detection report is output, which includes the font file to be detected or metadata of the font to be detected. This allows the font file to be deleted to prevent the use of non-compliant fonts again, thereby effectively preventing font infringement issues caused by developers not using authorized fonts or using fonts that have exceeded the authorized period during the application development phase.

[0049] The following describes the process of building the database as described above. Optionally, in response to the font detection trigger instruction, before scanning the font file to be detected associated with the code, the method further includes: Figure 3 The following steps are shown:

[0050] S301: Obtain authorized font files and authorization periods corresponding to a plurality of authorized fonts.

[0051] Specifically, the developer of an application (such as a company) can purchase authorized fonts from a font provider, and the font provider can provide the developer of the application with basic information about the authorized fonts, such as the font files of the authorized fonts, ordering information, etc. Among them, the font files of the authorized fonts are referred to as authorized font files for short. The ordering information of the authorized fonts can specifically be an order contract, which stipulates the authorization period of the authorized font, for example, the validity period of the authorized font is until xx / xx / xx. Further, the developer of the application provides the basic information of the authorized font to the technician who writes the font detection script. For example, the legal staff and / or purchasing staff of the developer sends the basic information of the authorized font to the terminal device of the technician through their terminal device, so that the terminal device of the technician can obtain the authorized font files and authorization periods corresponding to multiple authorized fonts. The technician can be the application developer as described above, or can be other personnel other than the application developer.

[0052] S302: For any authorized font among the multiple authorized fonts, perform hash calculation on the authorized font file corresponding to the any authorized font to obtain a second hash value corresponding to the any authorized font.

[0053] For example, for any authorized font among the multiple authorized fonts, the technician's terminal device performs a hash calculation on the authorized font file corresponding to the any authorized font to obtain a second hash value corresponding to the any authorized font.

[0054] S303. Construct a font metadata index corresponding to any authorized font based on the font name of any authorized font, the file name of the authorized font file corresponding to any authorized font, the license type of any authorized font, the authorization period of any authorized font, the source of the authorization period of any authorized font, and the second hash value corresponding to any authorized font.

[0055] Since the authorization period of the authorized font is determined by negotiation between the application developer and the font provider, the authorized font metadata in the authorized font file usually does not include the authorization period, such as the validity period, that is, the authorization period will not be directly embedded in the authorized font file. Therefore, in the embodiment of the present disclosure, there are several ways to obtain the authorization period: one way is to obtain it from the ordering information (such as a purchase order or a purchase contract) signed by the application developer and the font provider. Another way is to send a request to the Application Programming Interface (API) provided by the font provider to query the authorization period of the authorized font. Specifically, if the font provider provides an API, the authorization period of the authorized font is queried through the API first. If the font provider does not provide a relevant API, the authorization period of the authorized font is obtained from the purchase order or purchase contract.

[0056] For example, for any authorized font among the multiple authorized fonts, the technician's terminal device creates a data structure for the any authorized font in the database, and the data structure is used to store the authorized font file corresponding to the any authorized font, and the font metadata index corresponding to the any authorized font. The font metadata index corresponding to the any authorized font includes the font name of the any authorized font (such as the font family name), the file name of the authorized font file (file_name), the license type of the any authorized font (license_type), the authorization period of the any authorized font (valid_until), the source of the authorization period of the any authorized font (valid_until_source), the second hash value corresponding to the any authorized font (hash_sha256), etc. The source of the authorization period of the any authorized font may be an API, a purchase order, or a purchase contract, etc.

[0057] S304: Store the authorized font file corresponding to any authorized font and the font metadata index corresponding to any authorized font in the database.

[0058] Specifically, the technician's terminal device stores the authorized font file corresponding to any authorized font and the font metadata index corresponding to any authorized font in the database. For example, taking two authorized fonts as an example, the authorized font files corresponding to the two authorized fonts are "SourceHanSans.ttf" and "Roboto.ttf" respectively. The storage format of the authorized font files and font metadata indexes corresponding to the two authorized fonts in the database is as follows:

[0059]

[0060]

[0061] Optionally, the method further includes: if the first hash value is consistent with the second hash value corresponding to any authorized font in the database, and the current usage time of the font to be detected is within the authorization period, determining that the font to be detected is a compliant font.

[0062] For example, the terminal device 20 compares the first hash value corresponding to the font to be detected with the second hash value corresponding to any authorized font in the database. If the first hash value is consistent with the second hash value corresponding to any authorized font in the database, it further determines whether the current usage time of the font to be detected is within the authorization period of any authorized font. If the current usage time of the font to be detected is within the authorization period, it is determined that the font to be detected is a compliant font.

[0063] Optionally, after determining that the font to be detected is a compliant font, the method further includes: if the remaining usage period of the font to be detected is less than or equal to a preset duration, outputting a second detection report, the second detection report including the remaining usage period of the font to be detected.

[0064] For example, after determining that the font to be detected is a compliant font, the current usage time and the authorization period of the font to be detected can also be calculated to calculate the remaining usage period of the font to be detected. For example, if the current usage time of the font to be detected is January 2024 and the authorization period is June 2024, then the remaining usage period of the font to be detected is 5 months. Assuming that the preset duration is 6 months, the remaining usage period of the font to be detected is less than the preset duration. At this time, a second test report can be output, and the second test report includes the remaining usage period of the font to be detected, so as to prompt the developer that the font to be detected is a compliant font, but the remaining usage period of the font to be detected is less than 6 months.

[0065] Optionally, the font detection trigger instruction includes a code running instruction; in response to the font detection trigger instruction, scanning the font file to be detected associated with the code includes: in response to the code running instruction, running the code, and scanning the font file to be detected associated with the code; after determining that the font to be detected is a non-compliant font, the method also includes: stopping running the code.

[0066] For example, after the developer of the application program finishes writing the code on the terminal device 20, he clicks the "Run" button. The terminal device 20 recognizes the developer's click of the "Run" button as a code execution instruction. Further, in response to the code execution instruction, the terminal device 20 executes the completed code and scans the font files to be detected in the code directory, i.e., the font detection script is executed simultaneously during the code execution. If the terminal device 20 is a device running the iOS operating system, the font detection script is added in the Xcode runtime phase (Build Phases). Xcode is an integrated development tool running on the Mac OS X operating system. If the terminal device 20 is a device running the Android operating system, the font detection script is added in the project automation build open source tool (Gradle). After running the font detection script, if the font to be detected is an illegal font, i.e., an ineligible font, the terminal device 20 stops executing the code. Alternatively, if the code execution does not stop, the terminal device 20 may display a prompt message to remind the developer that the font used is an illegal font and that the font needs to be changed before running the code written by the developer. Thus, illegal fonts are detected as early as possible during the code execution phase.

[0067] Optionally, the font detection trigger instruction includes a code submission instruction; in response to the font detection trigger instruction, scanning the font file to be detected associated with the code, including: in response to the code submission instruction, submitting the code to the code repository, and scanning the font file to be detected associated with the code; after determining that the font to be detected is a non-compliant font, the method also includes: stopping submitting the code to the code repository.

[0068] For example, an application developer writes code on terminal device 20, successfully runs the code, and then clicks the "Submit" button. Terminal device 20 recognizes the developer's click of the "Submit" button as a code submission instruction. Further, in response to this code submission instruction, terminal device 20 submits the code to the code repository and scans the code directory for font files to be detected, i.e., simultaneously runs a font detection script during the code submission process. After running the font detection script, if the font to be detected is a non-compliant font, the terminal device 20 stops submitting the code. Alternatively, the terminal device 20 may display a prompt message to inform the developer that the font they are using is a non-compliant font and that they need to change the font before submitting their code normally. This allows non-compliant fonts to be detected as early as possible during the code submission phase, preventing code containing non-compliant fonts from being submitted to the code repository. Additionally, when the code repository receives code, it runs the font detection script to detect whether the font to be detected associated with the received code is a compliant font. If the code repository determines that the font to be detected associated with the received code is a non-compliant font, it stops accepting code.

[0069] Optionally, the font detection trigger instruction includes a code integration instruction; in response to the font detection trigger instruction, scanning the font file to be detected associated with the code, including: in response to the code integration instruction, integrating the code and scanning the font file to be detected associated with the code; after determining that the font to be detected is a non-compliant font, the method also includes: stopping integrating the code.

[0070] For example, after the developer of an application program has written the code on the terminal device 20 and successfully run the code on the terminal device 20, and the terminal device 20 has submitted the code to a code repository, such as a server 21, the server 23 obtains the code to be integrated from the server 21. The code to be integrated may be the code of different functional modules developed by different developers. An integration tool is provided on the server 23, and the integration tool integrates the code to be integrated. For example, the developer remotely controls the integration tool through his terminal device. Specifically, the terminal device displays a user interface for controlling the integration tool, and the user interface includes an "integrate" button. The terminal device recognizes the developer's operation of clicking the "integrate" button as a code integration instruction and sends the code integration instruction to the server 23. In response to the code integration instruction, the server 23 controls the integration tool to integrate the code to be integrated and scans the font files to be detected in the code directory, that is, runs the font detection script simultaneously during the code integration process. After running the font detection script, if the font to be detected is an illegal font, that is, an ineligible font, the server 23 controls the integration tool to stop integrating the code. Alternatively, the server 23 sends a prompt message to the developer's terminal device to prompt the developer to check whether the font used is an illegal font and whether the font needs to be changed before normal integration. In this way, illegal fonts can be detected as early as possible during the code integration stage to avoid the code of illegal fonts being integrated into the installation package.

[0071] Optionally, the method further comprises: Figure 4 The following steps are shown:

[0072] S401: Before text information to be displayed is displayed on a terminal device, a font identifier to be displayed is received from the terminal device, where the font identifier to be displayed is the font identifier of the text information.

[0073] For example, terminal device 22 downloads the installation package from server 21 or another server and locally installs the application based on the installation package. Because the font used for text information displayed by the application is pre-set within the application, before terminal device 22 displays the text information on the user interface based on a user's operation of the application, terminal device 22 obtains from the application the font identifier used for the text information to be displayed, i.e., the to-be-displayed font identifier. Terminal device 22 then transmits the to-be-displayed font identifier to server 21.

[0074] S402: Query the database according to the identifier of the font to be displayed.

[0075] For example, after receiving the identifier of the font to be displayed, the server 21 queries the database as described above to determine whether there is an authorized font identifier, such as a unique identifier, matching the identifier of the font to be displayed in the database.

[0076] S403: If the database does not contain an authorized font file corresponding to the to-be-displayed font identifier, the to-be-displayed font is determined to be an unauthorized font. The terminal device is configured to replace the to-be-displayed font identifier with an authorized font identifier and display the text information using the authorized font.

[0077] If the database does not contain an authorized font identifier that matches the font identifier to be displayed, it is determined that the database does not contain an authorized font file corresponding to the font identifier to be displayed, that is, the font to be displayed is an unauthorized font. At this time, the terminal device 22 can directly replace the font identifier to be displayed set in the application with the authorized font identifier, so that the application displays text information in the form of an authorized font. Alternatively, when the server 21 determines that the database does not contain an authorized font file corresponding to the font identifier to be displayed, the server 21 sends the authorized font identifier to the terminal device 22. The authorized font identifier can be a unique identifier corresponding to any authorized font. After the terminal device 22 receives the authorized font identifier sent by the server 21, the terminal device 22 replaces the font identifier to be displayed set in the application with the authorized font identifier, so that the application displays text information in the form of an authorized font.

[0078] In the embodiment of the present disclosure, before displaying text information, the terminal device sends the identifier of the font to be displayed to the server. The server queries the database based on the identifier of the font to be displayed. If the database does not contain an authorized font file corresponding to the identifier of the font to be displayed, it is determined that the font to be displayed is an unauthorized font. The terminal device can directly replace the identifier of the font to be displayed with the identifier of the authorized font, so that the application displays text information in the form of an authorized font. This prevents the developer of the application from not renewing the currently purchased font in the future, while the old version of the application that has been released still uses the font, resulting in infringement.

[0079] Figure 5 This is a flow chart of a font detection method provided by another embodiment of the present disclosure. Figure 5 As shown, the method includes the following steps:

[0080] S501, start.

[0081] S502: Obtain authorized font files and ordering information corresponding to a plurality of authorized fonts, and construct a database.

[0082] S503: Write a font detection script.

[0083] S504. Add font compliance detection during the code building phase.

[0084] S505. Add illegal font fault tolerance logic to the front end.

[0085] For example, during the code building phase, a front-end fault-tolerance logic for illegal fonts is added, so that after the user's terminal device, such as the terminal device 22, installs the application, before the application displays the text information, the logic checks whether the font of the text information is an illegal font. If so, the illegal font is replaced with a compliant font.

[0086] S506. Add font compliance detection during the code submission stage.

[0087] S507. Add font compliance detection during the code integration phase.

[0088] S508: Detect and output a font detection report that is N months overdue.

[0089] In addition, the font detection report can be output not only in the code integration stage, but also in the code construction stage or the code submission stage.

[0090] S509, end.

[0091] Specifically, the specific implementation process of S501-S509 in the embodiment of the present disclosure can refer to the process described above, and will not be repeated here.

[0092] Figure 6 The schematic diagram of the structure of the font detection device provided by the embodiment of the present disclosure. The font detection device is configured in the target terminal. The font detection device provided by the embodiment of the present disclosure can execute the processing flow provided by the embodiment of the font detection method, such as Figure 6 As shown, the font detection device 60 includes:

[0093] A scanning module 61 is configured to scan a font file to be detected associated with the code in response to a font detection trigger instruction, wherein the font file to be detected includes version information and identification information of the font to be detected;

[0094] A calculation module 62 is configured to perform a hash calculation on the font file to be detected to obtain a first hash value corresponding to the font to be detected;

[0095] an acquisition module 63 configured to acquire, from a database, second hash values ​​and authorization periods corresponding to a plurality of authorized fonts, respectively, wherein the second hash value corresponding to any authorized font is obtained by performing a hash calculation on an authorized font file corresponding to the authorized font, the authorized font file including version information and identification information of the authorized font;

[0096] A first determining module 64 is configured to determine that the font to be detected is a non-compliant font when the first hash value is inconsistent with the second hash value corresponding to any authorized font in the database, or when the first hash value is consistent with the second hash value corresponding to any authorized font in the database and the current usage time of the font to be detected has exceeded the authorization period;

[0097] The output module 65 is configured to output a first detection report, where the first detection report includes the font file to be detected or metadata of the font to be detected in the font file to be detected.

[0098] Optionally, if the first hash value is consistent with the second hash value corresponding to any authorized font in the database, and the current usage time of the font to be detected is within the authorization period, the first determination module 64 is further configured to determine whether the font to be detected is a compliant font.

[0099] Optionally, after the first determination module 64 determines that the font to be detected is a compliant font, if the remaining usage period of the font to be detected is less than or equal to a preset duration, the output module 65 is also used to output a second detection report, which includes the remaining usage period of the font to be detected.

[0100] Optionally, the font detection trigger instruction includes a code running instruction; when the scanning module 61 responds to the font detection trigger instruction and scans the font file to be detected associated with the code, it is specifically used to: respond to the code running instruction, run the code, and scan the font file to be detected associated with the code; the font detection device 60 also includes: a control module 66, which is used to stop running the code after the first determination module 64 determines that the font to be detected is an illegal font.

[0101] Optionally, the font detection trigger instruction includes a code submission instruction; when the scanning module 61 responds to the font detection trigger instruction and scans the font file to be detected associated with the code, it is specifically used to: submit the code to the code repository in response to the code submission instruction, and scan the font file to be detected associated with the code; the control module 66 is also used to stop submitting the code to the code repository when the first determination module 64 determines that the font to be detected is a non-compliant font.

[0102] Optionally, the font detection trigger instruction includes a code integration instruction; when the scanning module 61 responds to the font detection trigger instruction and scans the font file to be detected associated with the code, it is specifically used to: integrate the code in response to the code integration instruction, and scan the font file to be detected associated with the code; the control module 66 is also used to stop integrating the code after the first determination module 64 determines that the font to be detected is a non-compliant font.

[0103] Optionally, the font detection device 60 further includes:

[0104] The receiving module 67 is configured to receive a font identifier to be displayed sent by the terminal device before the text information to be displayed is displayed on the terminal device, wherein the font identifier to be displayed is the font identifier of the text information;

[0105] A query module 68 is configured to query the database according to the identifier of the font to be displayed;

[0106] The second determining module 69 is configured to determine that the font to be displayed is an unauthorized font if there is no authorized font file corresponding to the font identifier to be displayed in the database, and the terminal device is configured to replace the font identifier to be displayed with an authorized font identifier and display the text information using the authorized font.

[0107] Optionally, the acquisition module 63 is also used to: obtain the authorized font files and authorization periods corresponding to multiple authorized fonts respectively; the calculation module 62 is also used to: for any authorized font among the multiple authorized fonts, perform hash calculation on the authorized font file corresponding to the any authorized font to obtain a second hash value corresponding to the any authorized font; the font detection device 60 also includes: a construction module 610 and a storage module 611, the construction module 610 is used to construct the font metadata index corresponding to the any authorized font based on the font name of the any authorized font, the file name of the authorized font file corresponding to the any authorized font, the license type of the any authorized font, the authorization period of the any authorized font, the source of the authorization period of the any authorized font, and the second hash value corresponding to the any authorized font; the storage module 611 is used to store the authorized font file corresponding to the any authorized font and the font metadata index corresponding to the any authorized font in the database.

[0108] Figure 6 The font detection device of the illustrated embodiment can be used to implement the technical solution of the above-mentioned method embodiment. Its implementation principle and technical effects are similar and will not be described in detail here.

[0109] The internal functions and structure of the font detection device are described above. The device can be implemented as an electronic device. Figure 7 This is a schematic diagram of the structure of an electronic device embodiment provided by the present disclosure. Figure 7 As shown, the electronic device includes a memory 71 and a processor 72 .

[0110] The memory 71 is used to store programs. In addition to the aforementioned programs, the memory 71 may also be configured to store various other data to support operations on the electronic device. Examples of such data include instructions for any application or method operating on the electronic device, contact data, phone book data, messages, images, videos, and the like.

[0111] The memory 71 can be implemented by any type of volatile or non-volatile memory device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.

[0112] The processor 72 is coupled to the memory 71 and executes the program stored in the memory 71 to implement the technical solution of the above method embodiment.

[0113] Further, if Figure 7As shown, the electronic device may further include: a communication component 73, a power component 74, an audio component 75, a display 76 and other components. Figure 7 Only some components are shown schematically, which does not mean that the electronic device only includes Figure 7 Components shown.

[0114] The communication component 73 is configured to facilitate wired or wireless communication between the electronic device and other devices. The electronic device can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 73 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 73 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.

[0115] The power supply assembly 74 provides power to various components of the electronic device. The power supply assembly 74 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the electronic device.

[0116] The audio component 75 is configured to output and / or input audio signals. For example, the audio component 75 includes a microphone (MIC), which is configured to receive external audio signals when the electronic device is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signal can be further stored in the memory 71 or transmitted via the communication component 73. In some embodiments, the audio component 75 also includes a speaker for outputting audio signals.

[0117] The display 76 includes a screen, which may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touches, slides, and gestures on the touch panel. The touch sensor may not only sense the boundaries of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation.

[0118] In addition, an embodiment of the present disclosure further provides a computer-readable storage medium on which a computer program is stored. The computer program is executed by a processor to implement the method described in the above embodiment.

[0119] The exemplary embodiments of the present disclosure further provide a computer program product, including a computer program, wherein when the computer program is executed by a processor of a computer, the computer is configured to enable the computer to implement the method described in the above embodiment.

[0120] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or device comprising the element.

[0121] The foregoing description is intended only to provide specific embodiments of the present disclosure, intended to enable those skilled in the art to understand and implement the present disclosure. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present disclosure. Therefore, the present disclosure is not intended to be limited to the embodiments described herein, but rather to be construed in the broadest manner consistent with the principles and novel features disclosed herein.

Claims

1. A font detection method, characterized in that: The method comprises: In response to the font detection trigger instruction, scanning the font file to be detected associated with the code, wherein the font file to be detected includes version information and identification information of the font to be detected; Performing a hash calculation on the font file to be detected to obtain a first hash value corresponding to the font to be detected; Obtaining second hash values ​​and authorization periods corresponding to a plurality of authorized fonts from a database, wherein the second hash value corresponding to any authorized font is obtained by performing a hash calculation on an authorized font file corresponding to the authorized font, the authorized font file including version information and identification information of the authorized font; If the first hash value is inconsistent with the second hash value corresponding to any authorized font in the database, or the first hash value is consistent with the second hash value corresponding to any authorized font in the database and the current usage time of the font to be detected has exceeded the authorization period, then the font to be detected is determined to be a non-compliant font; A first detection report is output, where the first detection report includes the to-be-detected font file or metadata of the to-be-detected font in the to-be-detected font file.

2. The method according to claim 1, characterized in that The method further comprises: If the first hash value is consistent with the second hash value corresponding to any authorized font in the database, and the current usage time of the font to be detected is within the authorization period, it is determined that the font to be detected is a compliant font.

3. The method according to claim 2, characterized in that After determining that the font to be detected is a compliant font, the method further includes: If the remaining usage period of the font to be detected is less than or equal to a preset duration, a second detection report is output, where the second detection report includes the remaining usage period of the font to be detected.

4. The method according to claim 1, wherein The font detection trigger instruction includes a code execution instruction; In response to the font detection trigger instruction, the font file to be detected associated with the scanning code includes: In response to the code execution instruction, executing the code and scanning the font file to be detected associated with the code; After determining that the font to be detected is an illegal font, the method further includes: Stop running the code in question.

5. The method according to claim 1, wherein The font detection trigger instruction includes a code submission instruction; In response to the font detection trigger instruction, the font file to be detected associated with the scanning code includes: In response to the code submission instruction, submit the code to a code repository, and scan the font file to be detected associated with the code; After determining that the font to be detected is an illegal font, the method further includes: Stop submitting the code to the code repository.

6. The method according to claim 1, characterized in that The font detection trigger instruction includes a code integration instruction; In response to the font detection trigger instruction, the font file to be detected associated with the scanning code includes: In response to the code integration instruction, integrating the code and scanning the to-be-detected font file associated with the code; After determining that the font to be detected is an illegal font, the method further includes: Stop integrating the code in question.

7. The method according to claim 1, characterized in that The method further comprises: Before the text information to be displayed is displayed on the terminal device, receiving a font identifier to be displayed sent by the terminal device, the font identifier to be displayed being the font identifier of the text information; querying the database according to the identifier of the font to be displayed; If the database does not contain an authorized font file corresponding to the font identifier to be displayed, the font to be displayed is determined to be an unauthorized font. The terminal device is configured to replace the font identifier to be displayed with an authorized font identifier and display the text information using the authorized font.

8. The method according to claim 1, characterized in that In response to the font detection trigger instruction, before scanning the font file to be detected associated with the code, the method further includes: Obtain the authorized font files and authorization periods corresponding to multiple authorized fonts; For any authorized font among the multiple authorized fonts, perform hash calculation on the authorized font file corresponding to the any authorized font to obtain a second hash value corresponding to the any authorized font; Constructing a font metadata index corresponding to any authorized font according to the font name of any authorized font, the file name of the authorized font file corresponding to any authorized font, the license type of any authorized font, the authorization period of any authorized font, the source of the authorization period of any authorized font, and the second hash value corresponding to any authorized font; The authorized font file corresponding to any authorized font and the font metadata index corresponding to any authorized font are stored in the database.

9. A font detection device, wherein: The device comprises: A scanning module, configured to scan a font file to be detected associated with the code in response to a font detection trigger instruction, wherein the font file to be detected includes version information and identification information of the font to be detected; A calculation module, configured to perform a hash calculation on the font file to be detected to obtain a first hash value corresponding to the font to be detected; an acquisition module, configured to acquire, from a database, second hash values ​​and authorization periods corresponding to a plurality of authorized fonts, respectively, wherein the second hash value corresponding to any authorized font is obtained by performing a hash calculation on an authorized font file corresponding to the authorized font, the authorized font file including version information and identification information of the authorized font; a first determining module, configured to determine that the font to be detected is a non-compliant font when the first hash value is inconsistent with the second hash value corresponding to any authorized font in the database, or when the first hash value is consistent with the second hash value corresponding to any authorized font in the database and the current usage time of the font to be detected has exceeded the authorization period; The output module is configured to output a first detection report, where the first detection report includes the font file to be detected or metadata of the font to be detected in the font file to be detected.

10. An electronic device, wherein: include: Memory; processor; as well as computer programs; The computer program is stored in the memory and configured to be executed by the processor to implement the method according to any one of claims 1 to 8.

11. A computer-readable storage medium having a computer program stored thereon, wherein: When the computer program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.