
useDynLib(xdvir, .registration=TRUE, .fixes="C_")

importFrom("utils",
           "packageVersion")
importFrom("grDevices",
           "adjustcolor",
           "col2rgb",
           "dev.cur",
           "glyphAnchor",
           "glyphFont",
           ## Not explicitly imported so can build on lower versions of R
           ## "glyphFontVariation",
           "glyphFontList",
           "glyphHeight",
           "glyphInfo",
           "glyphWidth",
           "gray",
           "rgb")
import("grid")
import("hexView")
importFrom("tinytex",
           "is_tinytex",
           "latexmk",
           "tinytex_root")
importFrom("rlang",
           "check_installed",
           "on_load",
           "on_package_load",
           "run_on_load",
           "%||%")
importFrom("systemfonts",
           "match_fonts")

export("readDVI",

       "TeXstatus",

       "TeXengine",
       
       "LaTeXpackage", "registerPackage",
       "fontspecPackage", "xcolorPackage", "previewPackage",
       "tikzPackage", "tikzPicture",

       "author", "typeset", "render",
       
       "grid.dvi", "dviGrob",

       "grid.latex", "latexGrob", 

       "grid.lualatex", "lualatexGrob",
       "grid.xelatex", "xelatexGrob",

       "element_latex", "geom_latex", "GeomLatex",

       "addMark", "getMark")


S3method("packagePreamble", "NULL")
S3method("packagePreamble", "LaTeXpackage")
S3method("packagePreamble", "list")
S3method("packagePrefix", "NULL")
S3method("packagePrefix", "LaTeXpackage")
S3method("packagePrefix", "list")
S3method("packageSuffix", "NULL")
S3method("packageSuffix", "LaTeXpackage")
S3method("packageSuffix", "list")
S3method("resolvePackage", "character")
S3method("resolvePackage", "LaTeXpackage")
S3method("resolvePackages", "character")
S3method("resolvePackages", "LaTeXpackage")
S3method("resolvePackages", "list")
S3method("resolvePackages", NULL)

S3method("typeset", "LaTeXdocument")
S3method("typeset", "character")

S3method("dviGrob", "DVI")
S3method("dviGrob", "character")
S3method("dviGrob", "list")

S3method("resolveEngine", "DVI")
S3method("resolveEngine", "LaTeXdocument")
S3method("resolveEngine", "character")

S3method("typesetPackages", "DVI")

S3method("resolveDVI", "DVI")
S3method("resolveDVI", "character")

S3method("makeContent", "DVIgTree")
S3method("xDetails", "DVIgTree")
S3method("yDetails", "DVIgTree")
S3method("widthDetails", "DVIgTree")
S3method("heightDetails", "DVIgTree")

S3method("makeContext", "DVIgrob")
S3method("makeContent", "DVIgrob")
S3method("xDetails", "DVIgrob")
S3method("yDetails", "DVIgrob")
S3method("widthDetails", "DVIgrob")
S3method("heightDetails", "DVIgrob")

S3method("makeContent", "LaTeXgrob")
S3method("xDetails", "LaTeXgrob")
S3method("yDetails", "LaTeXgrob")
S3method("widthDetails", "LaTeXgrob")
S3method("heightDetails", "LaTeXgrob")

S3method("grobCoords", "DVIgrob")

S3method("objToGrob", "XDVIRglyphObj")
S3method("objToGrob", "XDVIRruleObj")
S3method("objToGrob", "XDVIRtikzObj")
S3method("objToGrob", "XDVIRtikzParentObj")
S3method("objToGrob", "XDVIRtikzPathObj")
S3method("objToGrob", "XDVIRtikzPolylineObj")
S3method("objToGrob", "XDVIRtikzFillObj")
S3method("objToGrob", "XDVIRtikzStretchPathObj")
S3method("objToGrob", "XDVIRtikzStretchPolylineObj")
S3method("objToGrob", "XDVIRtikzStretchFillObj")
S3method("objToGrob", "XDVIRtikzMarkObj")
S3method("objToGrob", "XDVIRrotatedGlyphObj")
S3method("objToGrob", "XDVIRtransformedGlyphObj")
S3method("objToGrob", "XDVIRzrefObj")

S3method("print", "DVI")
S3method("print", "TeXengine")
S3method("print", "LaTeXdocument")

S3method("widthDetails", "latex_grob")
S3method("heightDetails", "latex_grob")
