-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Add font_feature_settings
#2248
Conversation
457794e
to
1db613e
Compare
Thanks @martinetd
It was from an earlier stage of development and is not needed
So before I review the actual code, a couple of comments about the design of the option:
|
Backwards compatibility is not threatened by this patch because if it's unset, However, perhaps it is better to make it so that it is also possible to specify a set of feature tags on hover as well? The reason I don't want to "simply add -calt" is because every font works differently. Fira Code uses |
For complaint №2, how about I just add the information to |
(Sorry for the triple post, more thoughts keep coming to mind.) @kovidgoyal What do you think about this syntax?
|
On Sat, Jan 04, 2020 at 12:44:46AM -0800, Fredrick Brennan wrote:
Backwards compatibility is not threatened by this patch because if it's unset, `disable_ligatures` still works. It only works differently if set.
Yes, thats the backward compat I am referring to.
However, perhaps it is better to make it so that it is also possible to specify a set of feature tags on hover as well?
The problem with this is it is much harder to use compared to
disable_ligatures. You have to know the postscript names of all fonts
you use and set it for each individually. disable_ligatures is just
single simple setting.
The reason I don't want to "simply add -calt" is because every font works differently. Fira Code uses `calt`, but some other fonts use `liga`
No monospace font I know of uses anything other than CALT for
programming ligatures, which is what disable ligatures is about
disabling, not ligatures in general, which anyway dont render well
monospaced.
If you like you can have disable ligatures optionally take feature
names, and when no feature names are specified, defaults to CALT.
|
On Sat, Jan 04, 2020 at 12:47:22AM -0800, Fredrick Brennan wrote:
For complaint №2, how about I just add the information to `kitty --debug-font-fallback`?
Leave it as is, I will take care of adding psnames to list-fonts.
|
I do like, but are you sure you don't want it to be font-keyed? |
On Sat, Jan 04, 2020 at 12:57:01AM -0800, Fredrick Brennan wrote:
> If you like you can have disable ligatures optionally take feature names, and when no feature names are specified, defaults to CALT.
I do like, but are you sure you don't want it to be font-keyed?
Yes, I am fine with adding syntax to font_features to specify for cursor
or not in addition, but disable_ligatures should be global.
|
Understood, I will do it. No need to review before then. Thanks Kovid (Also, wow, you wrote Calibre too? That program uses Python extensions better than any software I've ever had the pleasure of working on. I tried to convince another FontForge developer of its superiority, but I haven't quite managed to do so yet. If I had it my way we'd copy how you did it.) |
On Sat, Jan 04, 2020 at 01:15:12AM -0800, Fredrick Brennan wrote:
Understood, I will do it. No need to review before then. Thanks Kovid
Thanks :)
(Also, wow, you wrote Calibre too? That program uses Python extensions better than any software I've ever had the pleasure of working on. I tried to convince another FontForge developer of its superiority, but I haven't quite managed to do so yet. If I had it my way we'd copy how you did it.)
Been using Python+C for a long time now, and I was never happy with
pythons' default methods for building/integrating with C extensions, so
rolled my own. Fortunately my techniques have aged well :)
|
@kovidgoyal I've pushed a change for your review; it makes Just so you know, I have decided to shelve the hover syntax for now. I couldn't think of a case where it's actually useful, and to implement it would mean more work than I have time for right now for something I won't use myself. If someone has a real use idea for it, and I like it, I might open a new PR for it in future though. I hope that's okay with you. |
Would that be possible to default reading font_features from fontconfig on linux when available? It seems to be what it is done to read the font_family no? |
Sure, dont think I am interestedin writing the code for it, but a PR is |
Hi @Diaoul. I don't understand what you mean. I might be interested if you explain. Are you saying that there is a way to instruct Fontconfig as to what features should be enabled whenever a font is used? |
Glad to see fontconfig support has been done, now using it myself :-) Thanks @Diaoul! Always nice when I implement a PR then my PR is improved. :-D <!-- $ cat ~/.config/fontconfig/conf.d/99-fira-code-fontfeatures.conf -->
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<description>Enable select opentype features for FiraGO.</description>
<!--
Typographic features are provided on a per-typeface basis.
Tables with all available features are available here:
https://en.wikipedia.org/wiki/OpenType_feature_tag_list
Also read the fontconfig user spec:
https://www.freedesktop.org/software/fontconfig/fontconfig-user.html
-->
<match target="font">
<test name="family" compare="eq" ignore-blanks="true">
<string>Fira Code</string>
</test>
<edit name="fontfeatures" mode="append">
<string>tnum on</string> <!-- tabular numbers -->
<string>zero on</string> <!-- slashed zero -->
</edit>
</match>
</fontconfig> |
Close #2247
This doesn't look like very much code; but as they say, reading code is much harder than writing code, and I had to really understand how Kitty works to write this, so it took a long time. 😄