Some terminals, such as urxvt, support display text in italics via the sitm and ritm terminfo entries:
echo `tput sitm`italics`tput ritm`
I'd like to use this in an application I've got which wants to render real italics into the console. Unfortunately the application is ncurses-based, and ncurses doesn't seem to have a attribute for italics --- it's got a whole bunch, including invisible text (which I'm sure is useful for something), but no italics.
Does anyone know of a way to trick ncurses into displaying italic text, or am I going to have to ditch ncurses and rewrite the program to use raw terminal sequences?
It looks like ncurses 5.10 will contain A_ITALIC. The change went in on September 31 2013:
http://invisible-island.net/ncurses/NEWS-contents.html#t20130831
pdcurses supports A_ITALIC as well so there's at least a vague nod to compatibility. Unfortunately, this won't help me much until 5.10 is released and then becomes widespread...
Related
Reference text: どうもありがとうございました
Copied to:
Notepad/Notepad++: displays it with no problems
LibreOffice Writer: it changes the font family to work, if you convert to Lucida Console, square boxes appear
Windows: displays it with no problems
Console: it needs the correct chcp and a font family (Lucida Console displays square boxes here too) which can display them if I am right
Is it possible to explain why Notepad can display any text in any font family and LibreOffice + Console cannot? Where is(are) the difference(s)? Is it possible to have the same behaviour on the console as the Notepad does for example?
Some Windows fonts have glyphs for many different scripts, some cover a few scripts, and many cover just one. (Fonts which support many scripts are sometimes called "Unicode fonts," which can be a misleading term. In other OSes, these kinds of fonts are more prevalent. Windows itself doesn't ship with any, though I think you get one or two with the Office suite.)
When you try to output text in multiple scripts using standard Windows functions using one of the well-known fonts, then Windows uses font fallback and/or font linking, which automatically switches between fonts as needed to output the whole string. Most programs, like Notepad and Notepad++, thus get coverage automatically.
I haven't read the LibreOffice code, but I suspect that when you select a font for a span of text, it sticks with that font, effectively preventing Windows's font fallback and font linking mechanisms from helping. This isn't surprising, since a WYSIWYG editor is likely to use lower-level APIs for outputting text in order to have more typographic control. But using the lower-level APIs means you don't get fallback and linking for free, so you'd have to implement it yourself, and that's a lot of extra work that may not be important to very many users.
The Windows console has a lot of legacy and limitations that persist for backward compatibility with older programs. The console mostly emulates DOS systems, which didn't have any sort of Unicode support and instead relied on "Code Pages," which are, roughly speaking, alternate mappings between character values and glyphs. Code Pages are geared at just one (or maybe two) scripts, so if you need characters from another script, you were basically out of luck. I think modern versions of Windows have hacked in some support for a pseudo code page that supports UTF-8, but I've never gotten it to work well and it, too, has limitations.
I wonder if you can help me with this rather bizarre phenomenon.
I'm using Gimp 2.8.3 on a Mac OS 10.9.5 and I try to insert text with the Text Tool. Easy enough, but when I type e.g. "Jazz", I get as far as "J", and then the "a" is interpreted as command and the airbrush tool gets activated. This happens with every (lowercase) key which in principle has a command function.
I checked the manual but there's no mention of something that needs to be switched off to use the text entry tool.
Anybody seen this before?
Thanks, Rob
Update: I've had the brilliant idea to check for Gimp updates. Turned out, there's a Gimp 2.8.14 now, which doesn't show this behaviour anymore. So, it seems to have been a bug in Gimp which luckily has been fixed.
Just for the record: if anyone is hit by this or a similar bug, there is a workaround if upgrading/fix is not an option: gimp 2.8, the old off-image text editor for creating text can be used, by checking the Use editor control in the text tool options.
GIMP will them pop a small blank window where the text can be typed without being intercepted by other parts of the application.
I have been using Cygwin to build my Android library using the NDK's ndk-build script and Cygwin's make tool. It started giving me errors with a bunch of Latin non-English characters. When copying the text to Google, it was pasted as Hebrew (which I can read). Is there any way to force it to output errors in English? Any idea why this happens?
Check your environment variables for the correct locale. LANG or LC_MESSAGES are probably responsible. Set those to an English locale (in your profile to have that in future sessions as well) to get English error messages. Sorry, I'm a Windows person and know nearly nothing of Unix so you'd have to look up the specifics elsewhere, but this should be the general direction to go.
Some programs/libraries try to be overly smart by guessing the locale from the keyboard layout or the user's locale. And oftentimes ignoring the fact that on Windows locale and UI language are two different concepts (and that different languages on the console are even harder to get right).
As for why the messages appear garbled that's likely because the console window uses the wrong code page. The easiest fix is usually to use a TrueType font for the console window, but in this case neither Consolas nor Lucida Console include glyphs for Hebrew, so you'd only see boxes anyway.
Here's what I did:
cp ~/.vim/colors/ir_black.vim /usr/share/vim/vim72/colors/
Then tried to open some code and :colorscheme ir_black
It changes a few colors but makes most of the text start to blink with the cursor.
It happens with almost all the other custom colorschemes as well. Does anyone have any ideas of what might be wrong?
I added t_Co=256 to my .vimrc file and it didn't seem to help.
PS: I'm on a Mac OS X.
Set your TERM to xterm-256color. Follow up on the iterm2 mailing list if that still doesn't work.
Edit : I found an exact duplicate of your question :here. It seems to be an issue with iTerm not supporting 256 colors by default.
The usual problem with color scheme and terminal is that terminal are often limited to 256 colors, and GUI color scheme are using 2^32 colors. So some of them are not correctly rendered in terminal.
There is a simple test to check: if you are lauching the GUI version is the color scheme rendered correctly ?
The possible solution are :
1. Convert your color scheme to 256 colors using the following plugin : CSApprox.vim
2. Choose a different color scheme. (Often on Vim.org color schemes compatible with Terminal have "256" in their name, like "wombat256" for example)
3. Use a GUI version like MacVim or GVim
If I remember correctly, the color sheme Zenburn is working nicely with both GUI and terminal version. It is rather dark with pastel colors.
Personal story : after spending ages to fiddle with color scheme to get something right for terminal, I switched to the GUI version. The GUI version with the icon bar hidden is not really different to terminal version anyway, as long as you are working locally
the default vim binary in /usr/bin/ will not work with any terminal. you need to have a version that supports gui - type "echo has('gui')" in vim command mode to check.
so your only option is to use a gui one (macvim etc.), or compile it with athena, gtk or x11 with macports, but i would advise against the latter, because it pulls down a shitload of dependencies.
i think it's better to use macvim for serious development that needs syntax highlighting, and use the 16 colour version in the terminal for quick edits.
I'd like to have vim display my comments in italics, and I understand I need to place
cterm=italic
in the
hi Comment
line in the color.vim file I'm using. This, however, is having no effect on the text display, which I suspect has to do with some Terminal.app setting, unless I'm misunderstanding the vim syntax. I'd appreciate if someone can show me how to enable this feature.
Additionally, I am currently using the Monaco font, which does not have a separate italic file (however, the italic syntax-highlighting doesn't work for Consolas, Lucida, Bitstream Vera or other italic- or oblique-enabled fonts either). Assuming that a solution exists for fonts with italics, do I have to jump through any further hoops to get Monaco working?
Thanks for any input.
EDIT:
I'm surprised I haven't gotten an answer yet; this doesn't seem like it should be too difficult to do. Maybe it is. Alternatively, could someone explain why this would not be possible?
As of OS X Sierra 10.12, the default terminal app supports italics; however, the included version of ncurses contains xterm terminfo files that do not declare italic support (they do not define the sitm capability). To work around this in Vim, add the following to your vimrc file to define the terminal commands for enabling/disabling italics:
let &t_ZH="\e[3m"
let &t_ZR="\e[23m"
Then make sure the font you use supports italics and also your colorscheme contains italic for some syntax parts. Or, to customize the syntax highlighting locally to format comments in italics, add the following to your vimrc file:
highlight Comment cterm=italic
As of SnowLeopard, Terminal doesn’t support the italic attribute (SGR, value 3). Feel free to file a request at http://bugreporter.apple.com.
Update: Italic support was added to Terminal in macOS Sierra 10.12. Note that the xterm terminfo files included with that version of ncurses do not declare the italic sitm capability. See the vim-specific workaround in Bahman Eslami’s answer https://stackoverflow.com/a/53625973/754997 or cheon’s answer https://stackoverflow.com/a/48512956/754997 for creating a terminfo file that declares sitm.
Italic support was added to Terminal in macOS Sierra 10.12 (after this question was asked); however, the xterm terminfo files included with that version of ncurses do not declare the italic sitm capability. You can work around this by creating a local terminfo file that declares the capability and inherits whichever terminfo file you’re currently using.
In the following instructions, use whatever name TERM is set to. xterm-256color is the default used by Terminal’s built-in default profiles.
Create a file named xterm-256color-italic.terminfo:
# A xterm-256color based TERMINFO that adds the escape sequences for italic.
xterm-256color-italic|xterm with 256 colors and italic,
sitm=\E[3m, ritm=\E[23m,
use=xterm-256color,
Run tic xterm-256-italic.terminfo in your terminal, it will generate a file ~/.terminfo/78/xterm-256color-italic. This file will be found by ncurses automatically when TERM is set to the file’s name.
To set TERM=xterm-256-italic for an individual Terminal profile:
or you can just replace /usr/share/terminfo/78/xterm-256color with ~/.terminfo/78/xterm-256color-italic
sudo cp /usr/share/terminfo/78/xterm-256color /usr/share/terminfo/78/xterm-256color-bak
sudo cp ~/.terminfo/78/xterm-256-color-italic /usr/share/terminfo/78/xterm-256color
Then you can find italics font in vim:
Italics support is coming to the iTerm2 terminal app - it's in the nightly builds now. As mentioned in the enhancement request you need to configure the TERMINFO var correctly.
Konrad, don't know about Terminal.app, but italic is supported in a lot of different terminal emulators.
urxvt, konsole, gnome-terminal come to mind.
You can't with the regular monaco-font it seems.
It seems that only MacVim enables the italics.
Here
In my testing, adding set background= or set background=dark or set background=light to one's vimrc file does the trick! Even if I am using the default preinstalled xterm-256color terminfo with no italics information in it! Nothing else works, even if I use xterm-256color-italic suggested in previous answers.
Complete solution, building on top previous answers is:
let &t_ZH="\e[3m"
let &t_ZR="\e[23m"
highlight Comment cterm=italic
set background=dark " or set background=light or set background=
I don't know why this is so, have asked a question to Vim devs.