ref: 6b622e92c2098ed15c550aed5e5242f5c11aa71d
parent: 368477b5658d7c0a00b3261b212f97fd7deb4218
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Tue Jul 16 15:06:45 EDT 2024
allow positive real numbers for ppem
--- a/otf.c.in
+++ b/otf.c.in
@@ -2,6 +2,8 @@
#include "otfsys.h"
#include "otf.h"
+#define f2dot14(o) (f = b[2*o]<<8 | b[2*o+1], (f>>14)+(f&((1<<14)-1))/16384.0)
+
int indentΔ = 2;
typedef struct Range Range;
@@ -302,7 +304,7 @@
}
if(b == nil)
goto err;
- #define f2dot14(o) (f = b[2*o]<<8 | b[2*o+1], (f>>14)+(f&((1<<14)-1))/16384.0)
+
v->scaleX = 1.0;
v->scaleY = 1.0;
if((v->flags & CGLYPH_FL_SCALE) != 0 && (b = otfreadn(o, 2)) != nil){
--- a/otf.h.in
+++ b/otf.h.in
@@ -95,5 +95,5 @@
typedef struct Glyf Glyf;
Glyf *otfglyf(Otf *o, int index);
int otfglyfnum(Otf *o);
-int otfdrawglyf(Otf *o, Glyf *g, int ppem, int gap, GlyfImage *im);
+int otfdrawglyf(Otf *o, Glyf *g, double ppem, int gap, GlyfImage *im);
int otfupem(Otf *o);
--- a/plan9/otf.c
+++ b/plan9/otf.c
@@ -2,6 +2,8 @@
#include "otfsys.h"
#include "otf.h"
+#define f2dot14(o) (f = b[2*o]<<8 | b[2*o+1], (f>>14)+(f&((1<<14)-1))/16384.0)
+
int indentΔ = 2;
typedef struct Range Range;
@@ -316,7 +318,7 @@
}
if(b == nil)
goto err;
- #define f2dot14(o) (f = b[2*o]<<8 | b[2*o+1], (f>>14)+(f&((1<<14)-1))/16384.0)
+
v->scaleX = 1.0;
v->scaleY = 1.0;
if((v->flags & CGLYPH_FL_SCALE) != 0 && (b = otfreadn(o, 2)) != nil){
--- a/plan9/otf.h
+++ b/plan9/otf.h
@@ -95,7 +95,7 @@
typedef struct Glyf Glyf;
Glyf *otfglyf(Otf *o, int index);
int otfglyfnum(Otf *o);
-int otfdrawglyf(Otf *o, Glyf *g, int ppem, int gap, GlyfImage *im);
+int otfdrawglyf(Otf *o, Glyf *g, double ppem, int gap, GlyfImage *im);
int otfupem(Otf *o);
typedef struct SubHeader SubHeader;
--- a/rast.c
+++ b/rast.c
@@ -539,7 +539,7 @@
}
int
-otfdrawglyf(Otf *o, Glyf *g, int ppem, int gap, GlyfImage *im)
+otfdrawglyf(Otf *o, Glyf *g, double ppem, int gap, GlyfImage *im)
{
int i, j, maxptstotal, maxpts, ngs, w, h, r, npx, baseline;
Glyf *gs[MAXCOMPONENTS];
@@ -580,13 +580,13 @@
}
*/
- double xMin = 99999, yMin = 99999, xMax = -99999, yMax = -99999;
- scale = (Sval)ppem / otfupem(o);
+ Sval xMin = 99999, yMin = 99999, xMax = -99999, yMax = -99999;
+ scale = ppem / otfupem(o);
pts = calloc(1, maxpts*sizeof(*pts) + maxptstotal/2*sizeof(*s));
p = s = s₀ = (SegQ*)(pts + maxpts);
cg = g->component;
for(i = 0; i < ngs; i++){
- double dx = 0, dy = 0, gscaleX = scale, gscaleY = scale;
+ Sval dx = 0, dy = 0, gscaleX = scale, gscaleY = scale;
if(cg != nil){
if(cg->flags & CGLYPH_FL_SIGNED_XY){
dx = cg->dx;
--- a/test.h
+++ b/test.h
@@ -11,7 +11,8 @@
f->print(f->aux, "Specifying -m more than twice makes empty pixels filled out\n");
}
-static int gap, gind = -1, map, ppem, highlight = -1;
+static int gap, gind = -1, map, highlight = -1;
+static double ppem;
static int
dumpmap(Otfile *f, GlyfImage *im, int n)
@@ -176,7 +177,7 @@
map++; \
break; \
case 'p': \
- ppem = strtol(EARGF(usage(&out)), nil, 0); \
+ ppem = strtod(EARGF(usage(&out)), nil); \
break; \
default: \
usage(&out); \