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

Is there a way to import Chinese fonts? #268

Open
king0952 opened this issue Jun 8, 2023 · 1 comment
Open

Is there a way to import Chinese fonts? #268

king0952 opened this issue Jun 8, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@king0952
Copy link

king0952 commented Jun 8, 2023

I've tried to use msdf-atlas-gen.exe to generate somefont.png and somefont.kayak_font files, but neither font_mapping.set_default(asset_server.load("somefont.kayak_font")); nor font_mapping.set_default(asset_server.load("somefont.kttf")); worked for me.
The terminal throws an error:

ERROR wgpu::backend::direct: Handling wgpu errors as fatal by default thread 'Compute Task Pool (1)' panicked at 'wgpu error: Validation Error`
Caused by:
    In CommandEncoder::copy_texture_to_texture
    Copy error
    copy of Z 500..501 would end up overrunning the bounds of the Destination texture of Z size 500

And I found pub const MAX_CHARACTERS: u32 = 500; in src/bevy/renderer/font_texture_cache.rs.
The Chinese character set is much larger than [0x20] - [0x7f], so is there a way to use a character set which is more than 500 characters?

@StarArawn
Copy link
Owner

I've tried to use msdf-atlas-gen.exe to generate somefont.png and somefont.kayak_font files, but neither font_mapping.set_default(asset_server.load("somefont.kayak_font")); nor font_mapping.set_default(asset_server.load("somefont.kttf")); worked for me. The terminal throws an error:

ERROR wgpu::backend::direct: Handling wgpu errors as fatal by default thread 'Compute Task Pool (1)' panicked at 'wgpu error: Validation Error`
Caused by:
    In CommandEncoder::copy_texture_to_texture
    Copy error
    copy of Z 500..501 would end up overrunning the bounds of the Destination texture of Z size 500

And I found pub const MAX_CHARACTERS: u32 = 500; in src/bevy/renderer/font_texture_cache.rs. The Chinese character set is much larger than [0x20] - [0x7f], so is there a way to use a character set which is more than 500 characters?

We can problem bump the character limit here to 2000. Feel free to open a PR. 👍

@StarArawn StarArawn added the enhancement New feature or request label Jul 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants