zed icon indicating copy to clipboard operation
zed copied to clipboard

linux: don't surpport chinese

Open ethan-phu opened this issue 1 year ago • 6 comments

Check for existing issues

  • [X] Completed

Describe the bug / provide steps to reproduce it

image

Environment

deeppin v23

If applicable, add mockups / screenshots to help explain present your vision of the feature

No response

If applicable, attach your ~/Library/Logs/Zed/Zed.log file to this issue.

No response

ethan-phu avatar Mar 14 '24 02:03 ethan-phu

Works perfectly fine for me on Ubuntu:

image

Possibly something related to your font configuration?

jansol avatar Mar 14 '24 12:03 jansol

@ethan-phu Do you have Noto Sans fonts installed? Looks like Zed tries to specifically fall back to those if the main font does not contain some glyphs.

jansol avatar Mar 19 '24 18:03 jansol

me too. image

but I run the gpui by Zed.

use gpui::*;

struct HelloWorld {
    text: SharedString,
}

impl Render for HelloWorld {
    fn render(&mut self, _cx: &mut ViewContext<Self>) -> impl IntoElement {
        div()
            .flex()
            .bg(rgb(0x2e7d32))
            .size_full()
            .justify_center()
            .items_center()
            .text_xl()
            .text_color(rgb(0xffffff))
            .child(format!("中文正常 Hello, {}!", &self.text))
    }
}

fn main() {
    App::new().run(|cx: &mut AppContext| {
        cx.open_window(WindowOptions::default(), |cx| {
            cx.new_view(|_cx| HelloWorld {
                text: "World".into(),
            })
        });
    });
}

it works.

image

@jansol I checked my ubuntu 22.04 , Noto Sans in my computer. but Zed can not display normally.

fc-list | grep noto
/usr/share/fonts/opentype/noto/NotoSerifCJK-Bold.ttc: Noto Serif CJK SC:style=Bold
/usr/share/fonts/truetype/noto/NotoSansMono-Regular.ttf: Noto Sans Mono:style=Regular
/usr/share/fonts/opentype/noto/NotoSerifCJK-Bold.ttc: Noto Serif CJK TC:style=Bold
/usr/share/fonts/opentype/noto/NotoSerifCJK-Bold.ttc: Noto Serif CJK JP:style=Bold
/usr/share/fonts/opentype/noto/NotoSerifCJK-Bold.ttc: Noto Serif CJK HK:style=Bold
/usr/share/fonts/opentype/noto/NotoSerifCJK-Bold.ttc: Noto Serif CJK KR:style=Bold
/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc: Noto Sans CJK JP:style=Regular
/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc: Noto Sans CJK HK:style=Regular
/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc: Noto Sans CJK KR:style=Regular
/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc: Noto Sans CJK SC:style=Regular
/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc: Noto Sans CJK TC:style=Regular
/usr/share/fonts/opentype/noto/NotoSerifCJK-Regular.ttc: Noto Serif CJK SC:style=Regular
/usr/share/fonts/opentype/noto/NotoSerifCJK-Regular.ttc: Noto Serif CJK TC:style=Regular
/usr/share/fonts/opentype/noto/NotoSerifCJK-Regular.ttc: Noto Serif CJK JP:style=Regular
/usr/share/fonts/opentype/noto/NotoSerifCJK-Regular.ttc: Noto Serif CJK KR:style=Regular
/usr/share/fonts/opentype/noto/NotoSerifCJK-Regular.ttc: Noto Serif CJK HK:style=Regular
/usr/share/fonts/opentype/noto/NotoSansCJK-Bold.ttc: Noto Sans Mono CJK TC:style=Bold
/usr/share/fonts/opentype/noto/NotoSansCJK-Bold.ttc: Noto Sans Mono CJK SC:style=Bold
/usr/share/fonts/opentype/noto/NotoSansCJK-Bold.ttc: Noto Sans Mono CJK KR:style=Bold
/usr/share/fonts/opentype/noto/NotoSansCJK-Bold.ttc: Noto Sans Mono CJK HK:style=Bold
/usr/share/fonts/opentype/noto/NotoSansCJK-Bold.ttc: Noto Sans Mono CJK JP:style=Bold
/usr/share/fonts/truetype/noto/NotoSansMono-Bold.ttf: Noto Sans Mono:style=Bold
/usr/share/fonts/truetype/noto/NotoMono-Regular.ttf: Noto Mono:style=Regular
/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc: Noto Sans Mono CJK SC:style=Regular
/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc: Noto Sans Mono CJK TC:style=Regular
/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc: Noto Sans Mono CJK HK:style=Regular
/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc: Noto Sans Mono CJK KR:style=Regular
/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc: Noto Sans Mono CJK JP:style=Regular
/usr/share/fonts/truetype/noto/NotoColorEmoji.ttf: Noto Color Emoji:style=Regular
/usr/share/fonts/opentype/noto/NotoSansCJK-Bold.ttc: Noto Sans CJK JP:style=Bold
/usr/share/fonts/opentype/noto/NotoSansCJK-Bold.ttc: Noto Sans CJK KR:style=Bold
/usr/share/fonts/opentype/noto/NotoSansCJK-Bold.ttc: Noto Sans CJK HK:style=Bold
/usr/share/fonts/opentype/noto/NotoSansCJK-Bold.ttc: Noto Sans CJK TC:style=Bold
/usr/share/fonts/opentype/noto/NotoSansCJK-Bold.ttc: Noto Sans CJK SC:style=Bold

aohanhongzhi avatar May 04 '24 02:05 aohanhongzhi

I solve the problem , I config the font.

https://zed.dev/docs/configuring-zed

image

image

{
  "ui_font_size": 16,
  "buffer_font_size": 16,
  "buffer_font_family": "DejaVu Sans Mono",
  "terminal": {
    "font_family": "DejaVu Sans Mono",
    "blinking": "off"
  }
}
fc-list | grep noto

fc-list | grep dejavu

image

editor and terminal is ok

image

aohanhongzhi avatar May 04 '24 02:05 aohanhongzhi

@aohanhongzhi you need to use the "ui_font_family" setting to change the font used in the project panel.

jansol avatar May 04 '24 17:05 jansol

@jansol you are right

image

aohanhongzhi avatar May 05 '24 04:05 aohanhongzhi

Surely the toolkit should be using fontconfig to select fonts? One font is not going to cover all characters, and there has to be some fallback logic; fontconfig is the standard way to configure this logic in the free software space.

nt8r avatar Jun 24 '24 16:06 nt8r

@nt8r there is "a" fallback logic, but the list of fonts in that is currently hardcoded... Definitely looking forward to proper fontconfig support for both that and for font aliases so I can just set the UI font to "sans-serif" and editor font to "monospace" and have it use the same fonts as all other well-behaved apps.

jansol avatar Jun 24 '24 20:06 jansol

This specific issue is "fixed" by #13568. It turns out Zed Mono was a font with stretch 7, but almost all fonts have stretch 5, so cosmic texts fallback stack was being ignored.

We should track migrating to fontconfig somewhere (there's an open question of whether we need to switch away from cosmic_text to do that, or if we can just upstream some changes).

ConradIrwin avatar Jun 27 '24 20:06 ConradIrwin