feat: support font variants (bold/italic) from ~/.termux#5106
Open
sghoshm wants to merge 8 commits intotermux:masterfrom
Open
feat: support font variants (bold/italic) from ~/.termux#5106sghoshm wants to merge 8 commits intotermux:masterfrom
sghoshm wants to merge 8 commits intotermux:masterfrom
Conversation
|
Thank you for your contribution! I really like this❤️❤️❤️ |
|
The PR for this feature already exists here. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds support for loading font variants (
font-bold.ttf,font-italic.ttf,font-bold-italic.ttf) from~/.termux/.When present, these files are used for rendering bold and italic text instead of synthesized styles.
Motivation
Currently, Termux renders bold and italic using:
setFakeBoldTextsetTextSkewXThis causes:
Changes Made
Added support for optional font variant files:
~/.termux/font-bold.ttf~/.termux/font-italic.ttf~/.termux/font-bold-italic.ttfUpdated
TerminalRendererto select the appropriate typeface based on style flagsPreserved fallback behavior:
Implementation Notes
TerminalRendererHow to Use
Place font files in:
Example:
Reload settings:
Testing
Compatibility
Challenges Faced
terminal-viewmodule does not have access to shared constants, so paths are resolved locallyRelated Issue
Addresses the issue raised by @MapleMocha
Thanks to @MapleMocha for the original idea 🙏