Answer the question
In order to leave comments, you need to log in
How can I find out the exact length of the printed text?
Good day ...
There is a Zebra p430i card printer, a .NET program that should print on it and a problem with text alignment, which is as follows:
there are several texts right-aligned in the area from 10 to 50 mm, the texts are printed in different styles and fonts, while the right edges of the texts should be at the same level, but in reality there is an offset from a millimeter to 2, depending on the fonts and styles ... I tried to align both using the printer and the Graphics object created from the graphics context of the printer, the results are zero ... And, accordingly, the question is whether it is possible to somehow find out the exact dimensions of the line that will be printed in order to make corrections when printing, or how - to align the text pixel by pixel? At the same time, it is advisable not to go into the wilds of fonts ... I have already tried options with MeasureString and MeasureCharacterRanges, the size is only approximate ...
Answer the question
In order to leave comments, you need to log in
Are you sure you're doing everything right? I somehow solved a similar problem and there were no such problems. Try drawing the layout on the form/panel and see if the offset remains?
If yes, then the matter is probably in the features of the fonts, in this case you can try to manually find the indent of the text relative to the left edge and adjust the position.
If not, then look at the parameters of hinting and all sorts of printer enhancers.
In fact, a lot depends on the fonts, monospace fonts, for example, in addition to the letter itself, they also take into account the gap in the width calculations, that is, the same point will have the width of the letter w, and there is no getting around it =)
And if you print a geometric figure of a given size, does it come out as specified, or does it float?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question