X-Git-Url: http://git.asbjorn.biz/?p=swftools.git;a=blobdiff_plain;f=pdf2swf%2Fttf2pt1%2Fpt1.h;h=4f65f884734a720aa943d18c1db49efdfa6cb1e5;hp=754053119dca8d8d53605e211a23bf4c1d9199b2;hb=50760be540fa6802296d7cb6eafa4d4b82a47a3b;hpb=d6156a349c63b5fb77a6bd0160aef54cb3b13cdb diff --git a/pdf2swf/ttf2pt1/pt1.h b/pdf2swf/ttf2pt1/pt1.h index 7540531..4f65f88 100644 --- a/pdf2swf/ttf2pt1/pt1.h +++ b/pdf2swf/ttf2pt1/pt1.h @@ -19,6 +19,9 @@ typedef struct gentry { #define bkwd cntr[0] #define frwd cntr[1] + /* various extended structures used at some stage of transformation */ + void *ext; + union { struct { int val[2][3]; /* integer values */ @@ -49,6 +52,7 @@ typedef struct gentry { char flags; #define GEF_FLOAT 0x02 /* entry contains floating point data */ +#define GEF_LINE 0x04 /* entry looks like a line even if it's a curve */ unsigned char dir; /* used to temporarily store the values for * the directions of the ends of curves */ @@ -73,6 +77,10 @@ typedef struct gentry { #define GE_LINE 'L' #define GE_CURVE 'C' #define GE_PATH 'P' + + /* indexes of the points to be used for calculation of the tangents */ + signed char ftg; /* front tangent */ + signed char rtg; /* rear tangent, -1 means "idx 2 of the previous entry" */ } GENTRY; /* stem structure, describes one [hv]stem */ @@ -178,6 +186,14 @@ typedef struct glyph { } GLYPH; +/* description of a dot for calculation of its distance to a curve */ + +struct dot_dist { + double p[2 /*X,Y*/]; /* coordinates of a dot */ + double dist2; /* squared distance from the dot to the curve */ + short seg; /* the closest segment of the curve */ +}; + extern int stdhw, stdvw; /* dominant stems widths */ extern int stemsnaph[12], stemsnapv[12]; /* most typical stem width */ @@ -232,3 +248,10 @@ void stemstatistics(void); void docorrectwidth(void); void addkernpair( unsigned id1, unsigned id2, int unscval); void print_kerning( FILE *afm_file); + +int fcrossrayscv( double curve[4][2], double *max1, double *max2); +int fcrossraysge( GENTRY *ge1, GENTRY *ge2, double *max1, double *max2, + double crossdot[2][2]); +double fdotsegdist2( double seg[2][2], double dot[2]); +double fdotcurvdist2( double curve[4][2], struct dot_dist *dots, int ndots, double *maxp); +void fapproxcurve( double cv[4][2], struct dot_dist *dots, int ndots);