The PAPX is stored within FKPs and within the STSH.
b10 | b16 | field | type | size | bitfield | comment |
0 | 0 | cb | byte | count of bytes of following data in PAPX. The first byte of a PAPX is a count of bytes when a PAPX is stored in a STSH. Count of bytes is used because only paragraph sprms are stored in a STSH PAPX. | ||
0 | 0 | cw | byte | count of words for this byte and the following data in PAPX. The first byte of a PAPX is a count of words when PAPX is stored in an FKP. If this value is 0, it is a 'pad' byte and the count is stored in the following byte, Count of words is used because PAPX in an FKP can contain paragraph and table sprms. | ||
1 | 1 | (cw) | byte | if previous byte is 0, this is the count of words of following data in PAPX (not including this and previous 'pad' byte) | ||
1/2 | 1/2 | istd | uns short | index to style descriptor of the style from which the paragraph inherits its paragraph and character properties | ||
3/4 | 3/4 | grpprl | character array | a list of the sprms that encode the differences between PAP for a paragraph and the PAP for the style used. When a paragraph bound is also the end of a table row, the PAPX also contains a list of table sprms which express the difference of table row's TAP from an empty TAP that has been cleared to zeros. The table sprms are recorded in the list after all of the paragraph sprms. See Sprms definitions for list of sprms that are used in PAPXs. |
For calculating papx.cw when storing in a FKP: For even-sized grpprl's, the grpprl plus the istd and cw bytes will be an even number of bytes, so we store the count of words for all three elements in papx.cw. For odd-sized grpprl's, the three elements will be an odd number of bytes, which can't be represented with a count of words; so, we store a 'pad' byte of 0 at the beginning (in the normal cw location), followed by a count that is the size of the grpprl and istd byte only (since that's an even number of bytes). In either case, papx.cw is immediately followed by the istd and grpprl.