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

True italic fonts. #2829

Closed
wants to merge 2 commits into from
Closed

True italic fonts. #2829

wants to merge 2 commits into from

Conversation

j0ng4b
Copy link

@j0ng4b j0ng4b commented Jun 9, 2022

Closes #711. Adds support to true italic fonts. If an italic font file (~/.termux/font-italic.ttf) not exists, fallback to previous italic effect.

One thing that maybe can be an issue is to use two different kinds of fonts. This isn't easy to handle with my current knowledge of the code then should be avoided if possible (sane people will not use two different fonts, I hope...).

True italics are enabled if a font-italic.ttf is present in
${HOME}/.termux folder, if this file not exists fallback to default
behaviour of italics.
It's very difficult to notice and explain, but it occurs when the cursor
is blinking over an italic text it's "shrunken", this is more visible
with slashes.
@2096779623
Copy link
Member

If this PR is merged please add a corresponding tip here:
https://wiki.termux.com/wiki/Termux:Styling

@MrAdityaAlok
Copy link
Member

MrAdityaAlok commented Jul 6, 2022

One thing that maybe can be an issue is to use two different kinds of fonts.

@j0ng4b I couldn't understand that. Can you provide an example?

I tried this PR with two different fonts and it works:

  • Regular font (~/.termux/font.ttf): Hack regular nerd font.
  • Italic font (~/.termux/font-italic.ttf): Inconsolata italic nerd font.

Screenshot_2022-07-06-10-41-16-125

@j0ng4b
Copy link
Author

j0ng4b commented Jul 8, 2022

I couldn't understand that. Can you provide an example?

This is most related to the render function that's do all the math before draw things on the canvas (if I don't miss understood). This by now only consider the normal font dimensions (line height, acent etc...) to do this math if this dimensions differ from normal and italic the text could be wrong draw (maybe I'm wrong about this).

For example, the fonts with the same or almost the same dimensions:
Same dimensions fonts

When mixing the italic text and normal text everything goes well in this case, but when using fonts with different dimensions this is the result:
Different fonts dimensions case one

Different fonts dimensions case two

On the two images the result is different because the base (non-italic) font width used to do the math before draw change in the two fonts.

@budchirp
Copy link

budchirp commented Jul 12, 2022

Why is this not merged? This works perfect.

@2096779623
Copy link
Member

Why is this not merged?

image

@budchirp
Copy link

Screenshot_20220712-110921_Termux

@rendiix
Copy link

rendiix commented Jul 25, 2022

Waiting for this project to be fixed and merged

@luisdavim
Copy link

@j0ng4b @agnostic-apollo can this be merged?

@Xemptuous
Copy link

Waiting for this PR merge conflicts to be resolved to see if it fixes my italic clipping issues with neovim. Any progress?

@rendiix
Copy link

rendiix commented Nov 16, 2022

Hopefully it's fixed soon

@hacker-hackman
Copy link

Please, resolve the conflicts 🙏

@TermuxMonet
Copy link

For anyone who wants to build, the PR is still working, there's very simple conflicts

@mrtnvgr
Copy link

mrtnvgr commented Feb 18, 2023

Any updates?

@j0ng4b
Copy link
Author

j0ng4b commented Feb 26, 2023

When I get some time I'll work on improve this (maybe add true bold fonts) and fix the conflicts.

@j0ng4b j0ng4b closed this Feb 26, 2023
@Duckulus
Copy link

Hey, are there any updates on this?

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

Successfully merging this pull request may close these issues.

True italic font support