[Therion] Multilingual Legend / Legend Formatting

Henry_Bennett at Dell.com Henry_Bennett at Dell.com
Mon Dec 7 10:49:58 CET 2015


Solved.

In case anyone else needs to do this, the trick is to modify the legendsymbolbox in the tex section of your thconfig.

\def\legendsymbolbox#1#2{%
  \setbox\tmpboxa=\hbox{\pdfrefxform#1}%
  \setbox\tmpboxb=\hbox{\the\legendtextsize(}%
  \legendsymbolwd=\wd\tmpboxa
  \legendsymbolht=\ht\tmpboxa
  \advance\legendsymbolht by -\ht\tmpboxb
  \advance\legendsymbolht by -\ht\tmpboxb
  \advance\legendsymbolht by -20pt
  \advance\legendsymbolht by -1dd
  \tmpdimen=\hsize
    \advance\tmpdimen by 10pt
    \divide\tmpdimen by\legendcolumns
    \advance\tmpdimen by-10pt
  \hbox to \tmpdimen{%
     \box\tmpboxa\kern10pt\raise\legendsymbolht\vtop{%
       \advance\tmpdimen by -\legendsymbolwd
       \advance\tmpdimen by -10pt
       \hsize=\tmpdimen\rightskip=0pt plus \tmpdimen minus 0pt\relax\the\legendtextsize #2\vskip1dd}\hss}%
}

The code above taken from thTMPDIR\data.tex was modified with the highlights to produce the desired effect

[cid:image004.png at 01D130D4.A0E5CDB0]

Henry Bennett

From: therion-bounces at speleo.sk [mailto:therion-bounces at speleo.sk] On Behalf Of Bennett, Henry
Sent: 03 December 2015 14:05
To: therion at speleo.sk
Subject: [Therion] Multilingual Legend / Legend Formatting

Hi,

Trying to produce a multilingual legend that shows two (or more) languages.

I thought I could simply use text substitution to achieve this in my thconfig file.

Source cave.th
text en "area sand"      "sand<br>darat"
text en "area water"     "water<br>danum"
export map ...

This works great except the formatting of the legend is borked.  As you can see the text is vertically aligned with the middle of the text against the top of the legend box.
[cid:image001.png at 01D130D3.797AF8F0]

th_legend.tex looks like this
\line{%
  \legendsymbolbox{\THLaaab}{\thfb\char119 \char97 \char108 \char108 \mainfont{}}\hskip10pt
  \legendsymbolbox{\THLaaaj}{\thfb\char99 \char104 \char105 \char109 \char110 \char101 \char121 \mainfont{}}\hskip10pt
  \legendsymbolbox{\THLaabh}{\vbox{\halign{#\hfil\cr\cr \thfb\char115 \char97 \char110 \char100 \cr\thfb \char100 \char97 \char114 \char97 \char116 \cr}}\mainfont{}}\hskip10pt
  \legendsymbolbox{\THLaacf}{\thfb\char112 \char111 \char105 \char110 \char116 \ \char115 \char116 \char97 \char108 \char97 \char99 \char116 \char105 \char116 \char101 \char115 \mainfont{}}\hskip10pt
\hss}

The legend boxes get drawn using metapost and the labels with TEX.  Although I can modify the metapost I can't see the template for the TEX.

Any ideas where I could modify the alignment?

Alternatively is there a way of specifying the legend language mid creation so I could have two legends, one for each language?

Regards,

Henry Bennett

Dell Corporation Limited is authorised and regulated in the UK by the Financial Conduct Authority for consumer credit brokerage.
Registered in England and Wales. Company Registration Number: 2081369
Registered address: Dell House, The Boulevard, Cain Road, Bracknell,  Berkshire, RG12 1LF, UK.
Company details for other Dell UK entities can be found on  www.dell.co.uk<http://www.dell.co.uk/>.
Dell Corporation Limited is authorised and regulated in the UK by the Financial Conduct Authority for consumer credit brokerage. 
Registered in England and Wales. Company Registration Number: 2081369
Registered address: Dell House, The Boulevard, Cain Road, Bracknell,  Berkshire, RG12 1LF, UK.
Company details for other Dell UK entities can be found on  www.dell.co.uk.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.speleo.sk/pipermail/therion/attachments/20151207/08659792/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 14863 bytes
Desc: image001.png
URL: <http://mailman.speleo.sk/pipermail/therion/attachments/20151207/08659792/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image004.png
Type: image/png
Size: 6640 bytes
Desc: image004.png
URL: <http://mailman.speleo.sk/pipermail/therion/attachments/20151207/08659792/attachment-0001.png>


More information about the Therion mailing list