shithub: fnt

Download patch

ref: 1b381f9ec368578a78dc0f094ff200224d0a14bc
parent: bdc09059c1801bb7d6271b85b09040556a271de7
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Mon Jul 15 18:42:46 EDT 2024

add empty pixels fill mode

--- a/test.h
+++ b/test.h
@@ -6,7 +6,8 @@
 	f->print(f->aux, " -g: gap (in pixels) to add to every glyph border\n");
 	f->print(f->aux, " -m: print out glyph ids or render them all (with -p)\n");
 	f->print(f->aux, " -p: draw (of size in pixels per em) and write the image to stdout\n");
-	f->print(f->aux, "Specifying -m more than once makes the program draw guide lines\n");
+	f->print(f->aux, "Specifying -m more than once adds guide lines\n");
+	f->print(f->aux, "Specifying -m more than twice adds filling of empty pixels\n");
 }
 
 static int gap, gind = -1, map, ppem;
@@ -15,7 +16,7 @@
 dumpmap(Otfile *f, GlyfImage *im, int n)
 {
 	int x, y, i, j, t, maxh, prebase, postbase, d;
-	int gap, total, mid, npix, bw, bh, lines;
+	int gap, total, mid, npix, bw, bh, lines, fill;
 	u8int *b;
 
 	total = 0;
@@ -22,6 +23,7 @@
 	maxh = 0;
 	gap = 1;
 	lines = map > 1;
+	fill = map > 2;
 	for(i = 0; i < n; i++){
 		if(im[i].b == nil)
 			continue;
@@ -65,7 +67,7 @@
 					if(lines && g == 0xff && (d == im[i].h+im[i].baseline)){
 						g = 0;
 						b = 0;
-					}else if(lines && g == 0xff && (t == 0 || t == im[i].w-1 || d == 0 || d == im[i].h-1)){
+					}else if(lines && g == 0xff && (fill || t == 0 || t == im[i].w-1 || d == 0 || d == im[i].h-1)){
 						r = 0;
 						b = 0;
 					}