kayak_ui icon indicating copy to clipboard operation
kayak_ui copied to clipboard

Is there a way to import Chinese fonts?

Open king0952 opened this issue 1 year ago • 1 comments

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?

king0952 avatar Jun 08 '23 01:06 king0952

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 avatar Jul 07 '23 15:07 StarArawn