I would like to place a horizontal line immediately below some text. Is it possible to determine the distance between the baseline and lowest descender of a given font in Ghostscript, or is the descender length only a property of certain characters and the offset can only be found by eye?
In my example below, the moveto command shifts the 20pt text to 20 points from the upper edge of the figure, and a vertical line of length 20 points (included for comparison) looks like it corresponds to the baseline of the font.
gs -q -o test.pdf -sDEVICE=pdfwrite -dDEVICEWIDTHPOINTS=200 -dDEVICEHEIGHTPOINTS=100 -c "newpath 27 80 moveto 27 100 lineto 0.5 setlinewidth stroke /Helvetica findfont 20 scalefont setfont 3 80 moveto (gijlpqy) show showpage"
font bounding box, which is the maximum rectangle into which every glyph fits. With postscript, this is (xlower, ylower, xupper, yupper), so the second value of this array is the distance from the baseline to the lowest point of any character.FontBBox. Remember, PS fonts use 1000 units for one point. Or, if you are used to PS, you may extract this from the font in your program. It's more than 20 years I did this the last time, so please forgive me I can't help you more at the moment.