Hello everyone. I know this is not specifically inkscape related, but i thought maybe someone here may help.
Please consider this simple code:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> <svg id="svg_root" width="26in" height="16in" viewBox="0 0 26 16" xmlns="http://www.w3.org/2000/svg" xml:space="preserve" shape-rendering="geometricPrecision" text-rendering="geometricPrecision" image-rendering="optimizeQuality" fill-rule="evenodd" clip-rule="evenodd" xmlns:xlink="http://www.w3.org/1999/xlink">
<line id="line_obj" x1="0" y1="8" x2="26" y2="8" stroke-width="0.1" stroke="#000000"/> <text id="text_obj" transform="translate(13,8)" style="font-size: 4; font-family: 'Times New Roman'; font-style: italic; font-weight: bold; fill: #FF0000; stroke: none;">for</text>
</svg>
It simply draws a line, and a text "sitting" on it. Obviously the "f" letter, which is a descender, goes below the line.
Actually the text location (13,8) determines the placement related to the baseline of the font: i'd like to place at (13,8) the REAL bottom-left corner of the font. So, simply valign to bottom instead of baseline, or move up the text item by descender's amount.
I have to do this in scripting, as this is part of a PHP script which invokes inkscape to manage the SVG file. I was only able to imagine 2 solutions, but was not able to apply any of them. So here they are:
1) is there any SVG option, recognized by inkscape as well, that permits this? In SVG specs i saw the "dominant-baseline" and other baseline related params, but none seems to have effect in inkscape
2) can you think at any way to calc the descender offset via scripting? Something like a function: get_descent(fontfile,is_italic,is_bold,textline) Which , i thins case, would look like get_descent("/pathtofonts/times.ttf",1,1,"for")
Hope someone can help in some way, every suggestion will be really appreciated.
Alex