1

I want to horizontally align the first letter of a text node with a shape I've drawn.
In my example, I want the F to be horizontally pixel-aligned with the left side of the square.

The first step is to use inner sep = 0pt as option. However, because of side-bearing, the first letter might still not be perfectly aligned as it is the case in the example below.
"Of course", I'd like an automatic solution -- i.e. that do not require manual tuning (that already know how to do).

enter image description here

In his answer for another question, egreg show me how to use XeLaTeX to remove side bearings. However, since my picture is for a paper and its editor only accepts pdfLaTeX compiling, his solution cannot be used here.


MWE

(draw, help lines options in the code are for debugging purpose only)

\documentclass{scrartcl}
    \usepackage{helvet}
    \usepackage{tikz}
\begin{document}
    \begin{tikzpicture}
        \fill (-1.1,0) rectangle (-.1,1);
        \node [inner sep = 0pt, font=\sffamily, anchor = west] at (-1.1,1.25) {Ftest};

        \fill (0,0) rectangle (1,1);
        \node [inner sep = 0pt, draw, very thin, font=\sffamily, anchor = west] at (0,1.25) {Ftest};
    \end{tikzpicture}
\end{document}
ebosi
  • 11,692
  • 1
    pdftex has no information about the character other than four lengths height, depth, width, italic correction, it may be a black square or a white rectangle or look like an F so there is no way to avoid giving tex the corrections by hand, either on each instance or setting up a font-specific table of spacing corrections for each character. – David Carlisle Jul 22 '16 at 10:33
  • @DavidCarlisle well... it is not what I expected, but it does answer my question! – ebosi Jul 22 '16 at 10:38

1 Answers1

3

pdftex has no information about the character other than four lengths height, depth, width, italic correction, it may be a black square or a white rectangle or look like an F so there is no way to avoid giving tex the corrections by hand, either on each instance or setting up a font-specific table of spacing corrections for each character

David Carlisle
  • 757,742