What makes a font invalid for use in gVim? - vim

I'm using gVim on Windows 7 and I recently added some fonts to C:\Windows\Fonts. In gVim, I can :set guifont=Font_Name some of them and it gets set as expected, but for several others I get E596 Invalid font(s): Font_Name.
Obviously the fonts which do not make the cut either have or lack some property which gVim requires of fonts it loads. Does anyone know what those are, and what, if anything, one might do to modify an existing font so that it meets those criteria?
In particular, the following fonts fail:
Cronos Display
Liberation Mono
Monospace
I will not be surprised to learn that these fonts are incomplete or missing something that Vim requires. I just have no idea what to check for.

Did you read :h guifont?
I've already made wild guesses in another very similar question but I couldn't find it ATM. In short, GVim on Windows is very picky about its fonts: it wants a monospaced font but something in the fonts you have tried is not to its liking.
In this case, "Cronos Display" is obviously not monospaced so there's no way it could work. I don't know about "Monospace" but I'm surprised "Liberation Mono" doesn't work.
You could open the fonts in a font editor to seee if they are really monospaced.

Here is a similar question I asked, weirdly enough, in the same week.
In my case it boiled down to 2 things that I was able to tweak using FontForge:
Having the right PANOSE tag (whatever that is) of "Monospaced" instead of "Even Width"
All the characters have to have the same width. I was able to fix this by doing the following:
Select all elements
Element -> Validation -> Find Problems
Select Random -> Bitmap/outline advance mismatch
Select BB -> Check Advance: 600
Select OK
In my case, it brought up one by one a list of all the elements that had 0 width and gave me the option to fix them to have 600 width.
Changing these seemed to work for me, but I may have committed some sort of fontrocity.

Related

Previewing and Typing in Unicode font (Private Area / Basic Multilingual Plane) in Linux for SMuFL

I would like to make a change to an open source Android app which uses the Bravura font implementing the Standard Music Font Layout (SMuFL) fonts. I am developing on Linux.
The app displays musical notes with things like
<string name="notef_c5"> == ==</string>
which is displayed like
I now need to change things and I would like to see what I am going to do, rather than semi-randomly changing the Unicode numbers and see what happens. So I installed the font on my Linux desktop from github, by simply copying the SVG that the app is using into my global font directory and that did not work (fc-cache said /usr/share/fonts/svg/Bravura: caching, new cache contents: 0 fonts, 0 dirs). The same procedure for the OTF did work. This could be a problem down the line, since the app is using slightly modified version of the SVG, so any hint on that could help, but it's secondary regarding the question.
In fact I want to use "something" to display the font, and I tried many things, including Charmap and FontManager (which is almost the same as FontViewer). Charmap is the worst, displaying basically every single font installed on the machine even if I select just the Bravura (why is that???!) -- FontManager does the same (???!) -- FontViewer is almost passable, in that (when the "Characters" tab is selected) it display empty squares for the characters not defined in Bravura. Therefore with lots of careful scrolling it displays the "actual things" I am looking for, but it does not show their unicode values, and it's an extenuating search of few actual characters in a huge ocean of empty squares. So it's a no go anyway.
Is it possible that the best solution is just to blindly type Unicode values as described in the docs and see what happens? I know, if I were running Windows or Mac I could use Dorico SE but more generally there must be a better way of using Unicode in Linux, perhaps built for other purposes?
If you’re looking for specific symbols in the SMuFL specification, the full list of glyphs is available on the SMuFL website. (Note that the fonts themselves know nothing about music typesetting, they are simply collections of shapes to be used by a typesetting program. Even the simple example you provided is a composite of several carefully scaled and positioned glyphs, and simply changing the character codes may or may not work as intended.)
If you’re looking for ways to input Unicode characters on Linux, see the many suggestions provided here: How to type special characters in Linux?

How can I get VIM editor color coded by MIME extensions?

I should point out that I already have it color coded by way of konsole terminal emulator's built in profiles system, and I need that for the dark effects I have, too...
But I am coming to realize that I prefer staying in the terminal editor a lot more often than I used to. The only thing that I miss and can't really function without while doing certain types of file editing is the ability to have my code color coded specifically so that I can tell if the syntax looks right or not. My eyes hurt too much without it.
I'd be interested in the most simple and the most complex ways of intricate config.
Your question is very vague, but here are some settings for your .vimrc (or _vimrc on Windows) :
syntax on enables syntax highlighting
set background=dark, or set background=light if your terminal has a bright background
Your terminal might set TERM to conservative values. For example, try out TERM=xterm-256color. If your terminal has true color support, you can allow Vim to use GUI colors in the terminal with set termguicolors. Beware though that both of these have their downsides.

How to highlight variables in sublime?

How to highlight variables in sublime text 3? like in netbeans
Your question is not very clear, but here are some options. First, if you're just trying to get variables highlighted differently, you'll need a color scheme with more options than the default Monokai. There are many available on Package Control, but one in particular that I know will work (since I'm its author) is Neon:
You can use the excellent tmTheme Editor to see how this or hundreds of other themes will look (sort of) in different languages. (I say "sort of" because the highlighting engine used on the website is different than the one in Sublime, so there will be some differences. Overall it's pretty good, though.)
On the other hand, if you're trying to highlight all the instances of the $page variable, you'll have to do two things. First, double-click on $page to select it. Then, select Find -> Quick Find All (or use its keyboard shortcut) to select all the instances of $page in the document:
The gutter icons and colored underlines are from the BracketHighlighter plugin
Unfortunately, this is the only way to get this to work when using PHP and other languages like JavaScript that denote variables with a $ or other symbol. If we were to use Python, for example, you could just double-click on page and it would look like so:
As you can see, all the other instances of page have boxes around them. This behavior is hard-coded into Sublime, so while it can be turned on and off, it can't be modified or told to recognize other characters in any way.
Good luck!

multi-column terminal multiplexer?

Let me explain what I'm looking for, hopefully for the terminal, but if it exists in an IDE, i'll take that too.
I have a laptop with a 1366x768 resolution screen; I use vim for code-writing, and I use a fairly small font in my terminal (~7pt). So, as you might imagine, there's a lot of "wasted" horizontal space, especially when coding in a compact language like python.
I just checked and found that with a 6pt. font, the maxyx of my terminal is 82 rows x 271 columns. What I'd like to have, essentially, is a single terminal with the dimensions of 246 rows x 90(89?) cols, split into 3 panes and displayed side by side. But, they would need to behave as one contiguous vertical pane, i.e., when i scroll in my editor, all three of them scroll synchronously.
Does anyone know of a hack or anything to accomplish this? Maybe for vim/screen/similar?
Patching screen might be a fun project, but I don't have time to chase that rabbit. If someone out there does, though, I'll order them a pizza or something ;)
(although if i get around to it first, i'll have to order myself a pizza)
I had the very same desire and others want this as well. Lacking any options I implemented my own two column virtual terminal. See the --columns option for selecting a different number of columns than two.
EDIT: based on comments, I now understand the requirement better. i.e. viewing one text file in a newspaper-like multi-column format.
It seems more like an editor feature rather than a multiplexer feature (because the 2 editors should be linked). Thanks to #romainl for mentioning :set scrollbind. This seems capable of doing the job in combination with some additional vim magic.
Here's an superuser q&a showing how to use scrollbind for your purposes: https://superuser.com/questions/243931/how-do-i-maintain-vertical-splits-with-scrollbind-in-vim .
Original answer:
vim and [recently] screen both offer vertical-split, as does tmux.
I don't know about any way to scroll simultaneously, but tmux's 'synchronize-panes' does offer simultaneous input. Can be useful!
For vim, use :vsplit
For screen (recent versions), use C-a |
Alternative to screen, I use tmux. It offers (default keys)
C-b %, then you can use C-b :setw synchronize-panes for
simultaneous input across panes.
Hope this helps.

Vim: Changing appearance of line numbers (beyond standard options)

I'm trying figure out how far I can go in fine-tuning the appearance of my Vim GUI. I'm using MacVim 7.3 and what I'd like to do is change the padding, text-alignment and border color of the line numbers.
I know there are some standard configuration parameters in the highlight command, particularly the gui group, but what if I want something beyond what's offered there? For example, a right border as opposed to underline. Is this possible?
It could be that it's simply not worth the trouble, but I'd like to at least know what the initial steps would be so I can make the call. (Even if it's just :help adding-border-to-line-numbers and I happened to miss it).
Thanks.
No, unless you intend to go into vim's source and hack it from there, changing line numbers appearance beyond what highlighting offers is not possible.
However, I do remember a few patches that dealt with something of a kind, so you might want to check the archives. You will still need to recompile vim doing that (if you manage to find a patch that does that).

Resources