Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature]: How can I set the default font-family for Chrome browser to Ping Fang SC #9942

Closed
shuizhongxiong opened this issue Mar 30, 2023 · 4 comments
Labels

Comments

@shuizhongxiong
Copy link

shuizhongxiong commented Mar 30, 2023

Feature description

How can I set the default font-family for Chrome browser to Ping Fang SC, instead of setting it in CSS.

@shuizhongxiong shuizhongxiong changed the title [Feature]: How can I set the default font-family for Chrome browser to Ping Fang SC? [Feature]: How can I set the default font-family for Chrome browser to Ping Fang SC Mar 30, 2023
@OrKoN
Copy link
Collaborator

OrKoN commented Mar 30, 2023

Can you describe the feature in more details? What is CS?

@shuizhongxiong
Copy link
Author

Can you describe the feature in more details? What is CS?

There is a piece of style code 'font-family: xxx!important' in my CSS file.

When xxx font file does not exist, the default font of Chrome will be used.

The default font of Chrome is Songti, but I want to set it to Ping Fang SC.

image

@OrKoN
Copy link
Collaborator

OrKoN commented Mar 30, 2023

You can try using Page.setFontFamilies directly https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-setFontFamilies:

const cdp = await page.target().createCDPSession();
await cdp.send('Page.setFontFamilies', {...params... });

@shuizhongxiong
Copy link
Author

You can try using Page.setFontFamilies directly https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-setFontFamilies:

const cdp = await page.target().createCDPSession();
await cdp.send('Page.setFontFamilies', {...params... });

Yes, this is exactly what I wanted. Thank you very much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants