Skip to content

Commit

Permalink
Rename the "preserve line spacing" setting to "use macOS calculation"
Browse files Browse the repository at this point in the history
The setting was added to "preserve" the font's original line spacing
intents, but after further investigation I cannot find why Apple's
calculation for font line spacing to be so wide. Furthermore it's quite
odd because the default line spacing is wide, but the only thing that
setting does is by re-initializing the font under Core Text (instead of
using NSFont like the default) using CTFont and somehow the issue is
fixed. Inspecting font metrics (using ttx) also didn't seem to give any
hints why the spacing are so wide (e.g. ascent / descent / line gap etc
all look fine). A StackOverflow comment seems to suggest that Apple is
simply adding a 1.2x scale to some fonts
(https://stackoverflow.com/questions/5511830/how-does-line-spacing-work-in-core-text-and-why-is-it-different-from-nslayoutm)
which seems to match the observation. My guess is that Apple looks at
some fonts and think they are too aggressive in their font metrics
design and "helpfully" introduces a 1.2x multiplier to space them out,
where Core Text is lower level than AppKit and therefore does not have
this auto-inflation.

By renaming the option it should make it clearer that this is a somewhat
arbitrary distinction instead of it being an inherent property of the
font.
  • Loading branch information
ychin committed Jan 21, 2023
1 parent 2b7f6ee commit 2007549
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/MacVim/Base.lproj/Preferences.xib
Original file line number Diff line number Diff line change
Expand Up @@ -425,8 +425,8 @@
<button id="A48-s0-kdR" userLabel="Preserve Line Spacing">
<rect key="frame" x="189" y="-1" width="244" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMinY="YES"/>
<string key="toolTip">Some fonts have non-standard built-in line spacings (anything other than 1). If this is checked, MacVim will use the font's specified line spacing to calculate line height. Otherwise, it will just set it to 1, which helps if you would like a more compact spacing without having to install another font.</string>
<buttonCell key="cell" type="check" title="Preserve font line spacing" bezelStyle="regularSquare" imagePosition="left" alignment="left" inset="2" id="SeR-yl-Gtz" userLabel="Preserve Line Spacing">
<string key="toolTip">macOS can sometimes use a conservative approach to calculating line spacing for a font (by setting a 1.2 line spacing). This could potentially lead to line spacing feeling too wide. Unchecking this will use a tighter calculation and use a 1.0 line spacing instead.</string>
<buttonCell key="cell" type="check" title="Use macOS line spacing calculation" bezelStyle="regularSquare" imagePosition="left" alignment="left" inset="2" id="SeR-yl-Gtz" userLabel="Preserve Line Spacing">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
Expand Down

0 comments on commit 2007549

Please sign in to comment.