2.4.6.2 Direct Character Formatting

This section specifies how to find the properties applied directly to a given character position cp. The result will be an array of Prl elements that specify the property modifications to be applied.

Additional formatting and properties can affect that cp as well, if a style is applied. To determine the full set of properties, including those from styles, see section 2.4.6.6 Determining Formatting Properties.

  1. Follow the algorithm from Retrieving Text. From step 5 or 6, determine the offset in the WordDocument Stream where text was found. Call this offset fc. Also remember from step 4, the Pcd. If the algorithm from Retrieving Text specifies cp is invalid, leave the algorithm.

  2. Read a PlcBteChpx at offset FibRgFcLcb97.fcPlcfBteChpx in the Table Stream, and of size FibRgFcLcb97.lcbPlcfBteChpx.

  3. Find the largest i such that plcbteChpx.aFc[i] ≤ fc. If the last element of plcbteChpx.aFc is less than or equal to fc, then cp is outside the range of character positions in this document, and is not valid. Read a ChpxFkp at offset aPnBteChpx[i].pn *512 in the WordDocument Stream.

  4. Find the largest j such that ChpxFkp.rgfc[j] fc. If the last element of ChpxFkp.rgfc is less than or equal to fc, then cp is outside the range of character positions in this document, and is not valid. Find a Chpx at offset ChpxFkp.rgb[i] in ChpxFkp.

  5. The grpprl within the Chpx is an array of Prls that specifies the direct properties of this character.

  6. Additionally, apply Pcd.Prm which specifies additional properties for this text. If Pcd.Prm is a Prm0 and the Sprm specified within Prm0 modifies a character property (a Sprm with an sgc value of 2), append a single Prl made of the Sprm and value in that Prm0 to the array of Prls from the previous step. If Pcd.Prm is a Prm1, append any Sprms that modify character properties from the array of Prls specified by Prm1.