Skip to content

True italic fonts.#2829

Closed
j0ng4b wants to merge 2 commits into
termux:masterfrom
j0ng4b:master
Closed

True italic fonts.#2829
j0ng4b wants to merge 2 commits into
termux:masterfrom
j0ng4b:master

Conversation

@j0ng4b

@j0ng4b j0ng4b commented Jun 9, 2022

Copy link
Copy Markdown

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...).

j0ng4b added 2 commits June 8, 2022 03:18
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
Copy Markdown
Member

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

@MrAdityaAlok

MrAdityaAlok commented Jul 6, 2022

Copy link
Copy Markdown
Member

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

j0ng4b commented Jul 8, 2022

Copy link
Copy Markdown
Author

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

budchirp commented Jul 12, 2022

Copy link
Copy Markdown

Why is this not merged? This works perfect.

@2096779623

Copy link
Copy Markdown
Member

Why is this not merged?

image

@budchirp

Copy link
Copy Markdown

Screenshot_20220712-110921_Termux

@rendiix

rendiix commented Jul 25, 2022

Copy link
Copy Markdown

Waiting for this project to be fixed and merged

@luisdavim

Copy link
Copy Markdown

@j0ng4b @agnostic-apollo can this be merged?

@Xemptuous

Copy link
Copy Markdown

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

@rendiix

rendiix commented Nov 16, 2022

Copy link
Copy Markdown

Hopefully it's fixed soon

@hacker-hackman

Copy link
Copy Markdown

Please, resolve the conflicts 🙏

@TermuxMonet

Copy link
Copy Markdown

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

@mrtnvgr

mrtnvgr commented Feb 18, 2023

Copy link
Copy Markdown

Any updates?

@j0ng4b

j0ng4b commented Feb 26, 2023

Copy link
Copy Markdown
Author

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
Copy Markdown

Hey, are there any updates on this?

@JaysonEdenfield

Copy link
Copy Markdown

i think bro forgot about this

@Alomgir-Bhuiyan

Copy link
Copy Markdown
Screenshot_20260531-094440-1

Help requested,
Termux: 0.119.0-beta.3

Comment on lines +452 to 463
mRenderer = new TerminalRenderer(mRenderer.mTextSize, newTypeface, newItalicTypeface);
updateSize();
invalidate();
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

j0ng4b:master

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So i have to build the whole thing with this PR?

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