1
0
mirror of https://github.com/pdf2htmlEX/pdf2htmlEX.git synced 2024-12-21 20:50:07 +00:00

Merge pull request #9 from Rockstar04/rockstar04/master

Rockstar04/master
This commit is contained in:
Trent Petersen 2018-01-11 08:26:23 -06:00 committed by GitHub
commit e7fa898adb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 2198 additions and 3 deletions

View File

@ -17,6 +17,18 @@
#include <baseviews.h>
#include "ffw.h"
#include "fontforge-2.0.20170731/autowidth.h"
#include "fontforge-2.0.20170731/bitmapchar.h"
#include "fontforge-2.0.20170731/cvimages.h"
#include "fontforge-2.0.20170731/encoding.h"
#include "fontforge-2.0.20170731/fvfonts.h"
#include "fontforge-2.0.20170731/namelist.h"
#include "fontforge-2.0.20170731/savefont.h"
#include "fontforge-2.0.20170731/splineorder2.h"
#include "fontforge-2.0.20170731/splineutil.h"
#include "fontforge-2.0.20170731/splineutil2.h"
#include "fontforge-2.0.20170731/start.h"
#include "fontforge-2.0.20170731/tottf.h"
static real EPS=1e-6;
@ -42,10 +54,10 @@ static char * strcopy(const char * str)
{
if(str == NULL) return NULL;
char * _ = strdup(str);
if(!_)
char * blabla = strdup(str);
if(!blabla)
err("Not enough memory");
return _;
return blabla;
}
static void dumb_logwarning(const char * format, ...) { }

View File

@ -0,0 +1,81 @@
#ifndef FONTFORGE_AUTOWIDTH_H
#define FONTFORGE_AUTOWIDTH_H
#include "baseviews.h"
#include "splinefont.h"
struct charone {
real lbearing, rmax;
real newl, newr;
int baseserif, lefttops, righttops; /* serif zones which affect this character */
SplineChar *sc;
int base, top; /* bottom of character, number of decimation zones we've got */
short *ledge;
short *redge;
struct charpair *asleft;
struct charpair *asright;
};
struct charpair {
struct charone *left, *right;
struct charpair *nextasleft, *nextasright;
int base, top;
short *distances;
short visual;
};
typedef struct widthinfo {
real spacing; /* desired spacing between letters */
real decimation;
real serifsize;
real seriflength;
real caph;
real descent;
real xheight;
real n_stem_exterior_width, n_stem_interior_width;
real current_I_spacing;
int serifs[4][2]; /* Four serif zones: descent, baseline, xheight, cap */
int lcnt, rcnt; /* count of left and right chars respectively */
int real_lcnt, real_rcnt; /* what the user asked for. We might add I */
int tcnt; /* sum of r+l cnt */
int pcnt; /* pair count, often r*l cnt */
int l_Ipos, r_Ipos;
struct charone **left, **right;
struct charpair **pairs;
int space_guess;
int threshold;
SplineFont *sf;
FontViewBase *fv;
int layer;
unsigned int done: 1;
unsigned int autokern: 1;
unsigned int onlynegkerns: 1;
struct lookup_subtable *subtable;
} WidthInfo;
#define NOTREACHED -9999.0
extern struct charone *AW_MakeCharOne(SplineChar *sc);
extern void AW_InitCharPairs(WidthInfo *wi);
extern void AW_FreeCharList(struct charone **list);
extern void AW_FreeCharPairs(struct charpair **list, int cnt);
extern void AW_ScriptSerifChecker(WidthInfo *wi);
extern int AW_ReadKernPairFile(char *fn,WidthInfo *wi);
extern void AW_BuildCharPairs(WidthInfo *wi);
extern void AW_AutoKern(WidthInfo *wi);
extern void AW_AutoWidth(WidthInfo *wi);
extern void AW_FindFontParameters(WidthInfo *wi);
extern void AW_KernRemoveBelowThreshold(SplineFont *sf,int threshold);
extern SplineFont *aw_old_sf;
extern int aw_old_spaceguess;
extern int AutoKernScript(FontViewBase *fv, int spacing, int threshold, struct lookup_subtable *sub, char *kernfile);
extern int AutoWidthScript(FontViewBase *fv, int spacing);
extern int KernThreshold(SplineFont *sf, int cnt);
extern real SFGuessItalicAngle(SplineFont *sf);
extern void FVRemoveKerns(FontViewBase *fv);
extern void FVRemoveVKerns(FontViewBase *fv);
extern void FVVKernFromHKern(FontViewBase *fv);
#endif /* FONTFORGE_AUTOWIDTH_H */

View File

@ -0,0 +1,24 @@
#ifndef FONTFORGE_BITMAPCHAR_H
#define FONTFORGE_BITMAPCHAR_H
#include "splinefont.h"
#include "uiinterface.h"
extern BDFChar *BDFMakeChar(BDFFont *bdf, EncMap *map, int enc);
extern BDFChar *BDFMakeGID(BDFFont *bdf, int gid);
extern BDFProperties *BdfPropsCopy(BDFProperties *props, int cnt);
extern const char *BdfPropHasString(BDFFont *font, const char *key, const char *def);
extern int BdfPropHasInt(BDFFont *font, const char *key, int def);
extern int IsUnsignedBDFKey(const char *key);
extern void BCClearAll(BDFChar *bc);
extern void BDFDefaultProps(BDFFont *bdf, EncMap *map, int res);
extern void Default_Properties(BDFFont *bdf, EncMap *map, char *onlyme);
extern void Default_XLFD(BDFFont *bdf, EncMap *map, int res);
extern void def_Charset_Enc(EncMap *map, char *reg, char *enc);
extern void FF_SetBCInterface(struct bc_interface *bci);
extern void SFReplaceEncodingBDFProps(SplineFont *sf, EncMap *map);
extern void SFReplaceFontnameBDFProps(SplineFont *sf);
extern void XLFD_CreateComponents(BDFFont *font, EncMap *map, int res, struct xlfd_components *components);
extern void XLFD_GetComponents(const char *xlfd, struct xlfd_components *components);
#endif /* FONTFORGE_BITMAPCHAR_H */

View File

@ -0,0 +1,22 @@
#ifndef FONTFORGE_CVIMAGES_H
#define FONTFORGE_CVIMAGES_H
#include "baseviews.h"
#include "gimage.h"
#include "splinefont.h"
#include "sd.h"
extern GImage *ImageAlterClut(GImage *image);
extern int FVImportImages(FontViewBase *fv, char *path, int format, int toback, int flags);
extern int FVImportImageTemplate(FontViewBase *fv, char *path, int format, int toback, int flags);
extern void SCAddScaleImage(SplineChar *sc, GImage *image, int doclear, int layer);
extern void SCAppendEntityLayers(SplineChar *sc, Entity *ent);
extern void SCImportFig(SplineChar *sc, int layer, char *path, int doclear);
extern void SCImportGlif(SplineChar *sc, int layer, char *path, char *memory, int memlen, int doclear);
extern void SCImportPDFFile(SplineChar *sc, int layer, FILE *pdf, int doclear, int flags);
extern void SCImportPlateFile(SplineChar *sc, int layer, FILE *plate, int doclear);
extern void SCImportPSFile(SplineChar *sc, int layer, FILE *ps, int doclear, int flags);
extern void SCImportSVG(SplineChar *sc, int layer, char *path, char *memory, int memlen, int doclear);
extern void SCInsertImage(SplineChar *sc, GImage *image, real scale, real yoff, real xoff, int layer);
#endif /* FONTFORGE_CVIMAGES_H */

View File

@ -0,0 +1,85 @@
#ifndef FONTFORGE_ENCODING_H
#define FONTFORGE_ENCODING_H
#include "baseviews.h"
#include "splinefont.h"
struct cidaltuni {
struct cidaltuni *next;
int uni;
int cid;
};
struct cidmap {
char *registry, *ordering;
int supplement, maxsupple;
int cidmax; /* Max cid found in the charset */
int namemax; /* Max cid with useful info */
uint32 *unicode;
char **name;
struct cidaltuni *alts;
struct cidmap *next;
};
extern struct cidmap *cidmaps;
extern void DeleteEncoding(Encoding *me);
extern void EncodingFree(Encoding *item);
extern void RemoveMultiples(Encoding *item);
extern char *ParseEncodingFile(char *filename, char *encodingname);
extern char *SFEncodingName(SplineFont *sf, EncMap *map);
extern const char *FindUnicharName(void);
extern EncMap *CompactEncMap(EncMap *map, SplineFont *sf);
extern EncMap *EncMapFromEncoding(SplineFont *sf, Encoding *enc);
extern Encoding *FindOrMakeEncoding(const char *name);
extern Encoding *_FindOrMakeEncoding(const char *name, int make_it);
extern int32 EncFromName(const char *name, enum uni_interp interp, Encoding *encname);
extern int32 EncFromUni(int32 uni, Encoding *enc);
extern int32 UniFromEnc(int enc, Encoding *encname);
/* The "Encoding" here is a little different from what you normally see*/
/* It isn't a mapping from a byte stream to unicode, but from an int */
/* to unicode. If we have an 8/16 encoding (EUC or SJIS) then the */
/* single byte entries will be numbers less than <256 and the */
/* multibyte entries will be numbers >=256. So an encoding might be */
/* valid for the domain [0x20..0x7f] [0xa1a1..0xfefe] */
/* In other words, we're interested in the ordering displayed in the */
/* fontview. Nothing else */
/* The max value need not be exact (though it should be at least as big)*/
/* if you create a new font with the given encoding, then the font will */
/* have max slots in it by default */
/* A return value of -1 (from an EncFunc) indicates no mapping */
/* AddEncoding returns 1 if the encoding was added, 2 if it replaced */
/* an existing encoding, 0 if you attempt to replace a builtin */
/* encoding */
typedef int (*EncFunc)(int);
extern int AddEncoding(char *name, EncFunc enc_to_uni, EncFunc uni_to_enc, int max);
extern int CID2NameUni(struct cidmap *map, int cid, char *buffer, int len);
extern int CID2Uni(struct cidmap *map, int cid);
extern int CIDFromName(char *name, SplineFont *cidmaster);
extern int CountOfEncoding(Encoding *encoding_name);
extern int MaxCID(struct cidmap *map);
extern int NameUni2CID(struct cidmap *map, int uni, const char *name);
extern int SFFlattenByCMap(SplineFont *sf, char *cmapname);
extern int SFForceEncoding(SplineFont *sf, EncMap *old, Encoding *new_enc);
extern int SFReencode(SplineFont *sf, const char *encname, int force);
extern SplineFont *CIDFlatten(SplineFont *cidmaster, SplineChar **glyphs, int charcnt);
extern SplineFont *MakeCIDMaster(SplineFont *sf, EncMap *oldmap, int bycmap, char *cmapfilename, struct cidmap *cidmap);
extern struct altuni *CIDSetAltUnis(struct cidmap *map, int cid);
extern struct cidmap *FindCidMap(char *registry, char *ordering, int supplement, SplineFont *sf);
extern struct cidmap *LoadMapFromFile(char *file, char *registry, char *ordering, int supplement);
extern void BDFOrigFixup(BDFFont *bdf, int orig_cnt, SplineFont *sf);
extern void CIDMasterAsDes(SplineFont *sf);
extern void DumpPfaEditEncodings(void);
extern void FVAddEncodingSlot(FontViewBase *fv, int gid);
extern void LoadPfaEditEncodings(void);
extern void MMMatchGlyphs(MMSet *mm);
extern void SFAddEncodingSlot(SplineFont *sf, int gid);
extern void SFAddGlyphAndEncode(SplineFont *sf, SplineChar *sc, EncMap *basemap, int baseenc);
extern void SFEncodeToMap(SplineFont *sf, struct cidmap *map);
extern void SFExpandGlyphCount(SplineFont *sf, int newcnt);
extern void SFMatchGlyphs(SplineFont *sf, SplineFont *target, int addempties);
extern void SFRemoveGlyph(SplineFont *sf, SplineChar *sc);
#endif /* FONTFORGE_ENCODING_H */

View File

@ -0,0 +1,34 @@
#ifndef FONTFORGE_FVFONTS_H
#define FONTFORGE_FVFONTS_H
#include "baseviews.h"
#include "splinefont.h"
extern AnchorClass *MCConvertAnchorClass(struct sfmergecontext *mc, AnchorClass *ac);
extern BDFChar *BDFCharCopy(BDFChar *bc);
extern int SFCIDFindCID(SplineFont *sf, int unienc, const char *name);
extern int SFCIDFindExistingChar(SplineFont *sf, int unienc, const char *name);
extern int SFFindExistingSlot(SplineFont *sf, int unienc, const char *name);
extern int SFFindGID(SplineFont *sf, int unienc, const char *name);
extern int SFFindSlot(SplineFont *sf, EncMap *map, int unienc, const char *name);
extern int SFHasChar(SplineFont *sf, int unienc, const char *name);
extern int SFHasCID(SplineFont *sf, int cid);
extern PST *PSTCopy(PST *base, SplineChar *sc, struct sfmergecontext *mc);
extern RefChar *RefCharsCopy(RefChar *ref);
extern SplineChar *SFGetChar(SplineFont *sf, int unienc, const char *name);
extern SplineChar *SFGetOrMakeCharFromUnicodeBasic(SplineFont *sf, int ch);
extern SplineChar *SFHashName(SplineFont *sf, const char *name);
extern SplineChar *SplineCharCopy(SplineChar *sc, SplineFont *into, struct sfmergecontext *mc);
extern SplineChar *SplineCharInterpolate(SplineChar *base, SplineChar *other, real amount, SplineFont *newfont);
extern SplineFont *InterpolateFont(SplineFont *base, SplineFont *other, real amount, Encoding *enc);
extern SplineSet *SplineSetsInterpolate(SplineSet *base, SplineSet *other, real amount, SplineChar *sc);
extern struct altuni *AltUniCopy(struct altuni *altuni, SplineFont *noconflicts);
extern struct lookup_subtable *MCConvertSubtable(struct sfmergecontext *mc, struct lookup_subtable *sub);
extern void BitmapsCopy(SplineFont *to, SplineFont *from, int to_index, int from_index);
extern void GlyphHashFree(SplineFont *sf);
extern void __GlyphHashFree(struct glyphnamehash *hash);
extern void MergeFont(FontViewBase *fv, SplineFont *other, int preserveCrossFontKerning);
extern void SFFinishMergeContext(struct sfmergecontext *mc);
extern void SFHashGlyph(SplineFont *sf, SplineChar *sc);
#endif /* FONTFORGE_FVFONTS_H */

View File

@ -0,0 +1,19 @@
#ifndef FONTFORGE_NAMELIST_H
#define FONTFORGE_NAMELIST_H
#include "splinefont.h"
extern char **AllGlyphNames(int uni, NameList *for_this_font, SplineChar *sc);
extern char **AllNamelistNames(void);
extern char **SFTemporaryRenameGlyphsToNamelist(SplineFont *sf, NameList *new);
extern const char *RenameGlyphToNamelist(char *buffer, SplineChar *sc, NameList *old, NameList *new, char **sofar);
extern const char *StdGlyphName(char *buffer, int uni, enum uni_interp interp, NameList *for_this_font);
extern int UniFromName(const char *name, enum uni_interp interp, Encoding *encname);
extern NameList *DefaultNameListForNewFonts(void);
extern NameList *LoadNamelist(char *filename);
extern NameList *NameListByName(const char *name);
extern void LoadNamelistDir(char *dir);
extern void SFRenameGlyphsToNamelist(SplineFont *sf, NameList *new);
extern void SFTemporaryRestoreGlyphNames(SplineFont *sf, char **former);
#endif /* FONTFORGE_NAMELIST_H */

View File

@ -0,0 +1,50 @@
/* Copyright (C) 2007-2012 by George Williams */
/*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef FONTFORGE_SAVEFONT_H
#define FONTFORGE_SAVEFONT_H
#include <fontforge-config.h>
#include "splinefont.h"
extern const char (*savefont_extensions[]), (*bitmapextensions[]);
extern int old_sfnt_flags;
void PrepareUnlinkRmOvrlp(SplineFont *sf,const char *filename,int layer);
void RestoreUnlinkRmOvrlp(SplineFont *sf,const char *filename,int layer);
int _DoSave(SplineFont *sf,char *newname,int32 *sizes,int res,
EncMap *map, char *subfontdefinition,int layer);
int CheckIfTransparent(SplineFont *sf);
extern int GenerateScript(SplineFont *sf, char *filename, const char *bitmaptype, int fmflags, int res, char *subfontdirectory, struct sflist *sfs, EncMap *map, NameList *rename_to, int layer);
#ifdef FONTFORGE_CONFIG_WRITE_PFM
extern int WritePfmFile(char *filename, SplineFont *sf, EncMap *map, int layer);
#endif
#endif /* FONTFORGE_SAVEFONT_H */

View File

@ -0,0 +1,29 @@
#ifndef FONTFORGE_SPLINEORDER2_H
#define FONTFORGE_SPLINEORDER2_H
#include "splinefont.h"
extern SplinePoint *SplineTtfApprox(Spline *ps);
extern SplineSet *SplineSetsConvertOrder(SplineSet *ss, int to_order2);
extern SplineSet *SplineSetsPSApprox(SplineSet *ss);
extern SplineSet *SplineSetsTTFApprox(SplineSet *ss);
extern SplineSet *SSPSApprox(SplineSet *ss);
extern SplineSet *SSttfApprox(SplineSet *ss);
extern Spline *SplineMake2(SplinePoint *from, SplinePoint *to);
extern void SCConvertLayerToOrder2(SplineChar *sc, int layer);
extern void SCConvertLayerToOrder3(SplineChar *sc, int layer);
extern void SCConvertOrder(SplineChar *sc, int to_order2);
extern void SCConvertToOrder2(SplineChar *sc);
extern void SCConvertToOrder3(SplineChar *sc);
extern void SFConvertGridToOrder2(SplineFont *_sf);
extern void SFConvertGridToOrder3(SplineFont *_sf);
extern void SFConvertLayerToOrder2(SplineFont *_sf, int layer);
extern void SFConvertLayerToOrder3(SplineFont *_sf, int layer);
extern void SFConvertToOrder2(SplineFont *_sf);
extern void SFConvertToOrder3(SplineFont *_sf);
extern void SplinePointNextCPChanged2(SplinePoint *sp);
extern void SplinePointPrevCPChanged2(SplinePoint *sp);
extern void SplineRefigure2(Spline *spline);
extern void SplineRefigureFixup(Spline *spline);
#endif /* FONTFORGE_SPLINEORDER2_H */

View File

@ -0,0 +1,217 @@
#ifndef FONTFORGE_SPLINEUTIL_H
#define FONTFORGE_SPLINEUTIL_H
#include "psfont.h"
#include "splinefont.h"
#include "ttfinstrs.h"
#include "views.h"
extern AnchorClass *SFFindOrAddAnchorClass(SplineFont *sf, char *name, struct lookup_subtable *sub);
extern AnchorPoint *AnchorPointsCopy(AnchorPoint *alist);
extern AnchorPoint *APAnchorClassMerge(AnchorPoint *anchors, AnchorClass *into, AnchorClass *from);
extern bigreal DistanceBetweenPoints(BasePoint *p1, BasePoint *p2);
extern bigreal SplineCurvature(Spline *s, bigreal t);
extern bigreal SplineMinDistanceToPoint(Spline *s, BasePoint *p);
extern size_t count_caps(const char * input);
extern char *upper_case(const char * input);
extern char *same_case(const char * input);
extern char *delimit_null(const char * input, char delimiter);
extern char *strconcat3(const char *str1, const char *str2, const char *str3);
extern char **StringExplode(const char *input, char delimiter);
extern char *XUIDFromFD(int xuid[20]);
extern DeviceTable *DeviceTableCopy(DeviceTable *orig);
extern double CheckExtremaForSingleBitErrors(const Spline1D *sp, double t, double othert);
extern DStemInfo *DStemInfoCopy(DStemInfo *h);
extern EncMap *EncMap1to1(int enccount);
extern EncMap *EncMapCopy(EncMap *map);
extern EncMap *EncMapNew(int enccount, int backmax, Encoding *enc);
/* Uses an iterative approximation */
extern extended IterateSplineSolve(const Spline1D *sp, extended tmin, extended tmax, extended sought_y);
/* Uses an iterative approximation and then tries to fix things up */
extern extended IterateSplineSolveFixup(const Spline1D *sp, extended tmin, extended tmax, extended sought_y);
extern FPST *FPSTCopy(FPST *fpst);
extern HintMask *HintMaskFromTransformedRef(RefChar *ref, BasePoint *trans, SplineChar *basesc,HintMask *hm);
extern ImageList *ImageListCopy(ImageList *cimg);
extern ImageList *ImageListTransform(ImageList *img, real transform[6], int everything);
extern int CountKerningClasses(SplineFont *sf);
extern int _CubicSolve(const Spline1D *sp, bigreal sought, extended ts[3]);
extern int GroupNameType(const char *input);
extern int IntersectLines(BasePoint *inter, BasePoint *line1_1, BasePoint *line1_2, BasePoint *line2_1, BasePoint *line2_2);
extern int IntersectLinesClip(BasePoint *inter, BasePoint *line1_1, BasePoint *line1_2, BasePoint *line2_1, BasePoint *line2_2);
extern int IntersectLinesSlopes(BasePoint *inter, BasePoint *line1, BasePoint *slope1, BasePoint *line2, BasePoint *slope2);
extern int LineTangentToSplineThroughPt(Spline *s, BasePoint *pt, extended ts[4], extended tmin, extended tmax);
extern int NearSpline(FindSel *fs, Spline *spline);
extern int SCRoundToCluster(SplineChar *sc, int layer, int sel, bigreal within, bigreal max);
extern int SFKerningGroupExistsSpecific(const struct splinefont *sf, const char *groupname, int isv, int isr);
extern int SpExistsInSS(SplinePoint *sp, SplineSet *ss);
extern int Spline2DFindExtrema(const Spline *sp, extended extrema[4]);
extern int Spline2DFindPointsOfInflection(const Spline *sp, extended poi[2]);
extern int SplineAtInflection(Spline1D *sp, bigreal t);
extern int SplineAtMinMax(Spline1D *sp, bigreal t);
extern int SplineExistsInSS(Spline *s, SplineSet *ss);
extern int SplinePointIsACorner(SplinePoint *sp);
extern int SplineSetIntersect(SplineSet *spl, Spline **_spline, Spline **_spline2);
extern int SplineSetsRemoveAnnoyingExtrema(SplineSet *ss, bigreal err);
/* Two lines intersect in at most 1 point */
/* Two quadratics intersect in at most 4 points */
/* Two cubics intersect in at most 9 points */ /* Plus an extra space for a trailing -1 */
extern int SplinesIntersect(const Spline *s1, const Spline *s2, BasePoint pts[9], extended t1s[10], extended t2s[10]);
extern int SplineT2SpiroIndex(Spline *spline, bigreal t, SplineSet *spl);
extern int SSBoundsWithin(SplineSet *ss, bigreal z1, bigreal z2, bigreal *wmin, bigreal *wmax, int major);
extern int SSExistsInLayer(SplineSet *ss, SplineSet *lots);
extern int SSHasClip(SplineSet *ss);
extern int SSHasDrawn(SplineSet *ss);
extern int SSPointWithin(SplineSet *spl, BasePoint *pt);
extern int StringInStrings(char const* const* space, int length, const char *target);
extern KernClass *KernClassCopy(KernClass *kc);
extern LinearApprox *SplineApproximate(Spline *spline, real scale);
extern MinimumDistance *MinimumDistanceCopy(MinimumDistance *md);
extern real SplineNearPoint(Spline *spline, BasePoint *bp, real fudge);
extern RefChar *RefCharCreate(void);
extern SplineChar *SFSplineCharCreate(SplineFont *sf);
extern SplineFont *SplineFontFromPSFont(FontDict *fd);
extern SplinePointList *SPLCopyTransformedHintMasks(RefChar *r, SplineChar *basesc, BasePoint *trans,int layer);
extern SplinePointList *SPLCopyTranslatedHintMasks(SplinePointList *base, SplineChar *basesc, SplineChar *subsc, BasePoint *trans);
extern SplinePointList *SplinePointListCopy1(const SplinePointList *spl);
extern SplinePointList *SplinePointListCopySelected(SplinePointList *base);
extern SplinePointList *SplinePointListCopySpiroSelected(SplinePointList *base);
extern SplinePointList *SplinePointListRemoveSelected(SplineChar *sc, SplinePointList *base);
extern SplinePointList *SplinePointListShift(SplinePointList *base, real xoff, enum transformPointType allpoints);
extern SplinePointList *SplinePointListSpiroTransform(SplinePointList *base, real transform[6], int allpoints);
extern SplinePointList *SplinePointListTransformExtended(SplinePointList *base, real transform[6], enum transformPointType tpt, enum transformPointMask tpmask);
extern SplinePoint *SplineBisect(Spline *spline, extended t);
extern SplinePoint *SplinePointCreate(real x, real y);
extern SplineSet *LayerAllSplines(Layer *layer);
extern SplineSet *LayerUnAllSplines(Layer *layer);
extern Spline *SplineMake3(SplinePoint *from, SplinePoint *to);
extern Spline *SplineSplit(Spline *spline, extended ts[3]);
extern struct baselangextent *BaseLangCopy(struct baselangextent *extent);
extern struct ff_glyphclasses *SFGetGroup(const struct splinefont *sf, int index, const char *name);
extern struct glyphvariants *GlyphVariantsCopy(struct glyphvariants *gv);
extern struct gradient *GradientCopy(struct gradient *old, real transform[6]);
extern struct jstf_lang *JstfLangsCopy(struct jstf_lang *jl);
extern struct mathkern *MathKernCopy(struct mathkern *mk);
extern struct pattern *PatternCopy(struct pattern *old, real transform[6]);
extern ValDevTab *ValDevTabCopy(ValDevTab *orig);
extern void AltUniFree(struct altuni *altuni);
extern void AnchorClassesFree(AnchorClass *an);
extern void AnchorPointsFree(AnchorPoint *ap);
extern void ApTransform(AnchorPoint *ap, real transform[6]);
extern void ASMFree(ASM *sm);
extern void BaseFree(struct Base *base);
extern void BaseLangFree(struct baselangextent *extent);
extern void BaseScriptFree(struct basescript *bs);
extern void BpTransform(BasePoint *to, BasePoint *from, real transform[6]);
extern void BrushCopy(struct brush *into, struct brush *from, real transform[6]);
extern void CIDLayerFindBounds(SplineFont *cidmaster, int layer, DBounds *bounds);
extern void DeviceTableFree(DeviceTable *dt);
extern void DeviceTableSet(DeviceTable *adjust, int size, int correction);
extern void DStemInfoFree(DStemInfo *h);
extern void DStemInfosFree(DStemInfo *h);
extern void EncMapFree(EncMap *map);
extern void ExplodedStringFree(char **input);
extern void FeatureScriptLangListFree(FeatureScriptLangList *fl);
extern void FPSTClassesFree(FPST *fpst);
extern void FPSTFree(FPST *fpst);
extern void FPSTRuleContentsFree(struct fpst_rule *r, enum fpossub_format format);
extern void FPSTRulesFree(struct fpst_rule *r, enum fpossub_format format, int rcnt);
extern void GlyphGroupFree(struct ff_glyphclasses* group);
extern void GlyphGroupKernFree(struct ff_rawoffsets* groupkern);
extern void GlyphGroupKernsFree(struct ff_rawoffsets* root);
extern void GlyphGroupsFree(struct ff_glyphclasses* root);
extern void GlyphVariantsFree(struct glyphvariants *gv);
extern void GradientFree(struct gradient *grad);
extern void GrowBufferAdd(GrowBuf *gb, int ch);
extern void GrowBufferAddStr(GrowBuf *gb, char *str);
extern void ImageListsFree(ImageList *imgs);
extern void JstfLangFree(struct jstf_lang *jl);
extern void JustifyFree(Justify *just);
extern void KernClassClearSpecialContents(KernClass *kc);
extern void KernClassFreeContents(KernClass *kc);
extern void KernClassListClearSpecialContents(KernClass *kc);
extern void KernClassListFree(KernClass *kc);
extern void KernPairsFree(KernPair *kp);
extern void LayerDefault(Layer *layer);
extern void LayerFreeContents(SplineChar *sc, int layer);
extern void LinearApproxFree(LinearApprox *la);
extern void LineListFree(LineList *ll);
extern void MacFeatListFree(MacFeat *mf);
extern void MacNameListFree(struct macname *mn);
extern void MacSettingListFree(struct macsetting *ms);
extern void MarkClassFree(int cnt, char **classes, char **names);
extern void MarkSetFree(int cnt, char **classes, char **names);
extern void MathKernFree(struct mathkern *mk);
extern void MathKernVContentsFree(struct mathkernvertex *mk);
extern void MinimumDistancesFree(MinimumDistance *md);
extern void MMSetClearSpecial(MMSet *mm);
extern void MMSetFreeContents(MMSet *mm);
extern void OtfFeatNameListFree(struct otffeatname *fn);
extern void OtfNameListFree(struct otfname *on);
extern void OTLookupFree(OTLookup *lookup);
extern void OTLookupListFree(OTLookup *lookup);
extern void PatternFree(struct pattern *pat);
extern void PenCopy(struct pen *into, struct pen *from, real transform[6]);
extern void RefCharFindBounds(RefChar *rf);
extern void RefCharFree(RefChar *ref);
extern void RefCharsFree(RefChar *ref);
extern void SCCategorizePoints(SplineChar *sc);
extern void SCMakeDependent(SplineChar *dependent, SplineChar *base);
extern void SCRefToSplines(SplineChar *sc, RefChar *rf, int layer);
extern void SCReinstanciateRefChar(SplineChar *sc, RefChar *rf, int layer);
extern void SCRemoveDependent(SplineChar *dependent, RefChar *rf, int layer);
extern void SCRemoveDependents(SplineChar *dependent);
extern void SCRemoveLayerDependents(SplineChar *dependent, int layer);
extern void SFInstanciateRefs(SplineFont *sf);
extern void SFReinstanciateRefs(SplineFont *sf);
extern void SFRemoveAnchorClass(SplineFont *sf, AnchorClass *an);
extern void SFRemoveSavedTable(SplineFont *sf, uint32 tag);
extern void SPLCategorizePointsKeepCorners(SplinePointList *spl);
extern void SplineCharFindBounds(SplineChar *sc, DBounds *bounds);
extern void SplineCharFreeContents(SplineChar *sc);
extern void SplineCharLayerFindBounds(SplineChar *sc, int layer, DBounds *bounds);
extern void SplineCharLayerQuickBounds(SplineChar *sc, int layer, DBounds *bounds);
extern void SplineCharListsFree(struct splinecharlist *dlist);
extern void SplineCharQuickBounds(SplineChar *sc, DBounds *b);
extern void SplineCharQuickConservativeBounds(SplineChar *sc, DBounds *b);
extern void SplineFindExtrema(const Spline1D *sp, extended *_t1, extended *_t2);
extern void SplineFontClearSpecial(SplineFont *sf);
extern void SplineFontFindBounds(SplineFont *sf, DBounds *bounds);
extern void SplineFontFree(SplineFont *sf);
extern void SplineFontLayerFindBounds(SplineFont *sf, int layer, DBounds *bounds);
extern void SplineFontQuickConservativeBounds(SplineFont *sf, DBounds *b);
extern void SplineFree(Spline *spline);
extern void SplinePointCategorize(SplinePoint *sp);
extern void SplinePointFree(SplinePoint *sp);
extern void SplinePointListFree(SplinePointList *spl);
extern void SplinePointListMDFree(SplineChar *sc, SplinePointList *spl);
extern void SplinePointListSelect(SplinePointList *spl, int sel);
extern void SplinePointListsFree(SplinePointList *spl);
extern void SplinePointListsMDFree(SplineChar *sc, SplinePointList *spl);
extern void SplinePointMDFree(SplineChar *sc, SplinePoint *sp);
extern void SplinePointsFree(SplinePointList *spl);
extern void SplineRemoveExtremaTooClose(Spline1D *sp, extended *_t1, extended *_t2);
extern void SplineSetBeziersClear(SplinePointList *spl);
extern void SplineSetFindBounds(const SplinePointList *spl, DBounds *bounds);
extern void SplineSetQuickBounds(SplineSet *ss, DBounds *b);
extern void SplineSetQuickConservativeBounds(SplineSet *ss, DBounds *b);
extern void SplineSetSpirosClear(SplineSet *spl);
extern void TTFLangNamesFree(struct ttflangname *l);
extern void TtfTablesFree(struct ttf_table *tab);
extern void ValDevFree(ValDevTab *adjust);
#ifdef FF_UTHASH_GLIF_NAMES
struct glif_name_index;
extern int KerningClassSeekByAbsoluteIndex(const struct splinefont *sf, int seek_index, struct kernclass **okc, int *oisv, int *oisr, int *ooffset);
extern int HashKerningClassNames(SplineFont *sf, struct glif_name_index * class_name_hash);
extern int HashKerningClassNamesCaps(SplineFont *sf, struct glif_name_index * class_name_hash);
extern int HashKerningClassNamesFlex(SplineFont *sf, struct glif_name_index * class_name_hash, int capitalize);
#endif /* FF_UTHASH_GLIF_NAMES */
#endif /* FONTFORGE_SPLINEUTIL_H */

View File

@ -0,0 +1,85 @@
#ifndef FONTFORGE_SPLINEUTIL2_H
#define FONTFORGE_SPLINEUTIL2_H
#include "splinefont.h"
enum ae_type { ae_all, ae_between_selected, ae_only_good, ae_only_good_rm_later };
extern bigreal PathLength(SplineSet *ss);
extern bigreal SplineLengthRange(Spline *spline, real from_t, real to_t);
extern char *GetNextUntitledName(void);
extern int PointListIsSelected(SplinePointList *spl);
extern int PointsDiagonalable(SplineFont *sf, BasePoint **bp, BasePoint *unit);
extern int RealApprox(real a, real b);
extern int RealNearish(real a, real b);
extern int RealRatio(real a, real b, real fudge);
extern int RealWithin(real a, real b, real fudge);
extern int SPInterpolate(const SplinePoint *sp);
extern int SpIsExtremum(SplinePoint *sp);
extern int Spline1DCantExtremeX(const Spline *s);
extern int Spline1DCantExtremeY(const Spline *s);
extern int SplineInSplineSet(Spline *spline, SplineSet *spl);
extern int SplineIsLinearMake(Spline *spline);
extern int SplinePointListIsClockwise(const SplineSet *spl);
extern int SPLNearlyLines(SplineChar *sc, SplineSet *ss, bigreal err);
extern int Within16RoundingErrors(bigreal v1, bigreal v2);
extern int Within4RoundingErrors(bigreal v1, bigreal v2);
extern int Within64RoundingErrors(bigreal v1, bigreal v2);
extern Spline *ApproximateSplineFromPointsSlopes(SplinePoint *from, SplinePoint *to, TPoint *mid, int cnt, int order2);
extern SplineFont *SplineFontBlank(int charcnt);
extern SplineFont *SplineFontEmpty(void);
extern SplineFont *SplineFontNew(void);
extern Spline *PathFindDistance(SplineSet *path, bigreal d, bigreal *_t);
extern SplineSet *SplineCharRemoveTiny(SplineChar *sc, SplineSet *head);
extern SplineSet *SplineCharSimplify(SplineChar *sc, SplineSet *head, struct simplifyinfo *smpl);
extern SplineSet *SplineSetBindToPath(SplineSet *ss, int doscale, int glyph_as_unit, int align, real offset, SplineSet *path);
extern SplineSet *SplineSetJoin(SplineSet *start, int doall, real fudge, int *changed);
extern SplineSet *SplineSetReverse(SplineSet *spl);
extern SplineSet *SplineSetsAntiCorrect(SplineSet *base);
extern SplineSet *SplineSetsCorrect(SplineSet *base, int *changed);
extern SplineSet *SplineSetsDetectDir(SplineSet **_base, int *_lastscan);
extern SplineSet *SplineSetsExtractOpen(SplineSet **tbase);
extern SplineSet *SSRemoveZeroLengthSplines(SplineSet *base);
extern Spline *SplineAddExtrema(Spline *s, int always, real lenbound, real offsetbound, DBounds *b);
extern void BP_HVForce(BasePoint *vector);
extern void CanonicalContours(SplineChar *sc, int layer);
extern void SFIncrementXUID(SplineFont *sf);
extern void SFRandomChangeXUID(SplineFont *sf);
extern void SPAdjustControl(SplinePoint *sp, BasePoint *cp, BasePoint *to, int order2);
extern void SPAverageCps(SplinePoint *sp);
extern void SPHVCurveForce(SplinePoint *sp);
extern void SPLAverageCps(SplinePointList *spl);
extern void SplineCharAddExtrema(SplineChar *sc, SplineSet *head, enum ae_type between_selected, int emsize);
extern void SplineCharDefaultNextCP(SplinePoint *base);
extern void SplineCharDefaultPrevCP(SplinePoint *base);
extern void SplineCharMerge(SplineChar *sc, SplineSet **head, int type);
extern void SplineCharTangentNextCP(SplinePoint *sp);
extern void SplineCharTangentPrevCP(SplinePoint *sp);
extern void SplinePointListSet(SplinePointList *tobase, SplinePointList *frombase);
extern void SplinePointListSimplify(SplineChar *sc, SplinePointList *spl, struct simplifyinfo *smpl);
extern void SplineSetAddExtrema(SplineChar *sc, SplineSet *ss, enum ae_type between_selected, int emsize);
extern void SplineSetJoinCpFixup(SplinePoint *sp);
extern void SplineSetsInsertOpen(SplineSet **tbase, SplineSet *open);
extern void SplineSetsUntick(SplineSet *spl);
extern void SplinesRemoveBetween(SplineChar *sc, SplinePoint *from, SplinePoint *to, int type);
extern void SPLNearlyHvCps(SplineChar *sc, SplineSet *ss, bigreal err);
extern void SPLNearlyHvLines(SplineChar *sc, SplineSet *ss, bigreal err);
extern void SPLsStartToLeftmost(SplineChar *sc, int layer);
extern void SPLStartToLeftmost(SplineChar *sc, SplinePointList *spl, int *changed);
extern void SPSmoothJoint(SplinePoint *sp);
/**
* This is like SPAdjustControl but you have not wanting to move the
* BCP at all, but you would like the current location of the passed
* BCP to reshape the spline through the splinepoint. For example, if
* you drag the spline between two points then you might like to touch
* the inside BCP between the two splinepoints to reshape the whole
* curve through a curve point.
*/
extern void SPTouchControl(SplinePoint *sp, BasePoint *which, int order2);
extern void SPWeightedAverageCps(SplinePoint *sp);
extern void SSOverlapClusterCpAngles(SplineSet *base, bigreal within);
extern void SSRemoveStupidControlPoints(SplineSet *base);
#endif /* FONTFORGE_SPLINEUTIL2_H */

View File

@ -0,0 +1,8 @@
#ifndef FONTFORGE_START_H
#define FONTFORGE_START_H
extern void doinitFontForgeMain(void);
extern void doversion(const char *source_version_str);
extern void InitSimpleStuff(void);
#endif /* FONTFORGE_START_H */

View File

@ -0,0 +1,33 @@
#ifndef FONTFORGE_TOTTF_H
#define FONTFORGE_TOTTF_H
#include "splinefont.h"
#include "ttf.h"
extern char *utf8_verify_copy(const char *str);
extern int32 filechecksum(FILE *file);
extern int AlreadyMSSymbolArea(SplineFont *sf, EncMap *map);
extern int RefDepth(RefChar *ref, int layer);
extern int SFFigureDefWidth(SplineFont *sf, int *_nomwid);
extern int SFHasInstructions(SplineFont *sf);
extern int SSAddPoints(SplineSet *ss, int ptcnt, BasePoint *bp, char *flags);
extern int ttfcopyfile(FILE *ttf, FILE *other, int pos, const char *tab_name);
extern int WriteTTC(const char *filename, struct sflist *sfs, enum fontformat format, enum bitmapformat bf, int flags, int layer, enum ttc_flags ttcflags);
extern int WriteTTFFont(char *fontname, SplineFont *sf, enum fontformat format, int32 *bsizes, enum bitmapformat bf, int flags, EncMap *enc, int layer);
extern int _WriteTTFFont(FILE *ttf, SplineFont *sf, enum fontformat format, int32 *bsizes, enum bitmapformat bf, int flags, EncMap *enc, int layer);
extern int _WriteType42SFNTS(FILE *type42, SplineFont *sf, enum fontformat format, int flags, EncMap *enc, int layer);
extern void cvt_unix_to_1904(long long time, int32 result[2]);
extern void DefaultTTFEnglishNames(struct ttflangname *dummy, SplineFont *sf);
extern void OS2FigureCodePages(SplineFont *sf, uint32 CodePage[2]);
extern void OS2FigureUnicodeRanges(SplineFont *sf, uint32 Ranges[4]);
extern void SFDefaultOS2Info(struct pfminfo *pfminfo, SplineFont *sf, char *fontname);
extern void SFDefaultOS2Simple(struct pfminfo *pfminfo, SplineFont *sf);
extern void SFDefaultOS2SubSuper(struct pfminfo *pfminfo, int emsize, double italic_angle);
extern void SFDummyUpCIDs(struct glyphinfo *gi, SplineFont *sf);
extern void putfixed(FILE *file, real dval);
extern void putlong(FILE *file, int val);
extern void putshort(FILE *file, int sval);
#endif /* FONTFORGE_TOTTF_H */

File diff suppressed because it is too large Load Diff