Export and review¶
doc.compile() resolves the layout once. SVG, PDF and PNG are all written from
that compiled snapshot, so the three files have the same geometry. Text is
embedded as searchable, editable text by default; text='outline' converts it
to paths. Page dimensions are millimetres, and preview DPI changes only the
PNG pixel size.
In a PDF, embedded text is written as one CIDFontType2 font per TrueType face,
with a /FontFile2 subset of the glyphs the page uses. This is what
matplotlib's pdf.fonttype = 42 produces and what journals call TrueType
(Type 42) embedding. A CFF-flavoured OpenType face (an .otf with PostScript
outlines) cannot be embedded that way; its text is outlined and the export
warns with inklet.FontEmbeddingWarning.
A family list can name a font file, which is used when it exists and skipped when it does not; bold and italic come from the same family's files in that directory:
style = i.preset('scientific.nature',
font_family='~/fonts/Arial.ttf, Arial, Helvetica, Liberation Sans, sans-serif')
compiled.metadata['fonts'] lists the font files the page used. A preset
whose expected_fonts is set (('Arial', 'Helvetica') for
scientific.nature) reports text set in any other family as
FONT_SUBSTITUTED, so a figure built where Arial is not installed says so.
A metric-compatible substitute such as Liberation Sans for Arial (or Arimo for
Helvetica, Liberation Serif or Tinos for Times, Liberation Mono or Cousine for
Courier New) is reported as information: the layout is identical, only the
embedded face differs. Pass expected_fonts=None to accept any substitute.
figure = doc.compile()
figure.save('figure.svg', 'figure.pdf')
print(figure.report())
figure.lint() returns diagnostics for the compiled page: text below the
minimum size, strokes too thin to print, overlapping or crowded labels,
content outside its panel, low contrast, colour keys that do not match their
marks, and connectors that cross shapes. figure.report() formats them as
text. The thresholds come from the preset, and can be passed as keywords.
inklet.editor.LayoutEditor opens a local browser editor for placement,
labels, styles and cameras, saved as overrides beside the Python recipe.
inklet.project.FigureProject bundles those choices with verified inputs so a
figure can be reopened and rebuilt later.