Skip to content

Commit

Permalink
A new flag to exclude unmapped glyphs from the old-style "kern" table…
Browse files Browse the repository at this point in the history
…. Required for compatibility with non-OpenType-aware Windows applications.
  • Loading branch information
catharanthus committed Dec 10, 2014
1 parent b638d1c commit ea723e0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions fontforge/savefont.c
Original file line number Diff line number Diff line change
Expand Up @@ -1153,6 +1153,7 @@ int GenerateScript(SplineFont *sf,char *filename,const char *bitmaptype, int fmf
if ( fmflags&0x800000 ) old_sfnt_flags |= ttf_flag_pfed_lookupnames;
if ( fmflags&0x1000000 ) old_sfnt_flags |= ttf_flag_pfed_guides;
if ( fmflags&0x2000000 ) old_sfnt_flags |= ttf_flag_pfed_layers;
if ( fmflags&0x4000000 ) old_sfnt_flags |= ttf_flag_oldkernmappedonly;
}
} else {
old_sfnt_flags = 0;
Expand Down Expand Up @@ -1195,6 +1196,7 @@ int GenerateScript(SplineFont *sf,char *filename,const char *bitmaptype, int fmf
if ( fmflags&0x800000 ) old_sfnt_flags |= ttf_flag_pfed_lookupnames;
if ( fmflags&0x1000000 ) old_sfnt_flags |= ttf_flag_pfed_guides;
if ( fmflags&0x2000000 ) old_sfnt_flags |= ttf_flag_pfed_layers;
if ( fmflags&0x4000000 ) old_sfnt_flags |= ttf_flag_oldkernmappedonly;
}
}

Expand Down
3 changes: 2 additions & 1 deletion fontforge/splinefont.h
Original file line number Diff line number Diff line change
Expand Up @@ -2014,7 +2014,8 @@ enum ttf_flags { ttf_flag_shortps = 1, ttf_flag_nohints = 2,
ttf_flag_pfed_layers=0x2000,
ttf_flag_symbol=0x4000,
ttf_flag_dummyDSIG=0x8000,
ttf_native_kern=0x10000 // This applies mostly to U. F. O. right now.
ttf_native_kern=0x10000, // This applies mostly to U. F. O. right now.
ttf_flag_oldkernmappedonly=0x20000000 // Allow only mapped glyphs in the old-style "kern" table, required for Windows compatibility
};
enum ttc_flags { ttc_flag_trymerge=0x1, ttc_flag_cff=0x2 };
enum openflags { of_fstypepermitted=1, of_askcmap=2, of_all_glyphs_in_ttc=4,
Expand Down
6 changes: 6 additions & 0 deletions fontforge/tottfaat.c
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,14 @@ return;

for ( tot = 0; gid<at->gi.gcnt && tot<c; ++gid ) if ( at->gi.bygid[gid]!=-1 ) {
SplineChar *sc = sf->glyphs[at->gi.bygid[gid]];
// if requested, omit kern pairs with unmapped glyphs
// (required for compatibility with non-OpenType-aware Windows applications)
if( (at->gi.flags&ttf_flag_oldkernmappedonly) && (unsigned)(sc->unicodeenc)>0xFFFF ) continue;
m = 0;
for ( kp = isv ? sc->vkerns : sc->kerns; kp!=NULL; kp=kp->next ) {
// if requested, omit kern pairs with unmapped glyphs
// (required for compatibility with non-OpenType-aware Windows applications)
if( (at->gi.flags&ttf_flag_oldkernmappedonly) && (unsigned)(kp->sc->unicodeenc)>0xFFFF ) continue;
if ( kp->off!=0 && kp->sc->ttf_glyph!=-1 &&
LookupHasDefault(kp->subtable->lookup)) {
/* order the pairs */
Expand Down

0 comments on commit ea723e0

Please sign in to comment.