1
0
mirror of https://github.com/pdf2htmlEX/pdf2htmlEX.git synced 2024-12-22 13:00:08 +00:00

initial update to fontforge 20190801

This commit is contained in:
Stephen Gaito 2019-12-09 10:45:13 +00:00
parent 4a0d08822b
commit 4a0a48cf69
16 changed files with 112 additions and 1549 deletions

View File

@ -6,8 +6,8 @@
#export POPPLER_VERSION=poppler-0.82.0 #export POPPLER_VERSION=poppler-0.82.0
export POPPLER_VERSION=poppler-0.81.0 export POPPLER_VERSION=poppler-0.81.0
#export FONTFORGE_VERSION=20190801 export FONTFORGE_VERSION=20190801
export FONTFORGE_VERSION=20170731 #export FONTFORGE_VERSION=20170731
if [ -z "$PDF2HTMLEX_BRANCH" ]; then if [ -z "$PDF2HTMLEX_BRANCH" ]; then
export PDF2HTMLEX_BRANCH="$(git rev-parse --abbrev-ref HEAD)" export PDF2HTMLEX_BRANCH="$(git rev-parse --abbrev-ref HEAD)"

View File

@ -19,18 +19,19 @@
#include "SignalHandler.h" #include "SignalHandler.h"
#include "ffw.h" #include "ffw.h"
#include "fontforge-2.0.20170731/autowidth.h" #include "fontforge-version-extras.h" // needed for FONTFORGE_GIT_VERSION
#include "fontforge-2.0.20170731/bitmapchar.h" #include "fontforge-20190801/autowidth.h"
#include "fontforge-2.0.20170731/cvimages.h" #include "fontforge-20190801/bitmapchar.h"
#include "fontforge-2.0.20170731/encoding.h" #include "fontforge-20190801/cvimages.h"
#include "fontforge-2.0.20170731/fvfonts.h" #include "fontforge-20190801/encoding.h"
#include "fontforge-2.0.20170731/namelist.h" #include "fontforge-20190801/fvfonts.h"
#include "fontforge-2.0.20170731/savefont.h" #include "fontforge-20190801/namelist.h"
#include "fontforge-2.0.20170731/splineorder2.h" #include "fontforge-20190801/savefont.h"
#include "fontforge-2.0.20170731/splineutil.h" #include "fontforge-20190801/splineorder2.h"
#include "fontforge-2.0.20170731/splineutil2.h" #include "fontforge-20190801/splineutil.h"
#include "fontforge-2.0.20170731/start.h" #include "fontforge-20190801/splineutil2.h"
#include "fontforge-2.0.20170731/tottf.h" #include "fontforge-20190801/start.h"
#include "fontforge-20190801/tottf.h"
static real EPS=1e-6; static real EPS=1e-6;
@ -126,7 +127,7 @@ const FFWVersionInfo* ffw_get_version_info(void)
ffwVersionInfo.gitVersion = FONTFORGE_GIT_VERSION; ffwVersionInfo.gitVersion = FONTFORGE_GIT_VERSION;
ffwVersionInfo.majorVersion = xstr(FONTFORGE_VERSION_MAJOR); ffwVersionInfo.majorVersion = xstr(FONTFORGE_VERSION_MAJOR);
ffwVersionInfo.minorVersion = xstr(FONTFORGE_VERSION_MINOR); ffwVersionInfo.minorVersion = xstr(FONTFORGE_VERSION_MINOR);
ffwVersionInfo.versionDate = FONTFORGE_VERSIONDATE; ffwVersionInfo.versionDate = FONTFORGE_VERSION;
return &ffwVersionInfo; return &ffwVersionInfo;
} }
@ -170,9 +171,9 @@ void ffw_load_font(const char * filename)
ffwClearAction(); ffwClearAction();
} }
/* //
* Fight again dirty stuffs // Fight again dirty stuffs
*/ //
void ffw_prepare_font(void) void ffw_prepare_font(void)
{ {
ffwSetAction("prepare"); ffwSetAction("prepare");
@ -181,10 +182,10 @@ void ffw_prepare_font(void)
FVRemoveKerns(cur_fv); FVRemoveKerns(cur_fv);
FVRemoveVKerns(cur_fv); FVRemoveVKerns(cur_fv);
/* //
* Remove Alternate Unicodes // Remove Alternate Unicodes
* We never use them because we will do a force encoding // We never use them because we will do a force encoding
*/ //
int i; int i;
SplineFont * sf = cur_fv->sf; SplineFont * sf = cur_fv->sf;
for(i = 0; i < sf->glyphcnt; ++i) for(i = 0; i < sf->glyphcnt; ++i)
@ -201,10 +202,10 @@ void ffw_prepare_font(void)
} }
} }
/* //
* Wipe out font name // Wipe out font name
* browsers may rejects fonts with malformed font names // browsers may rejects fonts with malformed font names
*/ //
free(sf->fontname); free(sf->fontname);
sf->fontname = strcopy(""); sf->fontname = strcopy("");
ffwClearAction(); ffwClearAction();
@ -226,6 +227,7 @@ void ffw_save(const char * filename)
err("Cannot save font to %s\n", filename); err("Cannot save font to %s\n", filename);
ffwClearAction(); ffwClearAction();
} }
void ffw_close(void) void ffw_close(void)
{ {
ffwSetAction("close"); ffwSetAction("close");
@ -347,14 +349,14 @@ void ffw_cidflatten(void)
return; return;
} }
ffwSetAction("flatten the cid in"); ffwSetAction("flatten the cid in");
SFFlatten(cur_fv->sf->cidmaster); SFFlatten(&(cur_fv->sf->cidmaster));
ffwClearAction(); ffwClearAction();
} }
/* //
* There is no check if a glyph with the same unicode exists! // There is no check if a glyph with the same unicode exists!
* TODO: let FontForge fill in the standard glyph name <- or maybe this might cause collision? // TODO: let FontForge fill in the standard glyph name <- or maybe this might cause collision?
*/ //
void ffw_add_empty_char(int32_t unicode, int width) void ffw_add_empty_char(int32_t unicode, int width)
{ {
ffwSetAction("add an empty character to"); ffwSetAction("add an empty character to");
@ -424,17 +426,17 @@ void ffw_set_metric(double ascent, double descent)
if(a < 0) a = 0; if(a < 0) a = 0;
if(d > 0) d = 0; if(d > 0) d = 0;
/* //
sf->ascent = min(a, em); //sf->ascent = min(a, em);
sf->descent = em - bb.maxy; //sf->descent = em - bb.maxy;
*/ //
/* //
* The embedded fonts are likely to have inconsistent values for the 3 sets of ascent/descent // The embedded fonts are likely to have inconsistent values for the 3 sets of ascent/descent
* PDF viewers don't care, since they don't even use these values // PDF viewers don't care, since they don't even use these values
* But have to unify them, for different browsers on different platforms // But have to unify them, for different browsers on different platforms
* Things may become easier when there are CSS rules for baseline-based positioning. // Things may become easier when there are CSS rules for baseline-based positioning.
*/ //
info->os2_winascent = a; info->os2_winascent = a;
info->os2_typoascent = a; info->os2_typoascent = a;
info->hhead_ascent = a; info->hhead_ascent = a;
@ -454,9 +456,9 @@ void ffw_set_metric(double ascent, double descent)
ffwClearAction(); ffwClearAction();
} }
/* //
* TODO:bitmap, reference have not been considered in this function // TODO:bitmap, reference have not been considered in this function
*/ //
void ffw_set_widths(int * width_list, int mapping_len, void ffw_set_widths(int * width_list, int mapping_len,
int stretch_narrow, int squeeze_wide) int stretch_narrow, int squeeze_wide)
{ {
@ -475,9 +477,9 @@ void ffw_set_widths(int * width_list, int mapping_len,
int imax = min(mapping_len, map->enccount); int imax = min(mapping_len, map->enccount);
for(i = 0; i < imax; ++i) for(i = 0; i < imax; ++i)
{ {
/* //
* Don't mess with it if the glyphs is not used. // Don't mess with it if the glyphs is not used.
*/ //
if(width_list[i] == -1) if(width_list[i] == -1)
{ {
continue; continue;

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,26 @@
# FontForge: the missing headers
The FontForge header files in this directory are taken from the
FontForge-20190801 release.
They are headers which are not usually installed by the FontForge make
system.
## Required headers
- `autowidth.h` required for FVRemoveKerns
- `bitmapchar.h` required for SFReplaceEncodingBDFProps
- `cvimages.h` required for FVImportImages
- `fvfonts.h` required for SFFindSlot
- `namelist.h` required for UniFromName
- `savefont.h` required for GenerateScript
- `splineorder2.h` required for SFConvertToOrder2
- `splineutil.h` required for AltUniFree
- `splineutil2.h` required for SplineFontNew
- `start.h` required for InitSimpleStuff
- `tottf.h` required for SFDefaultOS2Info
## Helpful headers
- `encoding.h` conflicts with an existing header in the src/util directory.

View File

@ -3,8 +3,8 @@
#include "baseviews.h" #include "baseviews.h"
#include "gimage.h" #include "gimage.h"
#include "splinefont.h"
#include "sd.h" #include "sd.h"
#include "splinefont.h"
extern GImage *ImageAlterClut(GImage *image); extern GImage *ImageAlterClut(GImage *image);
extern int FVImportImages(FontViewBase *fv, char *path, int format, int toback, int flags); extern int FVImportImages(FontViewBase *fv, char *path, int format, int toback, int flags);

View File

@ -61,7 +61,7 @@ extern int CIDFromName(char *name, SplineFont *cidmaster);
extern int CountOfEncoding(Encoding *encoding_name); extern int CountOfEncoding(Encoding *encoding_name);
extern int MaxCID(struct cidmap *map); extern int MaxCID(struct cidmap *map);
extern int NameUni2CID(struct cidmap *map, int uni, const char *name); extern int NameUni2CID(struct cidmap *map, int uni, const char *name);
extern int SFFlattenByCMap(SplineFont *sf, char *cmapname); extern int SFFlattenByCMap(SplineFont **sf, char *cmapname);
extern int SFForceEncoding(SplineFont *sf, EncMap *old, Encoding *new_enc); extern int SFForceEncoding(SplineFont *sf, EncMap *old, Encoding *new_enc);
extern int SFReencode(SplineFont *sf, const char *encname, int force); extern int SFReencode(SplineFont *sf, const char *encname, int force);
extern SplineFont *CIDFlatten(SplineFont *cidmaster, SplineChar **glyphs, int charcnt); extern SplineFont *CIDFlatten(SplineFont *cidmaster, SplineChar **glyphs, int charcnt);

View File

@ -8,6 +8,7 @@ extern char **AllNamelistNames(void);
extern char **SFTemporaryRenameGlyphsToNamelist(SplineFont *sf, NameList *new); extern char **SFTemporaryRenameGlyphsToNamelist(SplineFont *sf, NameList *new);
extern const char *RenameGlyphToNamelist(char *buffer, SplineChar *sc, NameList *old, NameList *new, char **sofar); 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 const char *StdGlyphName(char *buffer, int uni, enum uni_interp interp, NameList *for_this_font);
extern const char *StdGlyphNameBoundsCheck(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 int UniFromName(const char *name, enum uni_interp interp, Encoding *encname);
extern NameList *DefaultNameListForNewFonts(void); extern NameList *DefaultNameListForNewFonts(void);
extern NameList *LoadNamelist(char *filename); extern NameList *LoadNamelist(char *filename);

View File

@ -32,6 +32,36 @@
#include "splinefont.h" #include "splinefont.h"
enum fm_flags { fm_flag_afm = 0x1,
fm_flag_pfm = 0x2,
fm_flag_shortps = 0x4,
fm_flag_nopshints = 0x8,
fm_flag_apple = 0x10,
fm_flag_pfed_comments = 0x20,
fm_flag_pfed_colors = 0x40,
fm_flag_opentype = 0x80,
fm_flag_glyphmap = 0x100,
fm_flag_TeXtable = 0x200,
fm_flag_ofm = 0x400,
fm_flag_applemode = 0x800,
// fm_flag_??? = 0x1000,
fm_flag_symbol = 0x2000,
fm_flag_dummyDSIG = 0x4000,
// fm_flag_??? = 0x8000,
fm_flag_tfm = 0x10000,
fm_flag_nohintsubs = 0x20000,
fm_flag_noflex = 0x40000,
fm_flag_nottfhints = 0x80000,
fm_flag_restrict256 = 0x100000,
fm_flag_round = 0x200000,
fm_flag_afmwithmarks = 0x400000,
fm_flag_pfed_lookups = 0x800000,
fm_flag_pfed_guides = 0x1000000,
fm_flag_pfed_layers = 0x2000000,
fm_flag_winkern = 0x4000000,
fm_flag_nomacnames = 0x8000000,
};
extern const char (*savefont_extensions[]), (*bitmapextensions[]); extern const char (*savefont_extensions[]), (*bitmapextensions[]);
extern int old_sfnt_flags; extern int old_sfnt_flags;

View File

@ -1,6 +1,7 @@
#ifndef FONTFORGE_SPLINEUTIL_H #ifndef FONTFORGE_SPLINEUTIL_H
#define FONTFORGE_SPLINEUTIL_H #define FONTFORGE_SPLINEUTIL_H
#include "glif_name_hash.h"
#include "psfont.h" #include "psfont.h"
#include "splinefont.h" #include "splinefont.h"
#include "ttfinstrs.h" #include "ttfinstrs.h"
@ -56,6 +57,8 @@ extern int SplineExistsInSS(Spline *s, SplineSet *ss);
extern int SplinePointIsACorner(SplinePoint *sp); extern int SplinePointIsACorner(SplinePoint *sp);
extern int SplineSetIntersect(SplineSet *spl, Spline **_spline, Spline **_spline2); extern int SplineSetIntersect(SplineSet *spl, Spline **_spline, Spline **_spline2);
extern int SplineSetsRemoveAnnoyingExtrema(SplineSet *ss, bigreal err); extern int SplineSetsRemoveAnnoyingExtrema(SplineSet *ss, bigreal err);
extern int SplineRemoveWildControlPoints(Spline *s, bigreal distratio);
extern int SplineSetsRemoveWildControlPoints(SplineSet *ss, bigreal distratio);
/* Two lines intersect in at most 1 point */ /* Two lines intersect in at most 1 point */
/* Two quadratics intersect in at most 4 points */ /* Two quadratics intersect in at most 4 points */
@ -130,6 +133,7 @@ extern void GlyphVariantsFree(struct glyphvariants *gv);
extern void GradientFree(struct gradient *grad); extern void GradientFree(struct gradient *grad);
extern void GrowBufferAdd(GrowBuf *gb, int ch); extern void GrowBufferAdd(GrowBuf *gb, int ch);
extern void GrowBufferAddStr(GrowBuf *gb, char *str); extern void GrowBufferAddStr(GrowBuf *gb, char *str);
extern void GuidelineSetFree(GuidelineSet *gl);
extern void ImageListsFree(ImageList *imgs); extern void ImageListsFree(ImageList *imgs);
extern void JstfLangFree(struct jstf_lang *jl); extern void JstfLangFree(struct jstf_lang *jl);
extern void JustifyFree(Justify *just); extern void JustifyFree(Justify *just);
@ -172,7 +176,6 @@ extern void SFInstanciateRefs(SplineFont *sf);
extern void SFReinstanciateRefs(SplineFont *sf); extern void SFReinstanciateRefs(SplineFont *sf);
extern void SFRemoveAnchorClass(SplineFont *sf, AnchorClass *an); extern void SFRemoveAnchorClass(SplineFont *sf, AnchorClass *an);
extern void SFRemoveSavedTable(SplineFont *sf, uint32 tag); extern void SFRemoveSavedTable(SplineFont *sf, uint32 tag);
extern void SPLCategorizePointsKeepCorners(SplinePointList *spl);
extern void SplineCharFindBounds(SplineChar *sc, DBounds *bounds); extern void SplineCharFindBounds(SplineChar *sc, DBounds *bounds);
extern void SplineCharFreeContents(SplineChar *sc); extern void SplineCharFreeContents(SplineChar *sc);
extern void SplineCharLayerFindBounds(SplineChar *sc, int layer, DBounds *bounds); extern void SplineCharLayerFindBounds(SplineChar *sc, int layer, DBounds *bounds);
@ -206,12 +209,9 @@ extern void TTFLangNamesFree(struct ttflangname *l);
extern void TtfTablesFree(struct ttf_table *tab); extern void TtfTablesFree(struct ttf_table *tab);
extern void ValDevFree(ValDevTab *adjust); 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 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 HashKerningClassNames(SplineFont *sf, struct glif_name_index * class_name_hash);
extern int HashKerningClassNamesCaps(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); extern int HashKerningClassNamesFlex(SplineFont *sf, struct glif_name_index * class_name_hash, int capitalize);
#endif /* FF_UTHASH_GLIF_NAMES */
#endif /* FONTFORGE_SPLINEUTIL_H */ #endif /* FONTFORGE_SPLINEUTIL_H */