ttfeatparms - adds feature parameters to Opentype stylistic set or character variants features


ttffeatparms [-d] [-c control.xml] infile.ttf outfile.ttf

Opens infile.ttf for reading, deletes existing feature parameters and/or adds new ones based on control file values, then writes the modified file to outfile.ttf.


  -c file    Specifies the xml control file to use
  -d         Deletes all GSUB feature parameters from the font
  -h         Help

If both -c and -d are specified, all existing parameters are deleted prior to applying the control file values.


ttffeatparms works with existing stylistic set or character variants features within a font. The features themselves should have been previously added to the font. Where feature parameters point to name strings, it will re-use pre-existing name strings in the font if they exist, or add the name strings in if needed. If feature parameters already exist for a feature, they will be updated to the values in the control file.

If there are multiple features with the same name, the same parameters will be used for all those features, eg if there are two ss01 features (for different scripts and/or languages) they will both have the same feature parameters.

Control file Format

The DTD for the control file is:

    <!ELEMENT sset (name)>
        <!ATTLIST sset feat CDATA #REQUIRED

    <!ELEMENT cvar (name*, npstring*)>

        <!ATTLIST cvar 
            feat CDATA        #REQUIRED
            characters  CDATA #IMPLIED
            numparam CDATA    #IMPLIED
            firstid  CDATA    #IMPLIED>

    <!ELEMENT name (nstring*)>
        <!ATTLIST name
            type CDATA "uilabel"
            id CDATA #IMPLIED>

    <!ELEMENT nstring (#PCDATA)>
        <!ATTLIST nstring lang  CDATA "en">

    <!ELEMENT npstring (#PCDATA)>
        <!ATTLIST npstring lang  CDATA "en">

name elements must be uilabel, which is the default


name elements can be uilabel, tooltip or sampletext

npstrings, if supplied, are for named parameters. numparam is only used if no npstrings are supplied

characters is a csv list. The character cound will be based on the number of characters supplied

name strings and name IDs

For both nstring and npstring elements, if an id is specified (by either id or firstid) then that id is used (without checking existing name strings for the id). If id and strings are supplied, then any existing name strings will be replaced by those supplied.

If no id is supplied, existing name strings will be reused if they match the supplied strings; otherwise new name strings will be added to the name table.

name string languages

English language strings must be supplied, and they are used for string matching purposes. If other language strings are also supplied, they will be inserted using the same nameid of the English string.

Sample Control File

    <?xml version="1.0" encoding="UTF-8"?>


      <sset feat="ss01">
        <name><nstring>UI string for ss01</nstring></name>

      <sset feat="ss02">
          <nstring lang="en">UI string for SS02</nstring>
          <nstring lang="fr">nom de ss02</nstring>

      <sset feat="ss03">
        <name id="1234"/>

      <cvar feat="cv01">
        <name><nstring>Jha alternates</nstring></name>
        <name type="tooltip"><nstring>Tooltip for cv01</nstring></name>
        <npstring lang="en">First named param for cv01</npstring>
        <npstring lang="en">Second named param for cv01</npstring>
        <npstring lang="en">Third named param for cv01</npstring>
        <npstring lang="fr">Premier paramètre nommé pour cv01</npstring>
        <npstring lang="fr">Deuxième  paramètre nommé pour cv01</npstring>
        <npstring lang="fr">Troisième paramètre nommé pour cv01</npstring>



Could share featureparam structure for the same cvxx/ssxx feature in multiple languages or scripts, but instead builds separate structure for each.


Martin Hosken (see CONTRIBUTORS for other authors).


Copyright (c) 1998-2016, SIL International (

This script is released under the terms of the Artistic License 2.0. For details, see the full text of the license in the file LICENSE.