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

Box drawing characters are offset by a pixel #16

Closed
vlisivka opened this issue Jan 7, 2017 · 4 comments
Closed

Box drawing characters are offset by a pixel #16

vlisivka opened this issue Jan 7, 2017 · 4 comments

Comments

@vlisivka
Copy link
Contributor

vlisivka commented Jan 7, 2017

Box drawing characters are inconsistent in mc: horizontal line is not continuous, some vertical characters are offset by 1 pixel. Run mc and look at bottom right corner.

@kovidgoyal
Copy link
Owner

Yes, but unfortunately I know of no easy way to fix this. The problem is that rendering is done by freetype using whatever unicode font has those symbols on your system, I know of no way to force freetype to align those symbols -- whether they are aligned or not seems to depend on how they are defined in the font and the font size the font is rendered at (rasterization algorithm in freetype depends on font size).

So this will take some investigation. For anyone interested, the rendering code is in freetype.py and you can use the test_rendering() function, like this:

kitty -c "from kitty.fonts.freetype import *; test_rendering(text='some test text', sz=20, family='whatever font you are using')"

@kovidgoyal
Copy link
Owner

After investigating this issue a bit, I think the best approach is to directly draw the box drawing characters rather than using freetype. That way, it will work consistently on all system regardless of the availability of fonts, font rendering engine, hinting, anti-aliasing, etc.

@vlisivka
Copy link
Contributor Author

vlisivka commented Jan 8, 2017

Box drawing characters can be drawn without freetype, directly, like in other unicode terminals. They are just lines. This will eliminate any problems with them.

@kovidgoyal
Copy link
Owner

That's what I said in my previous post

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

2 participants