Personally I'd use
$horizontalAlign = (0x07 & ord($data[$pos+10])) >> 0;
rather than
$horizontalAlign = ord($data[$pos+10]) & 3;
because you can then match the mask (0x07) up with the spec definition more obviously
Using the same principle, vertical alignment is bits 6-4, mask 0x70, so
$verticalAlign = (0x70 & ord($data[$pos+10])) >> 4;
switch ($verticalAlign) {
case 0:
// VERTICAL_TOP
break;
case 1:
// VERTICAL_CENTER
break;
case 2:
// VERTICAL_BOTTOM
break;
case 3:
// VERTICAL_JUSTIFY
break;
case 4:
// VERTICAL_DISTRIBUTED
break;
}
PS. Why are you still using Open Office's partial spec, when Microsoft have published the full specification