-
-
Notifications
You must be signed in to change notification settings - Fork 144
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
improvement: add CJK fonts and set them as fallback in the font resources #688
base: main
Are you sure you want to change the base?
Conversation
Thanks much! The PR looks good, I just need to check something with my teammates. @Xananax @Razoric480 do you know if we have a way to separate these fonts and download them only when needed (when changing the language to Chinese or Japanese, for example) in HTML5 builds? They're pretty big, 5-7mb a piece (and that's per font weight and style), and it's gonna get worse as we add languages (Cyrillic, Arabic, ...), I wouldn't want the initial download to be drastically slowed down ideally. |
I will look into it, in theory we can add pcks and load them at will like addons, but I've never done it for web |
Any idea how to author packages? There's a recommended method: https://docs.godotengine.org/en/stable/tutorials/export/exporting_pcks.html But I'm not sure how to extract the changed files as a package from the main project on authoring. Should the files be moved into a different project, then the package built? If there's no provision for this in Godot, should we do this ourselves? I'll start by working on the loading part and verify it can work properly, we can then think about the authoring part. If we agree, then I'll open a different issue to track progress. |
I would ask François or other Godot contributors for insights, as I've never used this feature before. Not sure if we can... just make a custom export template, or if we need a separate project |
And yeah sounds good to figure out authoring the pck after ensuring that loading in the browser works |
The ideal would be Godot supporting being able to white list directories, but so long as you're careful about what files are referenced, you can set the export mode of a given preset to selected resources and dependencies and only highlight the ones you want (and dis-highlight the ones you don't want from your main PCK export) You can use download to func _ready():
var client = HTTPRequest.new()
client.connect('request_completed', self, '_request_completed')
add_child(client)
client.download_file = "res://name of your pck file.pck"
client.request("http://link to your pck file")
func _request_completed(result, response_code, headers, body):
if response_code == 200:
ProjectSettings.load_resource_pack("res://name of your pck file.pck")
get_tree().change_scene("res://name of your scene inside .pck file") though I haven't tested it. The other approach is to preload the file through javascript prior to startGame() which would require a custom export page. engine.preloadFile('main.pck').then(() => {
engine.startGame({ |
So are these changes okay and the seperation of the fonts will be handled in #691 ? |
No, after spending some hours doing research on this it appears this approach will not work. We're going to have to handle everything in code, and the process is going to be quite a bit different. Sorry for having you work on this, it's unfortunately the kind of thing you don't know until you see the problems arise. |
No, problem. |
Yes we have a good idea but the scope is bigger and the feature more complex than expected. This requires hosting files somewhere, downloading them, having various error handling, changing the fonts at runtime, etc. My teammate @Xananax will lay the foundations when he's available as he's experienced with networking. But this may take a while as we have other priorities at the moment. |
Please check if the PR fulfills these requirements:
Related issue (if applicable): #497
What is the current behavior?
Add some Traditional Chinese text to an Label with for example
font_documentation_bold.tres
as font.What is the new behavior?