Closed KireinaHoro closed 7 years ago
Unfortunately, I do not have a good answer to this one.
Term48 uses a single TTF file for all glyphs. It expects the glyphs to be monospaced, and all glyphs to be of equal size. You can change which font you're using by editing the font_path
setting in .term48rc
, and the specified path can be either absolute or relative to $HOME
. If Term48 cannot open the font, or otherwise encounters an error when starting up, then it will try to revert to the default configuration, which uses the default courier font.
So in order to get good CJK coverage, you're looking for a single file, ttf, monospaced font that includes all the glyphs you're interested in. I don't know of one of these offhand, and my searches were not very fruitful (I suppose there is the GNU unifont, but it's a bitmap font, and doesn't seem to render well on my passport).
Sorry I cannot be more helpful. If you do find a nice font that includes better CJK coverage than the bundled fonts that come with BB10, I would be very happy to bundle it with Term48 to provide a better out-of-box experience (license permitting, of course).
In full-blown (modern) terminal emulators on PC, CJK characters are double-width (they are by nature) except some single-width katakana's, and if Term48 has to display all characters single-width'ly, this can be difficult to adapt. (I don't know how things are done in those terminals like Konsole
or rxvt-unicode
, I'll try digging in the source code and see) Actually there are single TTF files which include both CJK and Latin fonts (Noto Sans Mono CJK JP
for example), but i've tried those and they won't get recognized by term48.
Another part of the issue, which may seem easier, is the powerline fonts. Powerline is a project about more beautiful and useful statuslines for vim
, emacs
and shells. It makes use of some special single-width characters (which should work fine on term48 in contrary to CJK characters) and needs proper fonts (here) to render correctly. I downloaded them and term48 refuses to use them as well. These are just normal TTF (most of them are) fonts with the characters needed replaced by the correct typefaces. If these can be working, life will be much happier (they're real eye candy as you can see on the project page linked above).
Where are you finding the TTF versions of the Noto Mono CJK fonts? I can only find OTF versions, which don't usually work. Desktop terminal emulators usually leverage a system font manager that includes fallback fonts, etc., which is why they seem to have full glyph coverage. Term48 doesn't do this. I previously had tried to leverage the BB10 text rendering facilities to get this, but it had unwanted side effects on text input. Otherwise, patching Term48 to identify double width characters and handling them appropriately would be a bit of work, assuming it could be done relatively easily.
For powerline, I downloaded the DejaVu Sans Mono for Powerline TTF and set it to be the .term48 font, and it seems to work. I have attached a screenshot showing various unicode glyphs that seem to render correctly. I didn't have to do anything special to make the glyphs work - I just saved the ttf to my home directory as dejavu.ttf
, then edited .term48rc
to use font_path = "dejavu.ttf"
, then restarted Term48.
Thanks for the powerline font notice. (maybe I had a typo in my previous try, who knew)
Font formats can be converted to each other easily. FontForge
or even this online site can do them quite easily. If you really need some TrueType CJK font, I suggest looking into WenQuanYi
series (they're TrueType compared to Noto
being OpenType).
Ah, I had not looked into converting fonts, or merging several together. If good CJK support depends on supporting double width glyphs though, then we'd have to get that first.
I am glad you got the powerline font working. Cheers!
The title describes my question quite clearly. I've tried placing a
ttf
orotf
font in/accounts/1000/shared
, but obviously it didn't work (huge font size, the default font and still squares for powerline / CJK characters).Some CJK characters (Chinese & Japanese) for testing:
Chinese:
Japanese:
I don't speak Korean, and it's not included here.