dlangui icon indicating copy to clipboard operation
dlangui copied to clipboard

Unicode folders names do not display correctly

Open ncoe opened this issue 8 years ago • 12 comments

The file dialog, when displaying directories written with unicode characters such as chinese, only shows boxes. This is on windows.

Using the example dml editor for context image

ncoe avatar Oct 30 '17 03:10 ncoe

After much digging, I have found that I need a custom theme to select a font that can render those characters. That being said, is there an easier way to change the font face without duplicating the theme_default style, and setting a font in that fontface attribute? Most everything else looks like it is readonly.

ncoe avatar Oct 30 '17 18:10 ncoe

Doesn't deleting of libfreetype dll help?

buggins avatar Oct 31 '17 12:10 buggins

Мда... боюсь с тестерами на китайском тут не густо будет :)

kildin avatar Oct 31 '17 12:10 kildin

Just tried it, and that did not help :(. Only correcting the font in the style used allows those characters to display. I also tried altering the font for the widget specifically, which did not take effect either. Otherwise this has been working for my purposes.

ncoe avatar Oct 31 '17 16:10 ncoe

If you want change font for theme from code you can do something like this:

import dlangui.widgets.styles;
Theme theme = currentTheme;
theme.fontFamily(FontFamily.MonoSpace);
theme.fontFace("DejaVu Serif");
Platform.instance.onThemeChanged();

If you want change style for filedialog list try something like this:

Theme theme = currentTheme;
Style style = theme.get("STRING_GRID");
style.fontFamily(FontFamily.MonoSpace);
style.fontFace("DejaVu Serif");
Platform.instance.onThemeChanged();

Current there is STRING_GRID style but I think we should add another style for filedialog grid like FILEDIALOG_GRID. What do you think about that Vadim?

and3md avatar Oct 31 '17 17:10 and3md

@buggins Not FILEDIALOG_GRID - FILE_DIALOG_GRID will be better. I propose PR with this change.

and3md avatar Oct 31 '17 17:10 and3md

That does it. Thanks for the assistance troubleshooting.

ncoe avatar Oct 31 '17 20:10 ncoe

@ncoe From next release STRING_GRID will be changed to FILE_DIALOG_GRID. Can you give us feedback which font you use to see all characters and example strings to test it. So we can try change default theme to work properly with Chinese characters.

and3md avatar Nov 02 '17 17:11 and3md

The font I chose is 'Arial Unicode MS' since it sounded familiar and stood out. I did not search the entire font space for candidates that would would better on all platforms (if that is even an issue).

Some example strings:

  • 鼠牛虎兔龍蛇馬羊猴鸡狗豬 for the twelve animals of the chinese zodiac
  • こんにちわ for hello in japanese

ncoe avatar Nov 03 '17 00:11 ncoe

@ncoe Sorry for answer delay (have a lot of work). Thanks for example strings. I made some investigation and situation on windows is little complicated. Microsoft propose to use Segoe UI font for UI. But this font don't have Chinese characters. For Japanese they propose Meiryo font and for Chinese Microsoft JhengHei or Microsoft YaHei (https://msdn.microsoft.com/en-us/library/windows/desktop/dn742483.aspx).

Maybe there should be font based on locale or we should use Arial Unicode MS like you. Currently I don't know what is right. I reopen your issue, because I think that should be fixed in dlangui.

and3md avatar Nov 11 '17 15:11 and3md

@and3md No problem. Fonts are definitely complicated. A quick search shows at least 136,690 unicode characters which a font would need to define a glyph for, so they specialize where needed. Having the method you showed for overriding the font programmatically lets me find the test data I want. Good luck.

ncoe avatar Nov 11 '17 19:11 ncoe

We should implement feature - substitution fonts. For substitution of missing glyphs in one font using glyphs from other font.

buggins avatar Nov 15 '17 06:11 buggins