1

I want to transform one letter on a title page in a very specific way. To illustrate the effect I'm trying to accomplish, I've attached an image. Notice how the left half of the letter H is shorter than the right half, yet the top of the letter is level. I suspect I'll want to distort it in some way using tikz, but I'm not sure how I would accomplish this. Can anyone help?

Stretched letter H

  • In a few answers here, including https://tex.stackexchange.com/a/51462/86 , I've developed code for turning letters into TikZ nodes. Would that help with what you're trying to do? – Andrew Stacey Nov 05 '20 at 07:10
  • @Andrew Stacey, thanks. I know how to turn letters into tikz nodes already, but need help accomplishing this specific transformation. – Crankycyclops Nov 05 '20 at 07:41
  • TikZ can do scale, stretch, slant and rotate canvas transformations, but not perspective. Why not just recreate the shape with curves. -e.g. in an external vector drawing program like inkscape. – hpekristiansen Nov 05 '20 at 08:29
  • 1
    Metapost supports transformations, if you accept an alternative to TikZ. –  Nov 05 '20 at 09:10
  • @Jairo A. del Rio, If Metapost will get the job done, I'm all for it. – Crankycyclops Nov 05 '20 at 17:01
  • @Crankycyclops If you already know how to turn letters into nodes then that would have been good information to put in your question, with code that can be run. As it stands, it isn't clear from your question what level of code would be acceptable. Also, TikZ can handle non-linear transformations like perspective just fine. – Andrew Stacey Nov 05 '20 at 17:14
  • 1

1 Answers1

2

Disclaimer: This is NOT a TikZ answer, but whatever...

Taking Thruston's answer to this question concerning text outlines as reference, you could do the following to get a deformed H letter. It's a proof of concept, so it only works with individual letters, but it's possible to adapt it to full words with further tweaking.

\documentclass{standalone}
\usepackage[latex,shellescape]{gmp}
\begin{document}
\begin{mpost}[name=H]
picture nice;
path P, PP;

nice := image(draw thelabel(\btex H etex,origin));

%Transformation vardef T(expr p) = save x, y; x := xpart p; y := ypart p; %0.01 by guessing. Play with other values (x,0.01x*y) enddef;

%Assumes a cyclic path %It can be done better vardef TT(expr P) = T(point 0 of P) .. controls T(postcontrol 0 of P) and T(precontrol 1 of P) for j = 1 upto (length P - 1): .. T(point j of P) .. controls T(postcontrol j of P) and T(precontrol (j+1) of P) endfor .. cycle enddef;

for i within nice: if textual i: for j = 1 upto length textpart i: string s; s := substring(j-1,j) of textpart i; picture g; g := glyph ASCII s of fontpart i scaled 1/10; picture r; r := image( for x within g: picture xx; xx := image(draw g); %75 is also guessing. Try other values %Bad filling. It works for the letter H, tho. fill TT(pathpart x shifted (llcorner xx - ulcorner xx + 75right)) withcolor if greypart x = 1: 1 else: (1,0.843,0) fi; endfor ); draw r; endfor fi endfor \end{mpost}\usempost{H}% \end{document}

enter image description here

For comparison, this is the result for the letter Q (applies a fake unfilling):

enter image description here