Crazy issue with NSTextView

I am currently in deep font metrics using NSTextView. I was hoping the developer could shed light on what was happening.

With Myriad Pro, the default is NSTextView (dragged from IB and launched in a new project), this is what you get:

selected textunselected text

Notice that the selected rectangle is the same height as the insertion point.

Now for the behavior from Pages:

unselected pages textselected pages text

Notice how the selected rectangle is similar to the regular text view version, but the height of the insertion point actually reflects the font more (and less!).

Weird

Why does it bother me? Here is the screen of my application with Helvetica, and then with Myriad:

My app helveticaMy app myraid pro

Please note that in both cases the outline symbol is ideally centered with the height of the insertion point. These characters are actually areas, not a text stream. Pay attention to these characters in Pages. They are still focused on the Miriad. Obviously, Apple understood something and fixed it. Any ideas what they did?

Thanks!

+4
source share
1 answer

This is not an Apple error, but rather your guess. This is a function of font metrics as well as line height. The insertion point occupies the entire height of the line; drawn parts of the font no.

I thought you pointed to the Font Guide a few days ago. In any case, you need to fully understand this topic so that you can determine where to draw your point.

+1
source

Source: https://habr.com/ru/post/1340117/


All Articles