- if (format) halign = format->align;
- else halign = StringAlignmentNear;
How are you handling the case where format is NULL?
How are you handling the case where format is NULL?
Never mind, I see what you're doing. But since the block where you now handle the horizontal alignment is inside an if (format->vertalign != StringAlignmentNear), this will break horizontal alignment when a vertical alignment is not set.