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
[desktop] make fonts depend on language and platform #2011
Conversation
Still WIP because it's missing a config migration which could be merged with the one in #1928 |
1a9ed7b
to
76ee1df
Compare
is it so? I think that's what Electron will (hopefully) do with electron/electron#23247 |
Well, at the moment it's not reliable, but they seem to be working on it. |
Hm both sound bad but probably we can cover most cases if we base it on a language and we won't have additional confusing setting. |
76ee1df
to
b6a0186
Compare
Another problem is that, as far as I can tell from my research, chinese fonts seem to be inconsistent in what they're called on windows at least, which is why SimHei and 黑体 both are in the list even though they're the same font. The default font setting for the electron browser window takes one (and only one) font name, which then is used as default for the sans-serif family. Changing the body selector in main-styles.js would be another option to get maximum coverage. |
Yeah, probably adding fonts to the body is a good idea (esp. because we discard style blocks currently). Won't screw up all fonts, will fall back properly. |
e896955
to
5b2b54f
Compare
6a54dcf
to
9a38084
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will probably modify fonts a little bit but otherwise looks good!
@@ -183,6 +183,8 @@ - (void)userContentController:(nonnull WKUserContentController *)userContentCont | |||
[_fileChooser openWithAnchorRect:rect completion: sendResponseBlock]; | |||
} else if ([@"getName" isEqualToString:type]) { | |||
[_fileUtil getNameForPath:arguments[0] completion:sendResponseBlock]; | |||
} else if ([@"changeLanguage" isEqualToString:type]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kudos for figuring this stuff out!
I was about to merge this but noticed that electron/electron#18829 is fixed. Maybe we can remove the workaround soon. |
adds a function getFonts() to main-styles.js that returns the
font-family string for the body style.
will add additional fonts depending on the platform and used language.
AppearanceSettingsViewer will now also cause a regeneration of the
style tags and a change of language on the native side when the language
is changed by the user.
fix #1909