• Font
  • Family
  • Foundry
  • Designer
  • Sample
  • Article
  • Video
Fontke.com>Article>Details

To Subroutinize, Or Not To Subroutinize

Date:2012-02-03 13:19:07| News|Browse:0|Author:fontke
IntroductionOne of the benefits of OpenType/CFF, whether you're building name

One of the benefits of OpenType/CFF, whether you're building name-or CID-keyed fonts, is that the 'AFDKO makeotf tool can be used to apply subroutinization when building OpenType/CFF fonts. The tx tool, by using its "+S" option, can do so as well.

For name-keyed OpenType/CFF fonts, there are only global subroutines. For CID-keyed OpenType/CFF fonts, there are global and local subroutines. The global ones are shared by two or more FDArray elements (aka, hint dictionaries), and the local ones are specific to an FDArray element. How glyphs are assigned to an FDArray element can affect the distribution of global and local subroutines.

When subroutinizing smaller fonts, meaning those with relatively few glyphs, there really is no concern that subroutine limits will be reached. When the number of glyphs is significant, such as over 10,000, there is reason to be concerned because there are both implementation-specific and architecture limits on the number of subroutines. The architectural limit is "64K minus 3" (65,533), and there are known implementation-specific limits that are "32K minus 3" (32,765). The known implementations that limit the number of subroutines to "32K minus 3" are Mac OS X Version 10.4 (aka, Tiger) and earlier, and Adobe Acrobat Distiller Version 7.0 and earlier.

When dealing with name-keyed fonts, these subroutine limit figures are applied to the global subroutines, because there are no local ones. Things get a bit more complex with CID-keyed fonts because the number of subroutines is determined by adding the number of local subroutines for each FDArray element with the number of global ones. In other words, the combination of the global subroutines plus those from any one FDArray element (local) cannot exceed the limit.

The AFDKO tx tool can be used to display the number of global and local subroutines through the use of the appropriate command-line options. I spent yesterday evening writing subr-check.pl, which is a wrapper for tx that is written in Perl. The output below demonstrates why the Kozuka Mincho Pr6N family was released in unsubroutinized form:

%subr-check.pl KozMinPr6N-Regular.cff

Global Subroutines: 29933 (388715 bytes)

Local Subroutines:

FD=0: 1696 (36302 bytes)

FD=1: 154 (2530 bytes)

FD=2: 1633 (30574 bytes)

FD=3: 6 (120 bytes)

FD=4: 168 (1680 bytes)

FD=5: 65 (747 bytes)

FD=6: 151 (2327 bytes)

FD=7: 163 (2437 bytes)

FD=8: 60 (1058 bytes)

FD=9: 87 (1332 bytes)

FD=10: 1057 (109449 bytes)

FD=11: 7143 (173874 bytes) >32K-3 limit: 37076 (7143 + 29933)

FD=12: 1785 (41891 bytes)

FD=13: 807 (17851 bytes)

FD=14: 809 (17682 bytes)

FD=15: 181 (10099 bytes)

Total Subroutine Size: 838668 bytes

The subr-check.pl tool is expected to be included in the next release of AFDKO, which should happen this year. But, until then, developers can use this tool now.

0
MoreTo Subroutinize, Or Not To SubroutinizeFollow Fontke
To Subroutinize, Or Not To Subroutinize Comments
Tourist Please obey the rules of this website. Unclear?
To Subroutinize, Or Not To Subroutinize Latest comments
No relevant comments
Recommended comments