in scripts/GenerateNLVersion.kt [45:73]
fun generateNoLigaturesFont(file: File, doc: Document) {
val nlName = file.nameWithoutExtension.replace("JetBrainsMono", "JetBrainsMonoNL")
val ttx = "$nlName.ttx"
val ttf = "$nlName.ttf"
val dir = file.parentFile
File(dir, ttf).deleteAndLog()
doc.removeLigas("/ttFont/GlyphOrder", "GlyphID")
doc.removeLigas("/ttFont/glyf", "TTGlyph")
doc.removeLigas("/ttFont/hmtx", "mtx")
doc.removeLigas("/ttFont/post/extraNames", "psName")
doc.removeLigas("/ttFont/GDEF/GlyphClassDef", "ClassDef", attName = "glyph")
doc.removeNode("/ttFont/GPOS")
doc.removeNode("/ttFont/GSUB")
val xPath = XPathFactory.newInstance().newXPath()
val nameRecords = (xPath.evaluate("/ttFont/name/namerecord", doc, XPathConstants.NODESET) as NodeList).asList()
nameRecords.forEach {
if (!it.textContent.contains("trademark")) {
it.textContent = it.textContent
.replace("JetBrains Mono", "JetBrains Mono NL")
.replace("JetBrainsMono", "JetBrainsMonoNL")
}
}
val ttxFile = File(dir, ttx)
doc.saveAs(ttxFile)
"ttx $ttx".runCommand(dir)
ttxFile.deleteAndLog()
}