How to add support for a custom non-unicode font in VSCode? - visual-studio-code

I have a custom fantasy script which looks like this (just the text portion):
It is a monospaced font built with FontForge. How can I add support for it to VSCode, so I can type in ASCII (like the left side here), and it outputs the random UTF-8 symbol mapped to the custom font in VSCode? So I can then save the file and have it be either a bunch of gobbledygook characters or the ASCII characters I originally typed?
Ideally this could be a plugin, so if you know of an open source VSCode plugin which I could use as inspiration, that would be a perfect answer as well.
I see how to set a custom font in VSCode, but (a) that is globally, and (b) it doesn't necessarily solve the typing problem. I just really would like to know how to do this, not necessarily requiring an answer to implement it.
Recommended UX is to have a "separate keyboard" for it, meaning typing the keys on the keyboard would result in different values. Maybe something like that can be done on a per-file basis?

Related

PhpStorm editor encoding issue

I just have updated my PhpStorm to version 2016.1 and I have a really strange issue in editor, as you can see in the screenshot, some characters are screwed up.
When I copy/paste the text it is displayed correctly (the text before the require is "dojo"), I have tried changing the file encoding but without success (the file is UTF-8)
Someone already had this problem ? It is kind of annoying. See below my file encoding.
The problem don't seem to be the font (as suggested in comments) because italic is rendered:
It's not a problem with encoding .. but issue with your font. If you look at the screen -- only italic (or italic+bold) text has such problem.
How to check it:
If you select the text and copy-paste it into another editor (e.g. Notepad++ if you are on Windows) .. or even here into the actual Question -- will it copy that mangled text fine (I mean -- will it read "dojo" when pasted)?
Will it display it fine if you try another standard color schema -- e.g. "Default" or "Darcula"?
The issue can be with actual font (corrupted font files; somehow incomplete font data etc) .. or maybe even the with the way how IDE uses/renders it (e.g. font may not have separate "bold italic" style so IDE tries to mimic it and fails).
Either fix your font (re-download and reinstall; look for newer version maybe)
.. or use another font
.. or do not use italic (bold+italic) style

Using Scala & IntelliJ, show unicode arrows but don't change source-code

Scala allows to use the Unicode characters ← (\u2190) for <- and ⇒ (\u21D2) for =>
There are questions with answers on how to replace these characters (e.g. here and here) upon writing and even using post-processing (e.g. scala-style). These solutions however change the actual source-code. This means that if I'm using the Unicode style and my colleague isn't, we'll get a mix of styles in our source-code. Which in turn is something I dislike. (Meaning I'd rather use ASCII style arrows to prevent mixing styles.)
So I'm looking for a way to have a solution in the presentation-layer and not in representation. (like changing number-format using dot or comma for the decimal separator,.. it's not stored differently on disk.)
I'm aware that I could have Git do some funky stuff like it it does with line-endings for Windows, but I don't want to depend on Git for this. I just want IntelliJ (or Eclipse if someone knows how to fix it in Eclipse) to show me the Unicode arrows when it encounters the ASCII character version (preferably at the appropriate place, i.e. pattern-matching and for-comprehension).
Is this even possible in editors like IntelliJ and Eclipse? I'm willing to do some digging and writing plugins etc., but I'd rather not if it's not needed.
Since posting the question, IntelliJ has added native support to view arrows as if they are 1 character (called ligatures apparently).
From their whats new page:
We've added support for monospace font ligatures. To enable ligatures, go to Settings → Editor → Colors & Fonts → Font, choose a font that supports ligatures, e.g. FiraCode, Hasklig, Monoid or PragmataPro and select Enable font ligatures option.
If you want to see the lambdas as an arrow you can use the IDE settings.
I will go to IntelliJ Editor settings -> background, now enable the option "Enable ligatures".

Unicode characters for «email», «save», «print»

I want to make a fallback for my icon font. For example, for my beautiful icon font check mark I use Unicode check mark equivalent:
.icon-checkmark {
&:before {
content: "\2713"; /* Unicode Character 'CHECK MARK' (U+2713) */
}
}
My icon font has character with code "\2713" also. If my icon font fails to load, user will see Unicode check mark; if icon font loads successfully, user will see icon font's beautiful check mark.
I'm searching for Unicode character equivalents for «email», «save» and «print» entities. Are there any or similar in Unicode tables? I have searched on http://www.fileformat.info/ but with no luck.
(I have found only an «email» character — http://www.fileformat.info/info/unicode/char/1f4e7/browsertest.htm, but it does not work in Chrome 28 (it works in all other browsers however :).
Here's some ideas. I have not tested them on any browsers except Firefox on Linux.
Email: ✉, Unlikely: 
Print: ⎙
Save: ↓, ▼
Edit: 💾 \U0001f4be could be used for saving since Unicode 6.x
I was also looking for save (floppy disk) symbol.
💾 symbol (mentioned in #Dark Falcon answer) is colored and not adjustable with its adjacent text colors.
I finally got 🖫 from graphemica.com
We can adjust it in any color by CSS color property.
🖫 white hard shell floppy disk for save (U+1F5AB)
✉ print screen symbol (U+2399)
⎙ envelope for email (U+2709)
Your question is actually two-fold: which Unicode code-points are useful for your purpose, and which Unicode code-points are covered with common font installations.
And it raises a new question: why do some programs (Chrome on Windows?) not show correct glyphs where other programs can?
Regarding the first two questions: as you can see, these days some really useful symbols just don't work on many systems out of the box.
Regarding the last question: I have no idea, but some insights on Linux:
Many programs (including Chrome) end up using fontconfig via one way or another. That library is responsible to find the fonts useful to display certain "text". At a higher level, the rendering is done with a mix of fonts, because for more challenging (web page) text there will always be a situation where one font won't cover everything there to display. Might the reason be that another style is requested or a code point is not covered.
So if Chrome on Linux does not show one thing or another, install fonts which have those glyphs (in a way that integrates well with fontconfig-configuration).
I have no idea what drives font-mixing on Windows.

Is there a way to prevent the semi-bolding of Java keywords in Eclipse? (example pics inside)

I'm trying to switch to a "proper" IDE, but I just can't get past the terrible way it displays the font.
I'm using the Monaco Font in both sublimeText and Eclipse, both with a size of 9, regular.
Sublime looks like this:
Whereas Eclipse's rendering of the same font looks like this:
It's all semi-bold and smudgy looking! I notice that most of this is only for java keywords like, "public," "class," etc.. non keywords look fine. So, I'm guessing this is editable somewhere in Eclipse's many, many menus.
Does anyone know how to turn off the semi-bolding of keywords?
From the Window menu, choose Preferences. Then type "font" in the search field. You'll see the colors and fonts option that lets you adjust the appearance of several different languages, including Java. I assume you can remove the bold, although I didn't check the details.
The options described on this question may also be relevant.

Setting up your editor: indentation and encoding

I'm developing a small project with some friends and we're facing some indentation issues. Each of us is using a different editor (we all have different favorites :) and we also are on different operating systems.
What is the best solution to be able to all develop together and set our programming editors so indentation and encoding is the same? What settings do you recommend and why?
You should have your version control system handle the line ending problems. In SVN, the "svn:eol-style" property can be set to "native" to handle auto-converting the line endings. I assume your code is ASCII or UTF8 so you don't have problems with character encoding.
As far as formatting goes, you'll have to choose roughly some style, such as where to put the braces, but there's no reason you have to have the same indent style, provided you use the same number of indents. That's a confusing statement, so allow me to explain: nearly every IDE ever has the ability to set tab widths to any value you want. If one team member likes to indent 2 character widths, another 4, that's fine. One tab character stored in the file can display either way based on IDE settings. Just configure your IDE to indent with tabs and then set the tab widths per your desires.
(at the risk of starting a flame war, this is why I am solidly in the camp of tabs in the tabs vs spaces war. strangely, the spaces folks seem to consider this very feature the reason to use spaces... I will never understand them).
If you are all insistent to have your own indentation settings, then you will need to use exclusively the tab character to indent the code. (Provided your various editors support this).
This approach is counter to the general consensus of using spaces and only spaces for indenting purposes.
Whatever you do, I recommend converting tabs to a common number of spaces. I know Eclipse can do this on the fly, but I'm not sure if edits like gvim can. In any case, with all spaces it is not up to the individual editors/IDEs to interpret how many spaces make up a tab. Also, if anyone's using a Windows editor/IDE, set it to use Unix-style newlines, so that you don't get the annoying ^M at the end of every line when you edit in a different OS.