Skip to content

Layout: lists, tables and running bands ignore SetDefaultFont, so a PDF/A or PDF/UA file silently uses unembedded Helvetica #593

Closed

Description

@Tim81

Problem

Document.SetDefaultFont only affects Document.Add(string). Other elements fall back to TextStyle.Default,
which is unembedded Helvetica. In a document with Conformance set, a list or table without an explicit style
breaks the font-embedding requirement and the save says nothing.

Evidence (origin/main 1c61fa6):

  • src/VellumPdf.Layout/Document.cs:41 holds _defaultStyle. The only read is in Add(string, TextStyle?)
    at :842: Add(new Paragraph(text, style ?? _defaultStyle)).
  • The documentation says so (Document.cs:342-345): "nothing else reads it ... a Paragraph, Heading,
    list, table or running band never uses it."
  • src/VellumPdf.Layout/Core/TextStyle.cs:59: public FontReference FontRef { get; init; } = Standard14.Helvetica;
  • Fallbacks to the default: ListRenderer.cs:321 (_list.DefaultStyle ?? TextStyle.Default),
    TableRenderer.cs:118 and :212 (_table.DefaultCellStyle ?? TextStyle.Default), Paragraph.cs:151
    (style ?? TextStyle.Default) and Heading.cs:163 (style ?? new TextStyle { FontSize = 14 }, which is
    Helvetica too), RunningBand.cs:182 (Style = style ?? TextStyle.Default;) and
    TableGridResolver.cs:279 (table.DefaultCellStyle ?? TextStyle.Default, the column-width pass).

Measured

Measured in the 2026-11-16 handbook research on VellumPdf 2.3.3 (not reproduced for this issue): with
SetDefaultFont set to an embedded DejaVuSans, every list and table cell used /F1 12 Tf (/Helvetica), and
veraPDF and the library's preflight both failed ISO 14289-1 7.21.4.1-1. #545 (nested marker drawn as ?)
appears through the same fallback.

Why it matters

ISO 19005-2 6.2.11.4.1 requires every font used for rendering to be embedded (read via NEN Connect on
2026-11-17). Until this is fixed the caller must style every element by hand.

Scope (v2.4: report; refused only in strict mode, which is opt-in)

Acceptance

  • A document with Conformance = PdfA2u, an embedded font set through SetDefaultFont only, one list and one
    table reports two fallbacks, naming the list and the table.
  • The same document with explicit styles on both reports nothing.
  • With Conformance = None nothing is reported.
  • Strict mode throws and names the element; default saves with the bytes it writes today.
  • The test fails on origin/main 1c61fa6, proven by mutation.

Relates to

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/layoutbug

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions