Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please provide SFD files with *only* the ligatures #3

Open
fabiangreffrath opened this issue Jan 22, 2017 · 7 comments
Open

Please provide SFD files with *only* the ligatures #3

fabiangreffrath opened this issue Jan 22, 2017 · 7 comments

Comments

@fabiangreffrath
Copy link

Hi there,

first, thank you very much for this awesome project!

Some time ago, I have filed a request at upstream's bug tracker and asked them to integrate your fork into the mainline DejaVu fonts:

https://bugs.freedesktop.org/show_bug.cgi?id=97964

However, since I have not got a response for months now, I guess upstream is expecting a bit more than a nice idea and saying "please". Thus, I am going to provide a patch that integrates your fonts into the build system. For that, I will need you glyphs in separate files.

So, could you please provide SFD files that only contain the glyphs that you added or modified for your fork?

This would help a lot!

Thanks,

  • Fabian
@SSNikolaevich
Copy link
Owner

Thank you for feedback. I think it is too early to integrate this font to upstream. This font has some bugs which I don't know how to fix:

  1. KDE font viewer shows test string wrongly (aligning symbols by largest ligature width) and some substitution rules don't work.
  2. Hinting code for ligatures needs additional work. It was written manually and provides wrong results for some font sizes (Actually I never done this tasks before and don't have any manual. So I looked at code for other glyphs and did some amount of copy/edit/try iterations).

Also, yesterday I discovered that exists fork of my repository with more ligatures added (https://github.com/MartinPham/DejaVuSansCode). I planning to look closely on it next week.

@fabiangreffrath
Copy link
Author

Thank you for your reply!

I think it is too early to integrate this font to upstream. This font has some bugs which I don't know how to fix:

This is good to know, I hope you get to fix these bugs eventually. Maybe it's worth a try to have a look at how https://github.com/tonsky/FiraCode handles it. Anyway, I have linked this issue to the upstream request, so we can keep both in sync information-wise.

I planning to look closely on it next week.

This sounds like a good idea for sure!

Cheers,

Fabian

@eimai
Copy link
Contributor

eimai commented Jan 23, 2017

DejaVu dev here.

I don't think we can really add ligatures like this in DejaVu. First of all because most users wouldn't expect to get ligatures like this so we can't put this in the regular Mono font (if at some point users would be able to selectively chose which OpenType features like stylistic sets are applied that could get revised, but we've been calling for those features for many years, so don't hold your breath). So it would have to be in some extra font, and I'm not really a big fan of putting another one in. A fork like this maintained by someone else would be fine though.

Secondly, technically, a monospace font requires all glyphs to have the same width, which includes ligatures. In the Unicode age this really creates some issues, like ligatures, where the ligature, instead of being the combined width of all the glyphs, has to be squashed into the width of a single glyph. So one would have to abandon the "monospace" part of the font.

For combining diacritics which have to be zero width (but again, in a monospaced font these glyphs do have the same width as regular glyphs) there's an "ugly" OpenType hack to get the desired result, but I don't know if that's really possible for ligatures. I never tested it out, but you could maybe look into it to achieve similar effects, expanding the width rather than reducing it.

@fabiangreffrath
Copy link
Author

@eimai Thanks for your comment!

My idea has never been to add these ligatures to the regular DejaVU Mono font. Instead, I'd suggest to add a new "stub" font (e.g. "DejaVu Mono Code") that only consists of the ligatures and takes all the other glyphs from the regular DejaVu Mono font by some fontconfig trickery (yes, this is possible).

Second, the ligatures would have to have exact twice (or thrice, depending on how many glyphs they combine) the width of a single glyph. I think within these restrictions it should be possible to still declare and have the font recognized as monospaced (there are monospaced fonts that contain some CJK glyphs which require the horizontal size of two Latin glyphs).

@SSNikolaevich
Copy link
Owner

SSNikolaevich commented Feb 26, 2017

@fabiangreffrath Could you provide an example of such fontconfig or link to info how to do that. It would be great to keep ligatures detached from parent font (no need to merge changes from upstream etc.)

@fabiangreffrath
Copy link
Author

Please have a look at how it is done here:
https://github.com/powerline/powerline/blob/develop/font/10-powerline-symbols.conf

Though, this is quite the other way round here: The PowerlineSymbols font contains some additional glyphs that it would like to add to any of the monospaced fonts listed between the <family> markers. In the case here, the DejaVuSansCode font contains some additional glyphs, but it would like to take all the other glyphs from the regular DejaVuSansMono font.

So, I assume a rule like the following should be able to do the job:

	<alias>
		<family>DejaVuSansCode </family>
		<prefer><family>DejaVuSansMono </family></prefer>
	</alias>

Please note that I currrently have no chance to test this rule (I am currently far away from a computer running fontconfig-based OS or applications). Also, I am not sure if it makes more sense to use <prefer> or <accept> directives here, but that should be fairly easy to fnd out.

@SSNikolaevich
Copy link
Owner

@fabiangreffrath Thank you! The correct rule is:

    <alias>
        <family>DejaVu Sans Code</family>
        <prefer>
            <family>DejaVu Sans Mono</family>
        </prefer>
     </alias>

I have tried the ligatures only font and face some problems:

  1. I have to keep glyphs from which ligatures are depends on in order to make ligatures work.
  2. Some editors ignores fontconfig rules. For example, IDEA shows an unreadable bunch of squares.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants