getLatexCharMetrics {tikzDevice}R Documentation

Obtain LaTeX Font Metrics for Characters...

Description

Obtain LaTeX Font Metrics for Characters This function is used to retrieve the ascent, decent and width of a character glyph as it would appear in output typeset by LaTeX.

Usage

getLatexCharMetrics(charCode, cex=1, face=1, engine=getOption("tikzDefaultEngine"))

Arguments

charCode

an integer that corresponds to a symbol in the ASCII character table under the Type 1 font encoding. All numeric values are coerced using as.integer. Non-numeric values will not be accepted.

cex

a real number that specifies a scaling factor that is to be applied to device output.

face

an integer in the range [1-5] that specifies the font face to use. See par for details.

engine

a string specifying which TeX engine to use. Possible values are 'pdftex' and 'xetex'. See the Unicode section of tikzDevice for details.

Details

getLatexCharMetrics first checks to see if metrics have allready been calculated for the given character using the given values of cex and face. If so, cached values are returned. If no cached values exists, the LaTeX compiler specified by options( tikzLatex ) is invoked in order to calculate them.

Value

metrics

A numeric vector holding ascent, descent, width character metrics. Values should all be nonnegative.

Note

tikzDevice tries very hard when it is loaded to find a working latex or pdflatex command. If it is successful the command is set in options('tikzLatex'), otherwise this function will fail.

Author(s)

Charlie Sharpsteen source@sharpsteen.net

References

PGF Manual

See Also

tikz, getLatexStrWidth

Examples

# Calculate ascent, descent and width for "A"
getLatexCharMetrics(65)

[Package tikzDevice version 0.6.2 Index]