Make PdfContext private again

This commit is contained in:
Laurenz 2023-11-08 15:35:05 +01:00
parent 8be482c2c2
commit ccbe901cb7
7 changed files with 11 additions and 11 deletions

View File

@ -23,7 +23,7 @@ impl ExtGState {
/// Embed all used external graphics states into the PDF.
#[tracing::instrument(skip_all)]
pub fn write_external_graphics_states(ctx: &mut PdfContext) {
pub(crate) fn write_external_graphics_states(ctx: &mut PdfContext) {
for external_gs in ctx.extg_map.items() {
let id = ctx.alloc.bump();
ctx.ext_gs_refs.push(id);

View File

@ -22,7 +22,7 @@ const SYSTEM_INFO: SystemInfo = SystemInfo {
/// Embed all used fonts into the PDF.
#[tracing::instrument(skip_all)]
pub fn write_fonts(ctx: &mut PdfContext) {
pub(crate) fn write_fonts(ctx: &mut PdfContext) {
for font in ctx.font_map.items() {
let type0_ref = ctx.alloc.bump();
let cid_ref = ctx.alloc.bump();

View File

@ -32,7 +32,7 @@ pub struct PdfGradient {
/// Writes the actual gradients (shading patterns) to the PDF.
/// This is performed once after writing all pages.
pub fn write_gradients(ctx: &mut PdfContext) {
pub(crate) fn write_gradients(ctx: &mut PdfContext) {
for PdfGradient { transform, aspect_ratio, gradient, on_text } in
ctx.gradient_map.items().cloned().collect::<Vec<_>>()
{

View File

@ -11,7 +11,7 @@ use crate::{deflate, PdfContext};
/// Embed all used images into the PDF.
#[tracing::instrument(skip_all)]
pub fn write_images(ctx: &mut PdfContext) {
pub(crate) fn write_images(ctx: &mut PdfContext) {
for image in ctx.image_map.items() {
// Add the primary image.
match image.kind() {

View File

@ -61,7 +61,7 @@ pub fn pdf(
}
/// Context for exporting a whole PDF document.
pub struct PdfContext<'a> {
struct PdfContext<'a> {
/// The document that we're currently exporting.
document: &'a Document,
/// An introspector for the document, used to resolve locations links and

View File

@ -9,7 +9,7 @@ use crate::{AbsExt, PdfContext};
/// Construct the outline for the document.
#[tracing::instrument(skip_all)]
pub fn write_outline(ctx: &mut PdfContext) -> Option<Ref> {
pub(crate) fn write_outline(ctx: &mut PdfContext) -> Option<Ref> {
let mut tree: Vec<HeadingNode> = vec![];
// Stores the level of the topmost skipped ancestor of the next bookmarked

View File

@ -25,7 +25,7 @@ use crate::{deflate, AbsExt, EmExt, PdfContext};
/// Construct page objects.
#[tracing::instrument(skip_all)]
pub fn construct_pages(ctx: &mut PdfContext, frames: &[Frame]) {
pub(crate) fn construct_pages(ctx: &mut PdfContext, frames: &[Frame]) {
for frame in frames {
construct_page(ctx, frame);
}
@ -33,7 +33,7 @@ pub fn construct_pages(ctx: &mut PdfContext, frames: &[Frame]) {
/// Construct a page object.
#[tracing::instrument(skip_all)]
pub fn construct_page(ctx: &mut PdfContext, frame: &Frame) {
pub(crate) fn construct_page(ctx: &mut PdfContext, frame: &Frame) {
let page_ref = ctx.alloc.bump();
ctx.page_refs.push(page_ref);
@ -79,7 +79,7 @@ pub fn construct_page(ctx: &mut PdfContext, frame: &Frame) {
/// Write the page tree.
#[tracing::instrument(skip_all)]
pub fn write_page_tree(ctx: &mut PdfContext) {
pub(crate) fn write_page_tree(ctx: &mut PdfContext) {
for i in 0..ctx.pages.len() {
write_page(ctx, i);
}
@ -194,7 +194,7 @@ fn write_page(ctx: &mut PdfContext, i: usize) {
/// Write the page labels.
#[tracing::instrument(skip_all)]
pub fn write_page_labels(ctx: &mut PdfContext) -> Vec<(NonZeroUsize, Ref)> {
pub(crate) fn write_page_labels(ctx: &mut PdfContext) -> Vec<(NonZeroUsize, Ref)> {
let mut result = vec![];
let mut prev: Option<&PdfPageLabel> = None;
@ -265,7 +265,7 @@ pub struct Page {
/// An exporter for the contents of a single PDF page.
pub struct PageContext<'a, 'b> {
pub parent: &'a mut PdfContext<'b>,
pub(crate) parent: &'a mut PdfContext<'b>,
page_ref: Ref,
label: Option<PdfPageLabel>,
pub content: Content,