Moving to version 1.0
Version 1.0 of Xgridfit alters some aspects of the language. A few changes are obligatory; otherwise, older Xgridfit programs will continue to compile correctly, and it should be possible to mix old syntax and semantics with new in ongoing projects. This document summarizes the changes.
Though it is possible to use existing Xgridfit files with few alterations, Xgridfit 1.0 is accompanied by a utility, xgfupdate, that converts existing files to the new format. Simply run the following command, being careful not to overwrite the old file:
xgfupdate oldfile.xgf > newfile.xgf
These commands will convert a batch of Xgridfit files:
mkdir new for f in *.xgf; do xgfupdate $f > new/$f; done
If you have XMLStarlet installed on your system, xgfupdate will format the new file attractively; otherwise it will leave you with a valid file which is messy in some places.
The following sections outline the changes to the language in version 1.0.
Use name attribute to name things
Earlier versions of Xgridfit inconsistently used name and id attributes to name things. To refer to named elements, it used function-id in function calls, macro-id in macro calls, and param-id in passing parameters to functions and macros. In version 1.0 is it recommended to use name everywhere, including these elements which formerly used other attributes:
<function name="my-func"> <macro name="my-macro"> <control-value name="my-cv" value="235"/> <variable name="my-var"/> <call-function name="my-func"> <with-param name="my-function-param"/> </call-function> <call-macro name="my=macro"> <with-param name="my-macro-param"/> </call-macro>
The older attributes will continue to work except in <control-value>, <function> and <macro>. For these, id must be changed to name. The obligatory changes enable fast indexing of these elements.
<default type="max-instructions"> is deprecated
This <default> type is used only by older versions of Xgridfit running in TTX mode. Since this mode is no longer supported, the <default> type has no function.
<asm> no longer permitted
The <asm> element was used only in TTX mode, which is no longer supported. Therefore <asm> elements must be converted to <command> elements. To do this locate the sed script convert-asm.sed (Linux users will find it either in /usr/share/xgridfit/utils/ or /usr/local/share/xgridfit/utils/) and run it as follows:
sed -f /usr/local/share/xgridfit/utils/convert-asm.sed oldfile.xgf > newfile.xgf
The result will be an Xgridfit file that is valid for FontForge mode.
Use value instead of num attribute with <constant>
For consistency with <control-value> and <param>, the num attribute on the <constant> element has been deprecated; value should be used instead.
Container elements are deprecated
Older versions of Xgridfit required the use of certain elements whose only function was to contain other elements: <profile>, <control-values>, <functions>, <macros>, <declarations>, <variables>, <params>. These elements are no longer required, though they may continue to be used. The elements they originally contained must remain in their former positions if you use the transitional schema (xgridfit-transitional.rnc). If you use the strict schema (xgridfit-strict.rnc), Xgridfit is not so fussy about order: top-level elements (children of <xgridfit>) can come in any order.
<param-set> not always needed
<call-function> and <call-macro> elements formerly could contain only <param-set> elements, which could contain <with-param> elements. But <param-set> is a device for grouping parameters when a function is to be called repeatedly via LOOPCALL, or when macro code is to be inserted repeatedly. It seems unnecessary when a function or macro is to be called just once. In version 1.0, <param-set> is needed only when a single <call-function> or <call-macro> contains more than one set of parameters; otherwise <with-param> elements can be the children of <call-function> or <call-macro>.