elfmz / far2l

Linux port of FAR v2
GNU General Public License v2.0
1.79k stars 173 forks source link

Border display is broken on macOS #211

Open sev- opened 7 years ago

sev- commented 7 years ago

With majority of fonts I select on the far2l start, I am getting display problem with borders.

Courier New: screen shot 2016-11-21 at 15 32 14

Pragmata Pro: screen shot 2016-11-21 at 15 36 25

lieff commented 7 years ago

Try Menlo 11 font. There very few fonts really mono-spaced on macos.

sev- commented 7 years ago

No luck. Here is my screenshot with Menlo 11 screen shot 2016-11-21 at 16 44 22

eliah commented 7 years ago

I had the same issue, until I set PT Mono/20pt font. After that, border lines became proper. Try to experiment with different fonts and sizes, it could help farborders

sev- commented 7 years ago

PT Mono/20 worked, though it's ugly.

There must be some simple bug with determining the glyph width, so this glitch is triggered.

ddanila commented 7 years ago

Does not help for me both with PT Mono/20 and Menlo/11. osx Sierra 10.12.3 (16D32) / MacBook Pro (Retina, 15-inch, Mid 2014)

lieff commented 7 years ago

wxWidgets uses standard CTLineDraw function to draw text. It cannot be used anyway because it's very slow, far already have hacks to avoid that, but still not usable. Editor pages scrolled as slide-show and macbook heats and drains battery. We must use completely different method to draw text: get glyphs and draw them manually. This way used by most terminal emulators for macos.

elfmz commented 7 years ago

about perfomance - can you play with these: https://developer.apple.com/reference/coregraphics/1455656-cgcontextsetinterpolationquality?language=objc https://developer.apple.com/reference/coregraphics/1454253-cgcontextsettextdrawingmode?language=objc https://developer.apple.com/reference/coregraphics/1455178-cgcontextsetshouldantialias ..or in wx: http://docs.wxwidgets.org/3.1/classwx_graphics_context.html#a51e968476c72d3d77424cb8e11a14d65 http://docs.wxwidgets.org/3.1/classwx_graphics_context.html#af6ecb449cb732632a8d9b5c285d01b91

elfmz commented 7 years ago

..also these looks very useful: https://developer.apple.com/reference/coregraphics/1454767-cgcontextsetallowsfontsmoothing https://developer.apple.com/reference/coregraphics/1455816-cgcontextsetshouldsmoothfonts while not used in wx directly, default settings may be slow.. context should be accessible with wxMacCoreGraphicsContext::GetNativeContext()

lieff commented 7 years ago

There some sample code for fast drawing https://github.com/gnachman/iTerm2/blob/master/sources/iTermTextDrawingHelper.m But it's too big and complex, my primary idea for now is to use nanovg for macos and web version.

lieff commented 7 years ago

Try to tweak CTLineDraw too, but in any case it will be slower, supporting functions like CTLineCreateWithAttributedString already eats too much.

elfmz commented 7 years ago

Since gnome not hurrying to accept performance changes in broadway I'm ok about nanovg web backend experiment. But I also want to try to hack wx on hackintosh:) About changing backend - its not hard, the keypoint is to implement ConsoleOutputListener, then just remove everything in UI directory. Another big part is clipboard: APIClipboard.cpp should be rewritten almost completely for different backend (and ideally should talk to host clipboard, not sure if its possible without annoying popups).

elfmz commented 7 years ago

hm, I installed hackintosh on Windows-hosted vmware 12, guest OSX version =10.11.6 build everything according to your instructions (including wxwidgets v3.1) and.. performance looks not bad at all. Not so smooth as on host but approximately as UI of other applications there. At least with PT Mono 20.

ddanila commented 7 years ago

This particular ticket originally was about the broken border display, not about the performance. I do recommend to move performance issue to the separate ticket.

singalen commented 7 years ago

Lucky you, you only have lines skewed. For me, all the words are drawn shorter than they are. The longer the word, the more is trimmed, note the longest file name.

OS X 10.12, current git far2l version. I run far2l on a secondary non-HiDPI monitor where primary display is Retina, maybe it has something to do with it?..

PT Mono didn't help, as well as, say, Go Mono or any other one I tried.

screen shot 2017-03-22 at 14 56 13

elfmz commented 7 years ago

According to my inverstigation in far2l on osx monospaced fonts work correct only with sizes that are multiple of 5. Thats a 5, 10, 15, 20... Very strange, also not sure that on real MAC HW the multiplier will be same.

singalen commented 7 years ago

Indeed, it helped on a real Mac, thanks! Now I can get picky and note that now there's (still) a VERTICAL trimming. screen shot 2017-03-22 at 15 14 53

skabashnyuk commented 7 years ago

This setting is works for me 1;10;70;90;90;0;0;Andale Mono;50

2017-03-26 14 34 30

Related topics https://forums.wxwidgets.org/viewtopic.php?t=36908 http://trac.wxwidgets.org/ticket/13018

@elfmz does it make sense to write about this issue in a docs with some basic configuration that is more or less working for all? wxwidgets ticket doesn't looks like that we can do something with it?

From this list Monaco, Menlo, Courier, Courier New, Andale Mono only Andale Mono has no vertical or horizontal issues

elfmz commented 7 years ago

This also has no gaps: 1;20;76;90;90;0;0;PT Mono;56 as well as 1;15;76;90;90;0;0;PT Mono;56

skabashnyuk commented 7 years ago

Yes, I confirm that.

skabashnyuk commented 7 years ago

BTW what this numbers means?

elfmz commented 7 years ago

Dont know (except 2nd obviously is font size). This string is created and parsed by wxwidgets wxFont::GetNativeFontInfoDesc() and its platform-dependent, so in Linux its completely different.

singalen commented 6 years ago

BTW the nobuffering file helps.

strim commented 6 years ago

Спасибо за nobuffering, и правда помогло создать нулевой файл ~/.config/far2l/nobuffering Шрифт размером 12 стал отображаться без проблем!