Skip to content

Instantly share code, notes, and snippets.

View zauguin's full-sized avatar

Marcel Krüger zauguin

View GitHub Profile
-- We should never have a hyphenation point inside of a grapheme cluster.
-- Hyphenating there would lead to very wrong results and even if no hyphenation is chosen it is likely to cause issues during shaping.
--
-- It would be nice if this were prevnted in the hyphenation patterns, but as a more general fix we can post-process hyphenated text to identify such situations.
require'provide_hyphenation_callbacks'
local graphemes = require'lua-uni-graphemes'
local read_codepoint = graphemes.read_codepoint
local traverse = node.traverse
local is_char = node.is_char
% Siavoosh Payandeh Azad Jan. 2019
% 2023-03-09: Adapted for use with luaicc by Marcel Krüger
\ProvidesPackage{highlight}[Cell background highlighting based on user data]
\RequirePackage{etoolbox}
\RequirePackage{pgf} % for calculating the values for gradient
\RequirePackage{xcolor} % enables the use of cellcolor make sure you have [table] option in the document class
% Color set related!
\definecolor{high}{HTML}{ef3b2c} % the color for the highest number in your data set
\definecolor{low}{HTML}{fff7bc} % the color for the lowest number in your data set
\newcommand*{\opacity}{90}% here you can change the opacity of the background color!
% Siavoosh Payandeh Azad Jan. 2019
% 2023-03-09: Adapted for use with luaicc by Marcel Krüger
\ProvidesPackage{highlight}[Cell background highlighting based on user data]
\RequirePackage{etoolbox}
\RequirePackage{pgf} % for calculating the values for gradient
\RequirePackage{xcolor} % enables the use of cellcolor make sure you have [table] option in the document class
% Color set related!
\definecolor{high}{HTML}{ef3b2c} % the color for the highest number in your data set
\definecolor{low}{HTML}{fff7bc} % the color for the lowest number in your data set
\newcommand*{\opacity}{90}% here you can change the opacity of the background color!
@zauguin
zauguin / luadvi.lua
Last active April 7, 2020 16:13
luaotfload output enhancment for DVI mode
local getfont = font.getfont
local setfont = node.direct.setfont
local getdisc = node.direct.getdisc
local traverse_glyph = node.direct.traverse_glyph
local traverse_id = node.direct.traverse_id
local define_font = font.define
local disc_t = node.id'disc'
local mapped_fonts = setmetatable({}, {__index = function(t, fid)
local font = getfont(fid)
local mapped = font.backend_font or false
@zauguin
zauguin / embolden-math.log
Created January 10, 2020 17:01
embolden-math log with unhelpful fontidentifier
This is LuaHBTeX, Version 1.11.2 (TeX Live 2020/dev) (format=lualatex-dev 2020.1.10) 20 MAY 2016 11:00
restricted system commands enabled.
**\input embolden-math.lvt
Lua module: luaotfload-main 2019-12-23 3.1202-dev luaotfload entry point
Lua module: luaotfload-init 2019-12-23 3.1202-dev luaotfload submodule / initialization
Lua module: lualibs 2019-11-06 2.69 ConTeXt Lua standard libraries.
Lua module: lualibs-extended 2019-11-06 2.69 ConTeXt Lua libraries -- extended collection.
Lua module: luaotfload-log 2019-12-23 3.1202-dev luaotfload submodule / logging
Lua module: luaotfload-parsers 2019-12-23 3.1202-dev luaotfload submodule / filelist
Lua module: luaotfload-configuration 2019-12-23 3.1202-dev luaotfload submodule / config file reader
@zauguin
zauguin / sqltable.cpp
Last active October 6, 2019 12:53
A draft for a virtual table module in sqlite_modern_cpp
#include <optional>
#include <iostream>
#include <string>
#include <sqlite_modern_cpp.h>
enum class VtabType {
regular,
eponymous,
eponymous_only,
};
local func_tbl = lua.get_functions_table()
local set_lua = token.set_lua
local new_luafunction = luatexbase.new_luafunction
return function(name, func, ...)
local idx = new_luafunction(name)
set_lua(name, idx, ...)
func_tbl[idx] = func
end
@zauguin
zauguin / font.each.lua
Created September 25, 2018 22:14
font.each working with luaotfload
local function fonteach_next(max, f)
repeat
f = f + 1
if f > max then return end
until font.frozen(f) ~= nil
return f, font.getfont(f) or font.fonts[f]
end
font.each = function() return fonteach_next, font.max(), 0 end
if(auto err = sqlite3_exec(db.connection().get(), "query1;query2;query3;", nullptr, nullptr, nullptr))
sqlite::exceptions::throw_sqlite_error(err);