Hasklig

Hasklig -- 具有等宽连字的代码字体。(Hasklig - a code font with monospaced ligatures.)

Github stars Tracking Chart

注:这是 Source Code Pro repository 存储库的一个分支。

Hasklig -- 代码的连字

编程语言仅限于相对较少的字符。因此,组合字符运算符很早就浮出水面,例如广泛使用的箭头( ->),由连字符和更大符号组成。如果你知道类比和斜视,它看起来像一个箭头。

复合字形在诸如Haskell之类的语言中是有问题的,它们广泛地利用这些复杂的运算符(=> -< >>= 等)。这种复杂代码的可读性通过漂亮的打印得到改善。以Haskell 代码为特色的学术文章经常使用 lhs2tex 来实现吸引人的渲染,但在编程时没有用。

一些Haskeller使用了Unicode符号(⇒,←等),这些符号在ghc中有效。然而,它们是一个字符宽,因此非常小。此外,当显示为底层多字符表示的替代,如vim2hs(https://github.com/dag/vim2hs)所做的那样,字符不对齐。

Hasklig 解决了问题的方式,印刷师总是解决经常出现的不合适的角色:连字。底层代码保持不变 - 只有表示更改。

不仅可以更生动地呈现多字符字形,而且可以校正等宽字体中的其他有问题的字符,例如间距。

下载 Hasklig Font Family v1.1

目前实现的符号

<* <*> <+> <$> *** <| |> <|> !! || === ==> <<< >>> <> +++ <- -> => >> << >>= =<< .. ... :: -< >- -<< >>- ++ /= ==

编辑器支持

此列表是根据有关代码编辑器和终端的当前支持状态的报告编译的。 这个清单。

支持的编辑器

不支持的

  • Emacs
  • gVim (output corrupted. A patch exists, but it has not been incorporated into mainstream gVim.)
  • KDevelop 4
  • Notepad++
  • Xamarin Studio/Monodevelop

Main metrics

Overview
Name With Owneri-tu/Hasklig
Primary LanguagePython
Program languageShell (Language Count: 5)
PlatformWindows, Unix-like, Mac, Linux, BSD
License:SIL Open Font License 1.1
所有者活动
Created At2014-04-06 11:10:28
Pushed At2022-02-19 01:25:54
Last Commit At2020-12-22 23:26:32
Release Count14
Last Release Namev1.2 (Posted on )
First Release Name1.009 (Posted on 2012-09-30 19:21:17)
用户参与
Stargazers Count5.6k
Watchers Count82
Fork Count153
Commits Count554
Has Issues Enabled
Issues Count108
Issue Open Count42
Pull Requests Count23
Pull Requests Open Count2
Pull Requests Close Count6
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private

N.B. This is a fork of the Source Code Pro repository

Hasklig – Ligatures for code

Programming languages are limited to relatively few characters. As a result, combined character operators surfaced quite early, such as the widely used arrow (->), comprised of a hyphen and greater sign. It looks like an arrow if you know the analogy and squint a bit.

Composite glyphs are problematic in languages such as Haskell which utilize these complicated operators (=> -< >>= etc.) extensively. The readability of such complex code improves with pretty printing. Academic articles featuring Haskell code often use lhs2tex to achieve an appealing rendering, but it is of no use when programming.

Some Haskellers have resorted to Unicode symbols (, etc.), which are valid in the ghc. However they are one-character-wide and therefore eye-strainingly small. Furthermore, when displayed as substitutes to the underlying multi-character representation, as [vim2hs] (https://github.com/dag/vim2hs) does, the characters go out of alignment.

Hasklig solves the problem the way typographers have always solved ill-fitting characters which co-occur often: ligatures. The underlying code stays the same — only the representation changes.

Not only can multi-character glyphs be rendered more vividly, other problematic things in monospaced fonts, such as spacing can be corrected.

Download Hasklig Font Family v1.1

Hasklig

Hasklig Sample

Source Code Pro

Source Code Pro Sample

Release notes

  • v1.1
    • New ligatures ->>, :::, >=>, <=<, <=>, <->
    • Switched to newer version of calt code by Nikita Prokopov. It "doesn’t apply ligatures to long sequences of chars, e.g. !!!!, >>>>, etc"
    • Fixed ++ and +++ line inconsistency in heavy italic weights
  • v1.0
    • Updates to the latest version of SCP
    • Hasklig moves to a ligature substitution mechanism borrowed from the excellent Fira Code by Nikita Prokopov
  • v0.9: This is a major update so YMMV. Please report any issues.
    • Converted to UFO format and updated base fonts to benefit from work done on Source Code Pro:
      • Italics!
      • Greek & Cyrillic script support
      • Better powerline symbols
      • Much, much more
    • Added tags that enable support for some IntelliJ IDEA Builds
  • v0.4: New ligatures: <* <*> <+> <$> *** <, > !! , === ==>, Powerline symbol support
  • v0.3: New ligatures: <<< >>> <> and +++
  • v0.2: Lengthened == and /= to match other equals signs
  • v0.1: Ligatures <- -> => >> << >>= =<< .. ... :: -< >- -<< >>- ++ /= and ==

Currently implemented symbols

<* <*> <+> <$> *** <, , > <, > !! , === ==> <<< >>> <> +++ <- -> => >> << >>= =<< .. ... :: -< >- -<< >>- ++ /= ==

Editor Support

This list is compiled based on reports on the current state of support for code editors and terminals. This list

Supported editors

No support

  • Emacs
  • gVim (output corrupted. A patch exists, but it has not been incorporated into mainstream gVim.)
  • KDevelop 4
  • Notepad++
  • Xamarin Studio/Monodevelop

Building the fonts from source

Requirements

To build the binary font files from source, you need to have installed the
Adobe Font Development Kit for OpenType (AFDKO). The AFDKO
tools are widely used for font development today, and are part of most font
editor applications.

Some SVG glyphs are inserted into the fonts using Python FontTools.

Building font instances from masters

This repository only includes so-called master weights of the fonts (effectively extralight and black).
The shapes of the weights in between these extremities are calculated by makeInstancesUFO supplied with .designspace files.
For convenience, the shell script buildInstances is provided, which executes makeInstancesUFO, calculating all the italic and regular font weight shapes.

$ ./buildInstances.sh

Building one font

The key to building OTF or TTF fonts is makeotf, which is part of the AFDKO toolset.
Information and usage instructions can be found by executing makeotf -h.

In this repository, all necessary files are in place for building the OTF and TTF fonts.
For example, build a binary OTF font for the Regular style like this:

$ cd Roman/Regular/
$ makeotf -r

Building all fonts

For convenience, a shell script named build is provided in the root directory.
It builds all OTFs and TTFs, and can be executed by typing:

$ ./build.sh

or this on Windows:

> build.cmd

Credits

Original idea, design and implementation of code ligatures by Ian Tuomi 2014-2015.
This typeface extends Source Code Pro with ligatures.