summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Williams <pfaedit@users.sourceforge.net>2011-02-18 14:54:17 -0800
committerGeorge Williams <pfaedit@users.sourceforge.net>2011-02-18 14:54:17 -0800
commit0623d6fd757756c6b4f65778fb498e5440375354 (patch)
tree48a76b21dea7bac634f7536a85e79fa046dd123e
parente21a16ec506cabe5971584a8d71b5a5fa9243100 (diff)
According to the spec there are two different types of GPOS 'size' feature. One specifies a design size and nothing else, the other specifies a design size, a design range a style name and a magic number used to associate all fonts in the same family with the same weight and style but with different design sizes.
Fontforge was not very good about warning the user when s/he created something which had some but not all of these attributes. (ie. a design range but no style name). So add some error messages to the fontinfo dlg which makes these checks. FF would also not read in a 'size' feature unless it were in one of these formats. So if the user created a 'size' feature with a design size, and a design range but no style name, then FF would not complain, would happily output it, but would not read it back in again. So be a little more lenient in what we read in.
-rw-r--r--fontforge/fontinfo.c29
-rw-r--r--fontforge/libffstamp.h6
-rw-r--r--fontforge/parsettfatt.c16
-rw-r--r--fontforge/stamp.c6
-rw-r--r--fontforge/tottfgpos.c9
5 files changed, 50 insertions, 16 deletions
diff --git a/fontforge/fontinfo.c b/fontforge/fontinfo.c
index b952f407..eec058c2 100644
--- a/fontforge/fontinfo.c
+++ b/fontforge/fontinfo.c
@@ -4133,6 +4133,7 @@ static int GFI_OK(GGadget *g, GEvent *e) {
GTextInfo **ti;
int subs[4], super[4], strike[2];
int design_size, size_top, size_bottom, styleid;
+ struct otfname *fontstyle_name;
int strokedfont = false;
real strokewidth;
#ifdef FONTFORGE_CONFIG_TYPE3
@@ -4242,6 +4243,34 @@ return(true);
size_bottom = rint(10*GetReal8(gw,CID_DesignBottom,_("_Bottom"),&err));
size_top = rint(10*GetReal8(gw,CID_DesignTop,_("_Top"),&err));
styleid = GetInt8(gw,CID_StyleID,_("Style _ID:"),&err);
+ fontstyle_name = OtfNameFromStyleNames(GWidgetGetControl(gw,CID_StyleName));
+ OtfNameListFree(fontstyle_name);
+ if ( design_size==0 && ( size_bottom!=0 || size_top!=0 || styleid!=0 || fontstyle_name!=NULL )) {
+ ff_post_error(_("Bad Design Size Info"),_("If the design size is 0, then all other fields on that pane must be zero (or unspecified) too."));
+return( true );
+ } else if ( styleid!=0 && fontstyle_name==NULL ) {
+ ff_post_error(_("Bad Design Size Info"),_("If you specify a style id for the design size, then you must specify a style name"));
+return( true );
+ } else if ( fontstyle_name==NULL && styleid!=0 ) {
+ ff_post_error(_("Bad Design Size Info"),_("If you specify a style name for the design size, then you must specify a style id"));
+return( true );
+ } else if ( design_size<0 ) {
+ ff_post_error(_("Bad Design Size Info"),_("If you specify a design size, it must be positive"));
+return( true );
+ } else if ( size_bottom!=0 && size_bottom>design_size ) {
+ ff_post_error(_("Bad Design Size Info"),_("In the design size range, the bottom field must be less than the design size."));
+return( true );
+ } else if ( size_top!=0 && size_top<design_size ) {
+ ff_post_error(_("Bad Design Size Info"),_("In the design size range, the bottom top must be more than the design size."));
+return( true );
+ } else if ( styleid!=0 && size_top==0 ) {
+ ff_post_error(_("Bad Design Size Info"),_("If you specify a style id for the design size, then you must specify a size range"));
+return( true );
+ } else if ( size_top!=0 && styleid==0 ) {
+ ff_post_notice(_("Bad Design Size Info"),_("If you specify a design size range, then you are supposed to specify a style id and style name too. FontForge will allow you to leave those fields blank, but other applications may not."));
+ /* no return, this is just a warning */
+ }
+
if ( *_GGadgetGetTitle(GWidgetGetControl(gw,CID_Revision))!='\0' )
sfntRevision = rint(65536.*GetReal8(gw,CID_Revision,_("sfnt Revision:"),&err));
if ( *_GGadgetGetTitle(GWidgetGetControl(gw,CID_WoffMajor))!='\0' ) {
diff --git a/fontforge/libffstamp.h b/fontforge/libffstamp.h
index 0d848236..b8170ef0 100644
--- a/fontforge/libffstamp.h
+++ b/fontforge/libffstamp.h
@@ -1,3 +1,3 @@
-#define LibFF_ModTime 1297387000L /* Seconds since 1970 (standard unix time) */
-#define LibFF_ModTime_Str "01:16 GMT 11-Feb-2011"
-#define LibFF_VersionDate 20110211 /* Year, month, day */
+#define LibFF_ModTime 1298069281L /* Seconds since 1970 (standard unix time) */
+#define LibFF_ModTime_Str "22:48 GMT 18-Feb-2011"
+#define LibFF_VersionDate 20110218 /* Year, month, day */
diff --git a/fontforge/parsettfatt.c b/fontforge/parsettfatt.c
index 94a3b426..8676bc68 100644
--- a/fontforge/parsettfatt.c
+++ b/fontforge/parsettfatt.c
@@ -2245,16 +2245,24 @@ return;
nid = getushort(ttf);
info->design_range_bottom = getushort(ttf);
info->design_range_top = getushort(ttf);
- if ( info->fontstyle_id == 0 && nid==0 &&
+ if ( info->fontstyle_id == 0 && nid==0 && info->design_size!=0 &&
info->design_range_bottom==0 && info->design_range_top==0 ) {
/* Reasonable spec, only design size provided */
info->fontstyle_name = NULL;
break;
}
- if ( info->design_size < info->design_range_bottom ||
+ if ( info->design_size==0 ||
+ info->design_size < info->design_range_bottom ||
info->design_size > info->design_range_top ||
- info->design_range_bottom > info->design_range_top ||
- nid<256 || nid>32767 )
+ info->design_range_bottom > info->design_range_top )
+ continue;
+ if ( info->fontstyle_id == 0 && nid==0 ) {
+ /* Not really allowed, but we'll accept it anyway */
+ /* If a range is provided than a style name is expected */
+ info->fontstyle_name = NULL;
+ break;
+ }
+ if ( nid<256 || nid>32767 )
continue;
info->fontstyle_name = FindAllLangEntries(ttf,info,nid);
if ( info->fontstyle_name==NULL )
diff --git a/fontforge/stamp.c b/fontforge/stamp.c
index 1756be1e..a39bd1be 100644
--- a/fontforge/stamp.c
+++ b/fontforge/stamp.c
@@ -1,5 +1,5 @@
#include <time.h>
-const time_t source_modtime = 1297427372L;
-const char *source_modtime_str = "12:29 GMT 11-Feb-2011";
-const char *source_version_str = "20110211";
+const time_t source_modtime = 1298069289L;
+const char *source_modtime_str = "22:48 GMT 18-Feb-2011";
+const char *source_version_str = "20110218";
diff --git a/fontforge/tottfgpos.c b/fontforge/tottfgpos.c
index 7e1405e6..f69d7bf8 100644
--- a/fontforge/tottfgpos.c
+++ b/fontforge/tottfgpos.c
@@ -3142,19 +3142,16 @@ return( NULL );
#endif
fseek(g___,size_params_loc,SEEK_SET);
putshort(g___,sf->design_size);
- if ( sf->fontstyle_id!=0 || sf->fontstyle_name!=NULL ||
- sf->design_range_bottom!=0 || sf->design_range_top!=0 ) {
+ if ( sf->fontstyle_id!=0 || sf->fontstyle_name!=NULL ) {
putshort(g___,sf->fontstyle_id);
at->fontstyle_name_strid = at->next_strid++;
putshort(g___,at->fontstyle_name_strid);
- putshort(g___,sf->design_range_bottom);
- putshort(g___,sf->design_range_top);
} else {
putshort(g___,0);
putshort(g___,0);
- putshort(g___,0);
- putshort(g___,0);
}
+ putshort(g___,sf->design_range_bottom);
+ putshort(g___,sf->design_range_top);
}
for ( i=0; i<ginfo.fcnt; ++i ) {
if ( ginfo.feat_lookups[i].name_param_ptr!=0 &&