Skip to content

Instantly share code, notes, and snippets.

View reffort's full-sized avatar

reffort

  • Dallas, Texas
View GitHub Profile
@reffort
reffort / curves.tr
Created July 31, 2015 00:56
Test file that shows Heirloom's line breaking with various constraints.
.do xflag 3
.
\#
\# This troff source file formats two paragraphs, an easy one and a more
\# difficult one, varying the minimum space size and the hyphenation penalty
\# to show the interaction of the word space size ratio (the badness function)
\# and the hyphenation penalty, and the effect on the formatted output.
\#
\# This file demonstrates how the Heirloom badness function has
\# a strong tendency to pack as many characters on a line as it can in order
@reffort
reffort / penalty.c
Created July 31, 2015 00:59
A penalty function to experiment with different windows and calculation methods
// experimental penalty() function for n7.c
// Rename the existing function to x_penalty() or something similar so that it won't be executed
// and then add the following function
static double
penalty(int k, int s, int h, int h2, int h3)
{
double t, d, p1, p2, p3 ;
int scaletype, calctype ;
@reffort
reffort / spreadmark.c
Created July 31, 2015 01:02
Marks word space size categories in the margin
/*
To obtain a quantitative measure of the word space sizes, this code prints a character in the margin indicating a size category
for the word spaces of that line. It hijacks the margin character functionality.
At line 427 of n7.c, replace these two lines
else if (admod == 0 && spreadwarn && adsp >= spreadlimit)
errprint("spreadlimit exceeded, %gm", (double)adsp/EM);