UFO import metrics fixes

View: New views
1 Messages — Rating Filter:   Alert me  

UFO import metrics fixes

by Martin Hosken :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Dear All,

I enclose a patch to fix up some of the errors in fontinfo.xml particularly in the area of metrics when round tripping fonts in UFO between robofab and fontlab.

Yours,
Martin

[fontforge-hg_rev5078.patch]

# HG changeset patch
# User Martin Hosken <martin_hosken@...>
# Date 1254964975 -25200
# Branch mhosken
# Node ID 00fa00d5781362cb6fe7d97a7c600f9a85b17259
# Parent  ae285801e2d0d1afa939faa65c6f0d3294ea7c05
Fix UFO import export of metrics data

diff -r ae285801e2d0 -r 00fa00d57813 fontforge/ufo.c
--- a/fontforge/ufo.c Wed Sep 16 07:45:47 2009 +0000
+++ b/fontforge/ufo.c Thu Oct 08 08:22:55 2009 +0700
@@ -561,13 +561,13 @@
     PListOutputInteger(plist,"openTypeOS2TypoDescender",sf->pfminfo.os2_typodescent);
  PListOutputInteger(plist,"openTypeOS2TypoLineGap",sf->pfminfo.os2_typolinegap);
  if ( sf->pfminfo.winascent_add )
-    PListOutputInteger(plist,"openTypeOS2WinAscender",bb.maxy+sf->pfminfo.os2_winascent);
+    PListOutputInteger(plist,"openTypeOS2WinAscent",bb.maxy+sf->pfminfo.os2_winascent);
  else
-    PListOutputInteger(plist,"openTypeOS2WinAscender",sf->pfminfo.os2_winascent);
+    PListOutputInteger(plist,"openTypeOS2WinAscent",sf->pfminfo.os2_winascent);
  if ( sf->pfminfo.windescent_add )
-    PListOutputInteger(plist,"openTypeOS2WinDescender",bb.miny+sf->pfminfo.os2_windescent);
+    PListOutputInteger(plist,"openTypeOS2WinDescent",bb.miny+sf->pfminfo.os2_windescent);
  else
-    PListOutputInteger(plist,"openTypeOS2WinDescender",sf->pfminfo.os2_windescent);
+    PListOutputInteger(plist,"openTypeOS2WinDescent",sf->pfminfo.os2_windescent);
     }
     if ( sf->pfminfo.subsuper_set ) {
  PListOutputInteger(plist,"openTypeOS2SubscriptXSize",sf->pfminfo.os2_subxsize);
@@ -1739,11 +1739,13 @@
  else
     free(valname);
     } else if ( strncmp((char *) keyname, "openTypeHhea",12)==0 ) {
- if ( _xmlStrcmp(keyname+12,(xmlChar *) "Ascender")==0 )
+ if ( _xmlStrcmp(keyname+12,(xmlChar *) "Ascender")==0 ) {
     sf->pfminfo.hhead_ascent = strtol((char *) valname,&end,10);
- else if ( _xmlStrcmp(keyname+12,(xmlChar *) "Descender")==0 )
+            sf->pfminfo.hheadascent_add = false;
+ } else if ( _xmlStrcmp(keyname+12,(xmlChar *) "Descender")==0 ) {
     sf->pfminfo.hhead_descent = strtol((char *) valname,&end,10);
- else if ( _xmlStrcmp(keyname+12,(xmlChar *) "LineGap")==0 )
+            sf->pfminfo.hheaddescent_add = false;
+ } else if ( _xmlStrcmp(keyname+12,(xmlChar *) "LineGap")==0 )
     sf->pfminfo.linegap = strtol((char *) valname,&end,10);
  free(valname);
  sf->pfminfo.hheadset = true;
@@ -1754,9 +1756,10 @@
  free(valname);
     } else if ( strncmp((char *) keyname,"openTypeOS2",11)==0 ) {
  sf->pfminfo.pfmset = true;
- if ( _xmlStrcmp(keyname+11,(xmlChar *) "Panose")==0 )
+ if ( _xmlStrcmp(keyname+11,(xmlChar *) "Panose")==0 ) {
     UFOGetByteArray(sf->pfminfo.panose,sizeof(sf->pfminfo.panose),doc,value);
- else if ( _xmlStrcmp(keyname+11,(xmlChar *) "Type")==0 )
+            sf->pfminfo.panose_set = true;
+ } else if ( _xmlStrcmp(keyname+11,(xmlChar *) "Type")==0 )
     sf->pfminfo.fstype = UFOGetBits(doc,value);
  else if ( _xmlStrcmp(keyname+11,(xmlChar *) "FamilyClass")==0 ) {
     char fc[2];
@@ -1768,17 +1771,21 @@
     sf->pfminfo.weight = strtol((char *) valname,&end,10);
  else if ( _xmlStrcmp(keyname+11,(xmlChar *) "VendorID")==0 )
     memcpy(sf->pfminfo.os2_vendor,valname,4);
- else if ( _xmlStrcmp(keyname+11,(xmlChar *) "TypoAscender")==0 )
+ else if ( _xmlStrcmp(keyname+11,(xmlChar *) "TypoAscender")==0 ) {
+            sf->pfminfo.typoascent_add = false;
     sf->pfminfo.os2_typoascent = strtol((char *) valname,&end,10);
- else if ( _xmlStrcmp(keyname+11,(xmlChar *) "TypoDescender")==0 )
+ } else if ( _xmlStrcmp(keyname+11,(xmlChar *) "TypoDescender")==0 ) {
+            sf->pfminfo.typodescent_add = false;
     sf->pfminfo.os2_typodescent = strtol((char *) valname,&end,10);
- else if ( _xmlStrcmp(keyname+11,(xmlChar *) "TypoLineGap")==0 )
+ } else if ( _xmlStrcmp(keyname+11,(xmlChar *) "TypoLineGap")==0 )
     sf->pfminfo.os2_typolinegap = strtol((char *) valname,&end,10);
- else if ( _xmlStrcmp(keyname+11,(xmlChar *) "WinAscender")==0 )
+ else if ( _xmlStrcmp(keyname+11,(xmlChar *) "WinAscent")==0 ) {
+            sf->pfminfo.winascent_add = false;
     sf->pfminfo.os2_winascent = strtol((char *) valname,&end,10);
- else if ( _xmlStrcmp(keyname+11,(xmlChar *) "WinDescender")==0 )
+ } else if ( _xmlStrcmp(keyname+11,(xmlChar *) "WinDescent")==0 ) {
+            sf->pfminfo.windescent_add = false;
     sf->pfminfo.os2_windescent = strtol((char *) valname,&end,10);
- else if ( strncmp((char *) keyname+11,"Subscript",9)==0 ) {
+ } else if ( strncmp((char *) keyname+11,"Subscript",9)==0 ) {
     sf->pfminfo.subsuper_set = true;
     if ( _xmlStrcmp(keyname+20,(xmlChar *) "XSize")==0 )
  sf->pfminfo.os2_subxsize = strtol((char *) valname,&end,10);


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Fontforge-devel mailing list
Fontforge-devel@...
https://lists.sourceforge.net/lists/listinfo/fontforge-devel