[mpeg-OTspec] Creating ReqFeatureIndex in real fonts?

Adam Twardoch (List) list.adam at twardoch.com
Thu Aug 30 22:25:36 CEST 2012


On 12-08-30 20:49, Thomas Phinney wrote:
>  
>
> I have a different question about ReqFeatureIndex.
>
> I am collaborating on a special-purpose font, whose entire purpose is
> tied up in having ligatures work. It is useless without them. It seems
> to me like as a practical matter, ReqFeatureIndex would be a good way
> to make those ligatures work in more environments, at least in
> versions of Windows and Office that might not otherwise support those
> ligatures.
> What tools actually support making fonts with ReqFeatureIndex? I'm
> happy using FontLab Studio. AFDKO would not be the ideal workflow for
> this project, but is possible. I would be fine with learning VOLT. I'd
> use FontForge if scary weapons were pointed at me, or I had no
> alternative.
You'll certainly be able to use FontTools/TTX and set the
ReqFeatureIndex in the post-production step.

Regardless of which tool you use to build the GSUB and GPOS tables, you
would then run

  ttx -t GSUB myfont.otf

which will yield you a "myfont.ttx" file which will contain the GSUB
table. Inside, you'll find something like this:

  <GSUB>
    <Version value="1.0"/>
    <ScriptList>
      <ScriptRecord index="0">
        <ScriptTag value="latn"/>
        <Script>
          <DefaultLangSys>
            <ReqFeatureIndex value="65535"/>
            <FeatureIndex index="0" value="7"/>
            <FeatureIndex index="1" value="6"/>
            <FeatureIndex index="2" value="12"/>
            <FeatureIndex index="3" value="25"/>
            ...
            </LangSys>
          </LangSysRecord>
        </Script>
      </ScriptRecord>
    </ScriptList>
    <FeatureList>
      ...
      <FeatureRecord index="12">
        <FeatureTag value="liga"/>
        <Feature>
          <LookupListIndex index="0" value="37"/>
          <LookupListIndex index="1" value="38"/>
        </Feature>
      </FeatureRecord>

If you change the line
            <ReqFeatureIndex value="65535"/>
to
            <ReqFeatureIndex value="2"/>
then FeatureIndex 2 will be the ReqFeatureIndex. FeatureIndex 2 points
to FeatureRecord 12, and FeatureRecord 2 implements the "liga" feature
with two lookups.

So basically, you'll need to locate the FeatureRecord for the feature
entry that you're interested in, then look up its reference in the
appropriate languagesystem list, and then just set the FeatureIndex of
that record as the ReqFeatureIndex for that languagesystem.

It's relatively easy.

Then you just run

  ttf -m myfont.otf myfont.ttx

and you'll get myfont#1.otf, which will have the modified GSUB table.

Best,
Adam

-- 

May success attend your efforts,
-- Adam Twardoch
(Remove "list." from e-mail address to contact me directly.)




More information about the mpeg-otspec mailing list