Author Topic: Minimap zoom-out limit  (Read 2571 times)

jporkkahtc

  • Senior Community Member
  • Posts: 2620
  • Hero Points: 210
  • Text
Minimap zoom-out limit
« on: August 15, 2018, 11:49:43 PM »
VisualStudio code minimap shows lines 1 to around 650, while on the same file Slicks minimap shows about 380 lines (Its hard to be precise of course).

This is with both apps maximized and both showing 68 lines in the main edit area.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6826
  • Hero Points: 526
Re: Minimap zoom-out limit
« Reply #1 on: August 16, 2018, 12:33:33 AM »
SlickEdit uses real fonts in the minimap and doesn't mess with them. At some point, we may try to either dynamically create our own or do something else as an option of course.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6826
  • Hero Points: 526
Re: Minimap zoom-out limit
« Reply #2 on: August 16, 2018, 01:33:58 AM »
On my machine Visual Studio Code uses a 2 pixel font and SlickEdit is using a 3 pixel font (Consolas 1 point). We would have to create our own (something we may do), to make one smaller. I have a 4k monitor.

For me on macOS, SlickEdit uses a 2 pixel font. The small fonts on macOS look pretty darn good too.

jporkkahtc

  • Senior Community Member
  • Posts: 2620
  • Hero Points: 210
  • Text
Re: Minimap zoom-out limit
« Reply #3 on: August 16, 2018, 06:50:15 PM »
I was surprised you are rendering text in the minimap at all - instead of just drawing lines.
But I suppose, it is easier to just use your normal text rendering code.
Having coloring in the minimap is pretty cool too.


Does the font used in Minimap use one of the fonts selected in Tools > Options > Appearance > Fonts ?

Zoomin/Zoomout is a bit uneven in the amount it changes horizontally vs. vertically.
This effect is different for different fonts.
For me on Windows, the first ZoomIn only makes the font wider, doesn't change the height in the minimap.
In the attached I have screen shots showing the first 4 zoom levels.
Notice the 1st two are exactly the same height.

I'm not sure zoom is really all that useful - certainly not zooming in to the point where the text is readable.


Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6826
  • Hero Points: 526
Re: Minimap zoom-out limit
« Reply #4 on: August 16, 2018, 08:17:24 PM »
You can specify a specific font name instead of using the same font as the edit window in a smaller size.

The minimap is using the wfont_zoom_in and wfont_zoom_out commands. It increments/decrements the point size by one. What happens depends on your fonts. 

Originally we planned on using line drawing but decided we liked this better. We still may add support for custome font drawing.

Tim Kemp

  • Senior Community Member
  • Posts: 546
  • Hero Points: 92
Re: Minimap zoom-out limit
« Reply #5 on: August 20, 2018, 05:21:01 PM »
On my Windows machine, the code font I'm using is 8 pixels high. The minimap lines are 3 pixels high. The minimap does show a little more than twice as many lines as my actual code window, but it could show 8 times as many lines if it used graphics instead of a font. I'll bet the rendering would be a lot faster too.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6826
  • Hero Points: 526
Re: Minimap zoom-out limit
« Reply #6 on: August 20, 2018, 05:56:19 PM »
Here's what I can tell you from some trial and error I did. A 1 pixel high font looks bad (might as well stick with the Document Overview Bar which SlickEdit already has and close the minimap). 2 pixels can look good when done right. Line drawing doesn't look as good as some sort of font drawing (although it's bright because there's no anti-aliasing). The way to force a 2 pixel font is to do some sampling of say a 3 pixel font and remove 1 pixel. On Windows, you can choose a proportional font for the minimap like "Arial" (not sure about other fixed fonts), and it will be 2 pixels high when you choose a 1 point font size. Not a great solution when the edit window is using a fixed font but just though I'd let you know. Choosing a 1 point font on macOS will give you a 2 pixel high font (on my machine that's what it does).

Originally I thought doing line drawing would be the way to go but it doesn't look as good as I thought. No other products I know of do pure line drawing for a minimap (but they do for document overview bar like stuff). Line drawing won't help speed because the line drawing MUST be done base on some font. There is some additional caching SlickEdit could do but it would cause other performance issues. If it did, then you could cache some font results for say line drawing. The real problem here is that Qt is pretty slow with font calculation stuff. I'd say about 4-10x slower than native code. On Mac, SlickEdit bypasses Qt for edit window font drawing. On Windows, this same optimization is not possible (and we are more proficient with Win32 code) due to how Qt was engineered. There really should'nt be a need for caching anything unless we wanted better support for Softwrap which requires storing the edit window softwrap offsets (unlikely we'll ever bother with that).  Note that even though there are WAAAAAAY more extra optimizations for macOS, Windows text drawing is still faster. macOS text drawing graphics is quite slow compared to Windows. Small fonts on macOS look great (better than Windows for sure)! Linux performance is somewhere in the middle but small fonts looks the worst of all the platforms.

Some built-in font generation would be useful. Especially one that takes a 3 point font and reduces it to 2. I suspect if we do that, it might make sense to also support 1 pixel line drawing even though it doesn't really look good.

I hope all this make sense. I've gotten in the weeds a bit.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6826
  • Hero Points: 526
Re: Minimap zoom-out limit
« Reply #7 on: August 21, 2018, 12:57:25 AM »
Try setting the minimap font to Lucida Console. It looks like it's only 2 pixels in height. There are others that are 2 pixels in height but Consolas (default font) seems to be 3 pixels high.

Tim Kemp

  • Senior Community Member
  • Posts: 546
  • Hero Points: 92
Re: Minimap zoom-out limit
« Reply #8 on: August 21, 2018, 11:54:15 AM »
Lucida Console is a big improvement.