TestPlan20-AuthoringTool

From Fonts WG

Plan for testing all the assertions which apply to Authoring Tools for WOFF 2.0. The majority of these could be tested by a paired validation tool which compares an sfnt font with a woff (2.0) font.

Text color highlights on this page are as follows: red text indicates questions that need to be addressed by the Working Group, gray text indicates portions of the test suite that are not yet implemented and blue text indicates initial ideas about how the tests can be presented to User Agents.

Testable Assertions

mustReorderGlyfLoca

Create a font collection. Encode the font. Looking at the Brotli-decompressed bytestream from the WOFF2 font, ensure the glyf and loca tables are paired. This can't be tested on a fully decoded font, because the decoder is not required to keep them in paired order.

mustEmitSingleEntryDirectory

Create a font collection with a particular, known shared table. Encode the font. Looking at the Brotli-decompressed bytestream from the WOFF2 font, ensure the table is not duplicated in the bytestream.

mustNotDuplicateTables

Input collection file is minimal number of tables with all tables shared. Output WOFF must not contain duplicate tables, which we check for by ensuring all the index tables are the same.

mustTransformMultipleGlyfLoca

An input font file containing two non-shared pairs of 'glyf'/'loca' tables is converted to WOFF 2.0 format. The validator parses the output file and for all 'glyf' and 'loca' tables present, checks that

  • transform length fields are present, and
  • the transformed length of the 'glyf' table is smaller than the original length, and
  • the transformed length of the 'loca' table is zero.

mustVerifyGlyfLocaShared

Create two font collection files - one containing two fonts that share a pair of 'glyf'/'loca' tables, and the second one containing three fonts where two fonts share a pair of 'glyf'/'loca' tables and the third one having its own set of 'glyf'/'loca' tables. Test is passed if the authoring tool generates two WOFF2 font files and both of them pass the validator test. The validator must check that in the second case (three fonts in a font collection) the 'glyf'/'loca' tables form associated pairs.

mustRejectSingleGlyfLocaShared

Create two font collection files, both containing two fonts. One font collection shares the 'glyf' table but does not share the 'loca' table (instead, it contains two separate 'loca' tables, where one can simply be a copy of the other). The second font collection shares the 'loca' table but does not share the 'glyf' table (instead, it contains two separate 'glyf' tables, where one can simply be a copy of the other). Test is passed if the authoring tool rejects the input files and does not generate the WOFF2 font in both cases. (Preferably with some sort of explanatory error message, although that is not required to pass the test).

mustPreserveFontOrder

Create a font collection whose fonts are not in alphabetical order (probably the most likely reordering would be alphabetical). Encode and then decode the font. Compare to ensure the fonts are still in the same order. This test does depend on knowing that the decoder, which is not being tested, preserves ordering.

mustRecordCollectionEntryIndex

Create a font collection and convert to woff2. Verify that every collection table entry has a valid (within the range of [0..(numEntries-1)]) table directory index and that every table directory entry is referenced from at least one CollectionFontEntry.

mustRemoveDSIG

Create a font which contains a DSIG table. Encode and then decode the font. Ensure the DSIG table is not present.

mustSetBit11

Round-trip a font (encode and then decode) and then verify that bit 11 it set.

mustCalculateOmitBBoxValues

Create a font with two glyphs - one where bounding box is defined by extrema points of the outline on-curve points, and another glyph where the outline has off-curve points placed outside of the contour outline box. Both glyphs should have the bounding box info encoded so that it matches the max/min positions of the control points. Once a font is processed by a WOFF2 encoder - verify that the encoded data stream has:

  • bboxBitmap values are all zeros, and
  • bboxStream is empty.

mustCalculateSetBBoxValues

Create a font with two glyphs - one where bounding box is defined by on-curve points of the outline, and another glyph where the outline has off-curve points placed outside of the contour outline box. Both glyphs should have the bounding box info encoded so that it doesn't match the max/min positions of the control points. Once a font is processed by a WOFF2 encoder - verify that the encoded data stream has:

  • bboxBitmap values are all ones, and
  • bboxStream has proper bbox values encoded in it.

mustSetCompositeBBoxValues

Same as above, adding a third composite glyph that consist of the two previous glyph outlines. Once a font is processed by a WOFF2 encoder - verify that the encoded data stream has:

  • bboxBitmap values are all ones, and
  • bboxStream has proper bbox values encoded in it.

mustRejectNonEmptyBBox

Create a font containing at least one 0-contour glyph that has a bounding box with non-zero entries. Test is passed if the authoring tool rejects the input files and does not generate the WOFF2 font in both cases. (Preferably with some sort of explanatory error message, although that is not required to pass the test).

mustClearEmptyBBox

Create a font containing at least two glyphs - one empty glyph (with only loca table entry present and no glyph record) and one '0-contour' glyph that has a bounding box with all-zero entries. Once a font is processed by a WOFF2 encoder - verify that the encoded data stream has:

  • bboxBitmap values are all zeros, and
  • bboxStream is empty.

mustCheckLeftSideBearings

See test below that covers this requirement.

mustEliminateLSBs

Create a font with two proportional and two monospaced glyphs with left side bearings matching the Xmin values of each corresponding glyph bonding box (the font should have three 'hmtx' entries encoded as part of the hMetrics array and the last entry encoded in leftSideBearing array). Once a font is processed by a WOFF2 encoder - verify that the encoded data stream has:

  • transformed 'hmtx' table with the transform version number set to "1", and
  • where both lsb[] and leftSideBearing[] arrays are eliminated with corresponding Flags bits set.

mustCheckLSBAllGlyfTables

Create a font collection file with two 'glyf' tables having equal number of glyphs where all glyphs have xMin = 0, and one shared 'hmtx' table with all lsb = 0. Convert the input file to woff2 selecting hmtx transform as a desired option and verify that the 'hmtx' table conversion has been applied.

mustNotApplyLSBTransformForOTC

Create a font collection file with two 'glyf' tables having equal number of glyphs where all glyphs of the first 'glyf' table have xMin = 0 and some glyphs in the second 'glyf' table have xMin != 0. Include one shared 'hmtx' table with all lsb = 0. Convert the input file to woff2 selecting hmtx transform as a desired option and verify that the 'hmtx' table conversion has NOT been applied.

mustUseKnownTags

Create a font with all tables in the "Known Table Tags" table. Output WOFF2 table directory must use known table flag for all tables in the font.

Create a font with some tables in the "Known Table Tags" table. Output WOFF2 table directory must use known table flag for tables in the "Known Table Tags" table.