0

I'm creating a shipping label with NeoDynamic.SDK.ThermalLabel version 12. I'm trying to print out the following line: enter image description here

(minus the colored background)

The line has 3 different segments, each one with its own font size. The first 4 digits are defined as 24pt bold, the rest of the digits are 16pt, and the "x" at the end is 16pt bold. As you can see all 3 segments are aligned on the bottom.

My problem is I can't find a way to do the bottom alignment efficiently. The TextItem object from the NeoDynamic library allows horizontal alignment of text, (left/right/center) but it doesn't provide the option to align the text vertically. From experimenting with different sizing (while having the border visible) it seems that the text is always offset from the top (regardless of the object's size) and this offset is proportionate to the font size.

The SDK documentation mentions support for rich text formatting, so I thought I'd stick it all into one text item, and just define font sizes for each segment via rich text markup. But sadly only bold, italic and underline is supported. No variable font size it seems.

Right now the only option I have is to manually adjust the vertical offset of the two TextItem objects, little by little, until the texts are aligned (or close enough). This is a suboptimal solution, because if a request ever comes to change the font type or font sizes, I'll have to do the manual aligning all over again.

Is there a better way to do this? Or at least a formula that would allow me to calculate the correct offset based on the relative font sizes?

Shaggydog
  • 3,456
  • 7
  • 33
  • 50

0 Answers0