shithub: fnt

Download patch

ref: 71d16479bba591f616f91d2b928fec49b72015b0
parent: eda59c651d04dfec8592b0b3658ee7dab599f107
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Mon Jul 22 21:55:22 EDT 2024

otfdrawglyf: remove gap parameter

--- a/otf.h.in
+++ b/otf.h.in
@@ -106,7 +106,7 @@
 typedef struct Glyf Glyf;
 Glyf *otfglyf(Otf *o, int index);
 int otfglyfnum(Otf *o);
-int otfdrawglyf(Otf *o, Glyf *g, double ppem, double gap, GlyfImage *im);
+int otfdrawglyf(Otf *o, Glyf *g, double ppem, GlyfImage *im);
 int otfupem(Otf *o);
 int otfrune2glyph(Otf *o, Rune r);
 Rune otfglyph2rune(Otf *o, int g);
--- a/plan9/otf.h
+++ b/plan9/otf.h
@@ -107,7 +107,7 @@
 typedef struct Glyf Glyf;
 Glyf *otfglyf(Otf *o, int index);
 int otfglyfnum(Otf *o);
-int otfdrawglyf(Otf *o, Glyf *g, double ppem, double gap, GlyfImage *im);
+int otfdrawglyf(Otf *o, Glyf *g, double ppem, GlyfImage *im);
 int otfupem(Otf *o);
 int otfrune2glyph(Otf *o, Rune r);
 Rune otfglyph2rune(Otf *o, int g);
--- a/rast.c
+++ b/rast.c
@@ -550,7 +550,7 @@
 }
 
 int
-otfdrawglyf(Otf *o, Glyf *g, double ppem, double gap, GlyfImage *im)
+otfdrawglyf(Otf *o, Glyf *g, double ppem, GlyfImage *im)
 {
 	int i, j, maxptstotal, maxpts, ngs, w, h, r, npx, baseline;
 	Glyf *gs[MAXCOMPONENTS];
@@ -631,11 +631,6 @@
 		w = h = 1;
 		baseline = 0;
 	}else{
-		bb[0] -= gap;
-		bb[1] -= gap;
-		bb[2] += gap;
-		bb[3] += gap;
-
 		/* height+baseline is where it is in the image */
 		baseline = floor(bb[1]);
 		offY = -baseline;
--- a/test.h
+++ b/test.h
@@ -7,7 +7,6 @@
 	f->print(f->aux, " -i: operate on a single glyph by its id\n");
 	f->print(f->aux, " -r: operate on a single glyph by its rune\n");
 	f->print(f->aux, " -p: draw (of size in pixels per em) and write the image to stdout\n");
-	f->print(f->aux, " -g: gap (in pixels) to add to every border of a glyph\n");
 	f->print(f->aux, " -m: print out glyph ids or render them all as a map (with -p)\n");
 	f->print(f->aux, " -R: ignore glyphs that do not represent valid runes\n");
 	f->print(f->aux, " -H: highlight a specific glyph in the map by its ID\n");
@@ -15,7 +14,7 @@
 	f->print(f->aux, "Specifying -m more than twice makes empty pixels filled out\n");
 }
 
-static int gap, gind = -1, map, highlight = -1, runesonly;
+static int gind = -1, map, highlight = -1, runesonly;
 static double ppem;
 static Rune rune = NoRune;
 
@@ -151,7 +150,7 @@
 				return -1;
 			}
 			if(ppem > 0 && g->numberOfContours != 0){
-				if(otfdrawglyf(o, g, ppem, gap, im+i) != 0)
+				if(otfdrawglyf(o, g, ppem, im+i) != 0)
 					goto glypherr;
 			}else if(ppem <= 0){
 				out->print(out->aux, "%d (%s):\n", i,
@@ -174,7 +173,7 @@
 			goto glypherr;
 		}else if(ppem > 0){
 			GlyfImage im;
-			if(otfdrawglyf(o, g, ppem, gap, &im) != 0)
+			if(otfdrawglyf(o, g, ppem, &im) != 0)
 				goto glypherr;
 			if(out->write != otfdiscard && dumpmap(out, &im, 1) != 0)
 				return -1;
@@ -190,9 +189,6 @@
 
 #define parseoptions() \
 	ARGBEGIN{ \
-	case 'g': \
-		gap = strtol(EARGF(usage(&out)), nil, 0); \
-		break; \
 	case 'H': \
 		highlight = strtol(EARGF(usage(&out)), nil, 0); \
 		break; \