from_string


Description:

[ Version ( since = "0.9.5" ) ]
public static Bool from_string (uint8[] str, out unowned Feature feature)

Parses a string into a Feature.

The format for specifying feature strings follows. All valid CSS font-feature-settings values other than 'normal' and the global values are also accepted, though not documented below. CSS string escapes are not supported.

The range indices refer to the positions between Unicode characters. The position before the first character is always 0.

The format is Python-esque. Here is how it all works:

<informaltable pgwide='1' align='left' frame='none'> <tgroup cols='5'> <thead> <row><entry>Syntax</entry > <entry>Value</entry> <entry>Start</entry> <entry>End</entry></row> </thead> <tbody > <row><entry>Setting value:</entry></row> <row><entry>kern</entry> <entry>1</entry > <entry>0</entry> <entry>∞</entry> <entry>Turn feature on</entry></row> <row>< entry>+kern</entry> <entry>1</entry> <entry>0</entry> <entry>∞</entry> <entry>Turn feature on</entry></row> <row><entry>-kern</entry> <entry>0</entry> <entry>0</entry> <entry>∞</entry> <entry>Turn feature off</entry></row> <row><entry>kern=0</entry> < entry>0</entry> <entry>0</entry> <entry>∞</entry> <entry>Turn feature off</entry></row > <row><entry>kern=1</entry> <entry>1</entry> <entry>0</entry> <entry>∞</entry> <entry>Turn feature on</entry></row> <row><entry>aalt=2</entry> <entry>2</entry> < entry>0</entry> <entry>∞</entry> <entry>Choose 2nd alternate</entry></row> <row><entry >Setting index:</entry></row> <row><entry>kern[]</entry> <entry>1</entry> <entry>0< /entry> <entry>∞</entry> <entry>Turn feature on</entry></row> <row><entry>kern[:]</entry > <entry>1</entry> <entry>0</entry> <entry>∞</entry> <entry>Turn feature on</entry> </row> <row><entry>kern[5:]</entry> <entry>1</entry> <entry>5</entry> <entry>∞< /entry> <entry>Turn feature on, partial</entry></row> <row><entry>kern[:5]</entry> <entry>1 </entry> <entry>0</entry> <entry>5</entry> <entry>Turn feature on, partial</entry></row> <row><entry>kern[3:5]</entry> <entry>1</entry> <entry>3</entry> <entry>5</entry> <entry>Turn feature on, range</entry></row> <row><entry>kern[3]</entry> <entry>1</entry> <entry>3</entry> <entry>3+1</entry> <entry>Turn feature on, single char</entry></row> <row ><entry>Mixing it all:</entry></row> <row><entry>aalt[3:5]=2</entry> <entry>2</entry> <entry>3</entry> <entry>5</entry> <entry>Turn 2nd alternate on for range</entry></row> < /tbody> </tgroup> </informaltable>

Parameters:

str

a string to parse

feature

the Feature to initialize with the parsed values

len

length of str, or -1 if string is `NULL` terminated

Returns:

`true` if str is successfully parsed, `false` otherwise