tonsky / FiraCode

Free monospaced font with programming ligatures
SIL Open Font License 1.1
76.17k stars 3.08k forks source link

--> issue #89

Open umanwizard opened 8 years ago

umanwizard commented 8 years ago

I'm not sure if this is fixable, but...

in C-like languages, something like while (x --> 0) should render with the -- and > as separate glyphs; NOT with --> as one big ligature.

Are there languages that use --> that would conflict with this behavior ? I'm not familiar with any.

MadcapJake commented 8 years ago

html comments for one

MadcapJake commented 8 years ago

If you're using Atom Editor, looking over language-c, it appears that no operators are actually tokenized so you'd need to submit a PR that applies a separate rule for -- and > (or really just one of the two would cause the ligature to stop appearing).

JTBrinkmann commented 8 years ago

the good old "downto arrow" (pseudo) operator~ I think it makes sense having it as a single arrow, even in C.

be5invis commented 8 years ago

This points out a key problem: there's no indication for programming languages in OpenType. For natural languages, it's pretty simple:

feature liga {
    lookup HAS_I {
        sub f f i by f_f_i;
        sub f i by f_i;
    } HAS_I;

    lookup NO_I {
        sub f f l by f_f_l;
        sub f f by f_f;
    } NO_I;
    script latn;
        language dflt;              
        language TRK exclude_dflt;   # default lookups are excluded.
          lookup NO_I;               # Only this lookup is included under the TRK language
} liga;

So, if the editor CAN provide a script/language tag to the font, the feature can be written like this:

feature calt {
    ...
    script code; # or maybe latn
      language LIKC; # c-like
        lookup double_hyphen;
        lookup short_arrow;
      language HSKL; # Haskell
        lookup double_hyphen;
        lookup short_arrow;
        lookup long_arrow;
    ...
} calt;
tonsky commented 8 years ago

That’s not the problem. Even within same language, people just can’t agree on what features they want to see. Some want --> even in C++. Some don’t want /> even in HTML.

On Sat, Feb 27, 2016 at 2:14 AM Belleve Invis notifications@github.com wrote:

This points out a key problem: there's no indication for programming languages in OpenType. For natural languages, it's pretty simple:

feature liga { lookup HAS_I { sub f f i by f_f_i; sub f i by f_i; } HAS_I;

lookup NO_I {
    sub f f l by f_f_l;
    sub f f by f_f;
} NO_I;
script latn;
    language dflt;
    language TRK exclude_dflt;   # default lookups are excluded.
      lookup NO_I;               # Only this lookup is included under the TRK language

} liga;

So, if the editor CAN provide a script/language tag to the font, the feature can be written like this:

feature calt { ... script code; # or maybe latn language LIKC; # c-like lookup double_hyphen; lookup short_arrow; language HSKL; # Haskell lookup double_hyphen; lookup short_arrow; lookup long_arrow; ... } calt;

— Reply to this email directly or view it on GitHub https://github.com/tonsky/FiraCode/issues/89#issuecomment-189463371.

davidcelis commented 8 years ago

in C-like languages, something like while (x --> 0) should render with the -- and > as separate glyphs; NOT with --> as one big ligature.

Without being super familiar with C-like languages, why is having --> render as a ligature a bad thing?

html comments for one

This is another one I don't understand. HTML comments look perfectly fine with ligatures:

MadcapJake commented 8 years ago

Yes they (HTML comments) do, I was responding to the author's question.

The author wants -- to ligaturize as the decrement operator and (though I'm not terribly aware of C), I thought this was basically a hack or at the very least an obfuscation.

engelfrost commented 8 years ago

This does not solve the issue, but IMHO the whole point of writing while (x --> 0) in C is to make it look like a single symbol or token (otherwise you would write while (x-- > 0)), and the point of Fira Code is to make these multi-character symbols look like a single symbol.

Something that might actually be useful is a font customization tool similar to the one Input has: http://input.fontbureau.com/preview/ (Would something like this be doable for Fira Code, technically? Does assembling a custom set require access to the original source files?)

tonsky commented 8 years ago

No idea about font builder — haven’t looked into the pipeline and what’s required for this. Right now I’m building font in Glyphs 2 which is a desktop app.

On Tue, Mar 15, 2016 at 10:43 AM Josef Engelfrost notifications@github.com wrote:

This does not solve the issue, but IMHO the whole point of writing while (x --> 0) in C is to make it look like a single symbol or token (otherwise you would write while (x-- > 0)), and the point of Fira Code is to make these multi-character symbols look like a single symbol.

Something that might actually be useful is a font customization tool similar to the one Input has: http://input.fontbureau.com/preview/ (Would something like this be doable for Fira Code, technically? Does assembling a custom set require access to the original source files?)

— You are receiving this because you commented. Reply to this email directly or view it on GitHub: https://github.com/tonsky/FiraCode/issues/89#issuecomment-196722060

tobia commented 8 years ago

@umanwizard while (x --> 0) is obfuscated C code. Please don't do it.

JTBrinkmann commented 7 years ago

I'd say it's more stylized than obfuscated.

easyaspi314 commented 7 years ago
#include <stdio.h>
#include <fira_code.h>
#include <ligatures.h>
#include <mad_style.h>

char isStyle() {
    while (fira_code --> ligatures) {
        if (mad_style) {
            return '😎';
        }
    }
}

Had to.