[Tikzdevice-bugs] metapost device: problem with calculating font space?

Charlie Sharpsteen chuck at sharpsteen.net
Fri Apr 22 07:52:06 CEST 2011


On Thu, Apr 21, 2011 at 2:57 AM, Matthieu Stigler <
matthieu.stigler at gmail.com> wrote:

> Hi
>
> This metapost() is really nice, thanks again Charlie and Cameron!!
>
> I'm encountering a problem that arises typically with metapost but not
> tikz(): when legend is horinzontal, there is a problem of spacing, as well
> as tick mark below the text. Can you confirm?
>
> library(tikzDevice)
>
> metapost("~/temp/regimes.tex")
> plot(runif(100))
> legend(0,1, lty=1, leg=c("High regime probability","Future prices") ,
> bty="n", horiz=TRUE, lwd=1, bg="white")
> dev.off()
>

This is most likely due to the fact that I did not implement any metric
calculations for the Metapost device---it simply uses the results by
computed by LaTeX for TikZ which are not correct but better than nothing.


Also, do you think you would extend the font size calculation for metapost()
> too soon? Would be so useful!!
>

 I pushed some changes that should help although a complete solution will be
difficult to do in a short period of time. One place where MetaPost
is decidedly worse than TikZ is access to font info.  With TIkZ we can
extract all sorts of useful information such as the ascent and descent of
characters. With MetaPost, the only clear parameter that can be clearly
extracted is the overall height of the text box.  So, text may not
vertically center exactly as it should---but things like legends will at
least look passable.  Also, you should now be able to resize the text. There
is still no support for text color.

I don't have the time to write extensive error checking at this moment---but
the device is still generating all of our test graphs without a problem.  If
the device cannot find the ConTeXt compiler, you may need to manually edit
the path assigned to `tikzContext` in R/deviceUtils.R.

-Charlie


> Thanks!!
>
> Matthieu
>
>
> _______________________________________________
> Tikzdevice-bugs mailing list
> Tikzdevice-bugs at lists.r-forge.r-project.org
>
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/tikzdevice-bugs
>


More information about the Tikzdevice-bugs mailing list