Skip to content
Snippets Groups Projects
Commit 9314133b authored by George Nachman's avatar George Nachman
Browse files

Allow the user to enable ligatures on any font. Default to ligature level 1.

parent e3ecc334
No related branches found
No related tags found
No related merge requests found
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11762" systemVersion="16C67" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11762" systemVersion="16E195" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11762"/>
<capability name="box content view" minToolsVersion="7.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
Loading
Loading
@@ -2594,6 +2593,7 @@ DQ
<button misplaced="YES" id="6Fq-pl-5nd">
<rect key="frame" x="299" y="0.0" width="106" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<string key="toolTip">If you turn this on, optional ligatures in this font will be enabled. It forces iTerm2 to use a slower text rendering algorithm.</string>
<buttonCell key="cell" type="check" title="Use Ligatures" bezelStyle="regularSquare" imagePosition="left" alignment="left" inset="2" id="XXg-RS-7af">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
Loading
Loading
@@ -2657,6 +2657,7 @@ DQ
<button misplaced="YES" id="mlk-a6-xcL">
<rect key="frame" x="319" y="122" width="106" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<string key="toolTip">If you turn this on, optional ligatures in this font will be enabled. It forces iTerm2 to use a slower text rendering algorithm.</string>
<buttonCell key="cell" type="check" title="Use Ligatures" bezelStyle="regularSquare" imagePosition="left" alignment="left" inset="2" id="EEt-Fl-Kf8">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
Loading
Loading
@@ -2695,7 +2696,7 @@ DQ
</connections>
</popUpButton>
</subviews>
<point key="canvasLocation" x="-62.5" y="294.5"/>
<point key="canvasLocation" x="-30.5" y="154.5"/>
</customView>
<customView id="77f-eM-Dma" userLabel="Prefs - Profiles - Window" customClass="iTermSizeRememberingView">
<rect key="frame" x="0.0" y="0.0" width="559" height="378"/>
Loading
Loading
@@ -3446,7 +3447,7 @@ DQ
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<clipView key="contentView" id="ArV-0K-qze">
<rect key="frame" x="1" y="1" width="511" height="95"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" alternatingRowBackgroundColors="YES" columnReordering="NO" columnResizing="NO" multipleSelection="NO" autosaveColumns="NO" id="5661">
<rect key="frame" x="0.0" y="0.0" width="511" height="95"/>
Loading
Loading
Loading
Loading
@@ -37,6 +37,3 @@
 
@end
 
@interface NSFont(PTYFontInfo)
- (BOOL)it_supportsLigatures;
@end
Loading
Loading
@@ -13,31 +13,11 @@
@implementation NSFont(PTYFontInfo)
 
- (NSInteger)it_ligatureLevel {
// Some fonts have great ligatures but unlike FiraCode you need to ask for them. FiraCode gives
// you ligatures whether you like it or not.
// Returns the proper ligature level for this font. Defaults to 1.
static NSDictionary *fontNameToLigatureLevel;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
fontNameToLigatureLevel = @{ @"PragmataPro": @1,
@"PragmataPro-Regular": @1,
@"PragmataPro-Italic": @1,
@"PragmataPro-Bold": @1,
@"PragmataPro-BoldItalic": @1,
@"Hasklig-Black": @1,
@"Hasklig-BlackIt": @1,
@"Hasklig-Bold": @1,
@"Hasklig-BoldIt": @1,
@"Hasklig-ExtraLight": @1,
@"Hasklig-ExtraLightIt": @1,
@"Hasklig-It": @1,
@"Hasklig-Light": @1,
@"Hasklig-LightIt": @1,
@"Hasklig-Medium": @1,
@"Hasklig-MediumIt": @1,
@"Hasklig-Regular": @1,
@"Hasklig-Semibold": @1,
@"Hasklig-SemiboldIt": @1,
@"Iosevka": @2,
fontNameToLigatureLevel = @{ @"Iosevka": @2,
@"Iosevka-Bold": @2,
@"Iosevka-Bold-Italic": @2,
@"Iosevka-Bold-Oblique": @2,
Loading
Loading
@@ -120,24 +100,11 @@
@"IosevkaCC-Slab-Oblique": @2,
@"IosevkaCC-Slab-Thin": @2,
@"IosevkaCC-Slab-Thin-Italic": @2,
@"IosevkaCC-Slab-Thin-Oblique": @2,
@"Monoisome-Bold": @1,
@"Monoisome-Italic": @1,
@"Monoisome-Regular": @1,
@"Monoisome-Retina": @1,
@"OperatorMono-XLight": @1,
@"OperatorMono-XLightItalic": @1,
@"OperatorMono-Light": @1,
@"OperatorMono-LightItalic": @1,
@"OperatorMono-Book": @1,
@"OperatorMono-BookItalic": @1,
@"OperatorMono-Medium": @1,
@"OperatorMono-MediumItalic": @1,
@"OperatorMono-Bold": @1,
@"OperatorMono-BoldItalic": @1 };
@"IosevkaCC-Slab-Thin-Oblique": @2, };
[fontNameToLigatureLevel retain];
});
return [fontNameToLigatureLevel[self.fontName] integerValue];
NSNumber *value = fontNameToLigatureLevel[self.fontName];
return value ? value.integerValue : 1;
}
 
- (BOOL)it_defaultLigatures {
Loading
Loading
@@ -162,10 +129,6 @@
return result;
}
 
- (BOOL)it_supportsLigatures {
return self.it_defaultLigatures || self.it_ligatureLevel > 0;
}
@end
 
@implementation PTYFontInfo {
Loading
Loading
Loading
Loading
@@ -255,8 +255,6 @@ static NSInteger kNonAsciiFontButtonTag = 1;
- (void)updateWarnings {
[_normalFontWantsAntialiasing setHidden:!self.normalFont.futureShouldAntialias];
[_nonasciiFontWantsAntialiasing setHidden:!self.nonAsciiFont.futureShouldAntialias];
_asciiLigatures.hidden = !self.normalFont.it_supportsLigatures;
_nonAsciiLigatures.hidden = !self.nonAsciiFont.it_supportsLigatures;
}
 
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment