# US 12,001,777 B2 · Font switching method and electronic device

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 12,001,777 B2
- Document ID: US12001777B2
- Status: Granted
- Kind: B2
- Application number: 18/002,411
- Filed: 2021-03-31
- Published: 2023-10-12
- Granted: 2024-06-04
- Earliest claimed: 2020-06-19
- Assignees: Petal Cloud Technology Co., Ltd.
- Applicants: Petal Cloud Technology Co., Ltd.
- Inventors: Liang Lu; Yaoming Liu; Lin Peng
- Web page: https://patentgrep.com/patent/US12001777B2

## CPC

- G06F 40/109: Font handling; Temporal or kinetic typography
- G06F 3/0482: Interaction with lists of selectable items, e.g. menus
- G06V 30/245: {Font recognition}
- G06F 9/451: Execution arrangements for user interfaces
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)
- G06V: IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING

## Abstract

A font switching method obtains, through pixel matching with a comparison font, a target font consistent with a font currently used by an operating system, and applies the target font to a third-party application, enabling the third-party application to accurately vary with a font change of the operating system and to avoid inconsistency between the font used by the third-party application and the font used by the operating system.

## Claims

### Claim 1

A method comprising:
generating a target dot matrix based on a first font currently used by an operating system;
obtaining comparison dot matrices corresponding to various types of fonts loaded by the operating system;
performing pixel matching between each of the comparison dot matrices and the target dot matrix to determine a first comparison dot matrix matching the target dot matrix;
setting a second font of a type corresponding to the first comparison dot matrix as a target font; and
switching a third font of a third-party application to the target font.

### Claim 2 (depends on 1)

The method of claim 1, further comprising:
creating a bitmap object and a canvas object;
drawing a preset character in the canvas object based on the first font, to obtain a drawn result; and
saving the drawn result in the bitmap object to obtain the target dot matrix.

### Claim 3 (depends on 1)

The method of claim 1, further comprising:
performing pixel comparison between each of the comparison dot matrices and the target dot matrix;
identifying a second comparison dot matrix comprising a pixel distribution that is consistent with that of the target dot matrix;
setting, in response to identifying the second comparison dot matrix, the second comparison dot matrix as the first comparison dot matrix; and
determining a fourth font corresponding to the second comparison dot matrix as the target font.

### Claim 4 (depends on 1)

The method of claim 1, wherein the target dot matrix and the first comparison dot matrix are monochromatic bitmaps, and wherein the method further comprises:
obtaining first binary data of the target dot matrix and second binary data of each of the comparison dot matrices; and
setting a second comparison dot matrix comprising the second binary data that matches the first binary data as the first comparison dot matrix.

### Claim 5 (depends on 1)

The method of claim 1, further comprising:
obtaining the various types of fonts;
creating canvas objects and bitmap objects corresponding to the various types of fonts;
drawing preset characters in the canvas objects based on the various types of fonts, to obtain drawn results; and
saving the drawn results in the bitmap objects.

### Claim 6 (depends on 1)

The method of claim 1, further comprising:
obtaining all types of fonts loaded by the operating system and a default font of the operating system;
determining a non-default font of the operating system based on all types of fonts and the default font;
generating a second comparison dot matrix corresponding to the non-default font; and
obtaining the second comparison dot matrix.

### Claim 7 (depends on 6)

The method of claim 6, further comprising:
creating a canvas object and a bitmap object corresponding to each non-default font of the operating system;
drawing a preset character in the canvas object based on each non-default font, to obtain a drawn result; and
saving the drawn result in the bitmap object.

### Claim 8 (depends on 1)

The method of claim 1, wherein before generating the target dot matrix, the method further comprises detecting whether the third-party application is started.

### Claim 9 (depends on 1)

The method of claim 1, further comprising selecting, by a user, a custom font as the first font.

### Claim 10 (depends on 1)

The method of claim 1, further comprising:
setting a storage path of a font file of the target font for the third-party application;
controlling the third-party application to obtain and load the font file based on the storage path; and
rendering a display interface of the third-party application based on the font file, wherein a character used on the display interface is a character corresponding to the font file.

### Claim 11

An electronic device comprising:
a memory configured to store instructions; and
a processor coupled to the memory and configured to execute the instructions to cause the electronic device to:
generate a target dot matrix based on a first font currently used by an operating system;
obtain comparison dot matrices corresponding to various types of fonts loaded by the operating system;
perform pixel matching between each of the comparison dot matrices and the target dot matrix to determine a first comparison dot matrix matching the target dot matrix;
set a second font of a type corresponding to the first comparison dot matrix as a target font; and
switch a third font of a third-party application to the target font.

### Claim 12 (depends on 11)

The electronic device of claim 11, wherein the processor is further configured to execute the instructions to cause the electronic device to:
create a bitmap object and a canvas object;
draw a preset character in the canvas object based on the first font to obtain a drawn result; and
save the drawn result in the bitmap object to obtain the target dot matrix.

### Claim 13 (depends on 11)

The electronic device of claim 11, wherein the processor is further configured to execute the instructions to cause the electronic device to:
perform pixel comparison between each of the comparison dot matrices and the target dot matrix;
identify a second comparison dot matrix comprising a pixel distribution that is consistent with that of the target dot matrix;
set, in response to identifying the second comparison dot matrix, the second comparison dot matrix as the first comparison dot matrix; and
determine a fourth font corresponding to the second comparison dot matrix as the target font.

### Claim 14 (depends on 11)

The electronic device of claim 11, wherein the target dot matrix and the first comparison dot matrix are monochromatic bitmaps, and wherein the processor is further configured to execute the instructions to cause the electronic device to:
obtain first binary data of the target dot matrix and second binary data of each of the comparison dot matrices; and
set a second comparison dot matrix comprising the second binary data that matches the first binary data as the first comparison dot matrix.

### Claim 15 (depends on 11)

The electronic device of claim 11, wherein the processor is further configured to execute the instructions to cause the electronic device to:
obtain the various types of fonts;
create canvas objects and bitmap objects corresponding to the various types of fonts;
draw preset characters in the canvas objects based on the various types of fonts to obtain drawn results; and
save the drawn results in the bitmap objects.

### Claim 16 (depends on 11)

The electronic device according to of claim 11, wherein the processor is further configured to execute the instructions to cause the electronic device to:
obtain all types of fonts loaded by the operating system and a default font of the operating system;
determine a non-default font of the operating system based on all types of fonts and the default font;
generate a second comparison dot matrix corresponding to the non-default font; and
obtain the second comparison dot matrix.

### Claim 17 (depends on 11)

The electronic device of claim 11, wherein the processor is further configured to execute the instructions to cause the electronic device to:
create a canvas object and a bitmap object corresponding to each non-default font of the operating system;
draw a preset character in the canvas object based on each non-default font to obtain a drawn result; and
save the drawn result in the bitmap object.

### Claim 18

A computer program product comprising computer-executable instructions that are stored on a non-transitory computer-readable storage medium and that, when executed by a processor, cause an electronic device to:
generate a target dot matrix based on a first font currently used by an operating system;
obtain comparison dot matrices corresponding to various types of fonts loaded by the operating system;
perform pixel matching between each of the comparison dot matrices and the target dot matrix to determine a first comparison dot matrix matching the target dot matrix;
set a second font of a type corresponding to the first comparison dot matrix as a target font; and
switch a third font of a third-party application to the target font.

### Claim 19 (depends on 18)

The computer program product of claim 18, wherein the computer-executable instructions further cause the electronic device to:
create a bitmap object and a canvas object;
draw a preset character in the canvas object based on the first font to obtain a drawn result; and
save the drawn result in the bitmap object to obtain the target dot matrix.

### Claim 20 (depends on 18)

The computer program product of claim 18, wherein the computer-executable instructions further cause the electronic device to:
perform pixel comparison between each of the comparison dot matrices and the target dot matrix;
identify a second comparison dot matrix comprising a pixel distribution that is consistent with that of the target dot matrix;
set, in response to identifying the second comparison dot matrix, the second comparison dot matrix as the first comparison dot matrix; and
determine a fourth font corresponding to the first comparison dot matrix as the target font.
