Skip to content

Instantly share code, notes, and snippets.

View phi-gamma's full-sized avatar
💤
Does nothing unless polled.

Philipp Gesang phi-gamma

💤
Does nothing unless polled.
View GitHub Profile
@phi-gamma
phi-gamma / luatex-basics-nod.lua.patch
Created April 16, 2013 11:59
allow overriding of attributes allocation
--- /tmp/luatex-basics-nod.lua 2013-04-16 13:56:51.387870041 +0200
+++ luatex-basics-nod.lua 2013-04-16 13:57:39.235889616 +0200
@@ -28,21 +28,23 @@
end
-attributes = { }
+attributes = attributes or { }
attributes.unsetvalue = -0x7FFFFFFF
@phi-gamma
phi-gamma / gist:5457042
Last active December 16, 2015 15:39
patch for otfl-font-nms.lua to not skip libertine mono
--- /tmp/otfl-font-nms.lua 2013-04-25 04:20:05.710574106 +0200
+++ otfl-font-nms.lua 2013-04-25 10:38:06.235616183 +0200
@@ -151,6 +151,11 @@
elseif subfamily == "regular" or
table.contains(synonyms.regular, subfamily) then
found.fallback = face
+ elseif name == fullname then
+ --- guard for Libertine Mono which has
+ --- subtype == “mono”
+ found[1] = face
@phi-gamma
phi-gamma / luamplib.lua
Created May 3, 2013 13:30
luamplib import from Context 2013-05-03
--
-- This is file `luamplib.lua',
-- generated with the docstrip utility.
--
-- The original source files were:
--
-- luamplib.dtx (with options: `lua')
--
-- See source file 'luamplib.dtx' for licencing and contact information.
--
@phi-gamma
phi-gamma / track_missing_glyphs.lua
Last active December 18, 2015 16:38
example code for http://tex.stackexchange.com/q/119883 (tracking missing glyphs with luaotfload)
-----------------------------------------------------------------------
-- FILE: track-missing-glyphs.lua
-- USAGE: dofile "track-missing-glyphs.lua"
-- DESCRIPTION: output a message if a font lacks a glyph for a
-- codepoint
-- REQUIREMENTS: luatex, luaotfload
-- COPYRIGHT: Hans Hagen, Pragma ADE, Hasselt NL
-- AUTHOR: Philipp Gesang (Phg), <[email protected]>
-- MODIFIED: 2013-06-22 12:39:26+0200
-----------------------------------------------------------------------
documentdata = documentdata or { }
documentdata.color_ligatures = { }
local color_ligatures = documentdata.color_ligatures
color_ligatures.color = { r = 0xee/255,
g = 0x31/255,
b = 0x09/255, }
local stringformat = string.format
@phi-gamma
phi-gamma / luaotfload-database.lua
Created June 30, 2013 10:11
improve globber discipline with weird characters in paths (for ``luaotfload v2.2d` / texlive 2013)
if not modules then modules = { } end modules ['luaotfload-database'] = {
version = 2.2,
comment = "companion to luaotfload.lua",
author = "Khaled Hosny, Elie Roux, Philipp Gesang",
copyright = "Luaotfload Development Team",
license = "GNU GPL v2"
}
--- TODO: if the specification is an absolute filename with a font not in the
--- database, add the font to the database and load it. There is a small
@phi-gamma
phi-gamma / tex-sx-pinyin-tonemarks.lua
Created July 23, 2013 09:59
pinyin conversion from numeral notation to diacritics (see http://tex.stackexchange.com/q/125030 for details)
-----------------------------------------------------------------------
-- FILE: tex-sx-pinyin-tonemarks.lua
-- USAGE: ./tex-sx-pinyin-tonemarks.lua
-- DESCRIPTION: http://tex.stackexchange.com/q/125030
-- REQUIREMENTS: luatex
-- AUTHOR: Philipp Gesang (Phg), <[email protected]>
-- VERSION: 1.0
-- CREATED: 2013-07-23 09:39:04+0200
-----------------------------------------------------------------------
--
-----------------------------------------------------------------------
-- FILE: charsperline.lua
-- USAGE: called from t-charsperline.mkvi
-- DESCRIPTION: extract line contents and lengths
-- REQUIREMENTS: ConTeXt MkIV
-- AUTHOR: Philipp Gesang (Phg), <[email protected]>
-- VERSION: 1.0
-- CREATED: 2013-08-04 20:01:04+0200
-----------------------------------------------------------------------
--
@phi-gamma
phi-gamma / streams-mkii.tex
Last active December 21, 2015 04:39
demo for text streams (parallel typesetting) in Context MkII
%% first a couple global settings
\setuppapersize [A7]
\enableregime [utf]
\setuptolerance [verytolerant,stretch] %% small page sizes ...
\setupbodyfont [10pt]
\usemodule [ancientgreek]
\setupheader [style=\tfx]
\setuppagenumbering [location=,state=start,alternative=doublesided]
if not modules then modules = { } end modules ['luaotfload-database'] = {
version = "2.3b",
comment = "companion to luaotfload.lua",
author = "Khaled Hosny, Elie Roux, Philipp Gesang",
copyright = "Luaotfload Development Team",
license = "GNU GPL v2"
}
--- TODO: if the specification is an absolute filename with a font not in the
--- database, add the font to the database and load it. There is a small