Skip to content

Layout: no language change inside a paragraph, heading or list item #584

Open

Description

@Tim81

Problem

Paragraph, heading, list item and cell each take one language string. A text run has none, so a Dutch sentence
cannot quote an English term with its own language. (origin/main 1c61fa6.)

  • src/VellumPdf.Layout/Elements/TextRun.cs:43: public sealed class TextRun(string Text, TextStyle Style); its
    only members are Text (:58) and Style (:86).
  • TextStyle has no language member (src/VellumPdf.Layout/Core/TextStyle.cs; its public members are FontRef, Font,
    FontSize, Leading, Color, EffectiveLeading, LinkUri and MeasureString, :21-257).
  • Language exists per element: Paragraph.Language (Paragraph.cs:118), Heading.Language (Heading.cs:131),
    ListItem.Language (ListItem.cs:76), Cell.Language (Cell.cs:183).
  • The whole paragraph is one marked-content sequence: ParagraphRenderer.cs:178
    (mcid = canvas.BeginMarkedContent(StructType);), and the struct element is one P (:328).
  • Heading and list item text are plain strings (Heading.cs:35, ListItem.cs:35), so they cannot carry runs
    (Layout: only Paragraph supports inline runs — Heading and ListItem take one string #367).

Measured

Measured in the 2026-11-16 handbook research on VellumPdf 2.3.3 (not reproduced for this issue): the phrase
"het Engelse woord return" could only be tagged with the paragraph's language, and the P had no Span child.

Why it matters

ISO 14289-1 7.2: changes in natural language shall be declared. The handbook quotes English interface terms
and messages inside Dutch sentences.

Scope

Acceptance

  • Paragraph([run nl, run en, run nl]) produces P > [MCID, Span(Lang en) > MCID, MCID] or the equivalent
    marked-content /Lang (assert on the tree and the content stream). In marked content the language is written as
    /Lang (en) under Kernel: marked-content sequences cannot carry a property list, so artifacts have no Type, Subtype or BBox #605's string rule (ASCII tag as a plain literal string).
  • veraPDF ua1 language rules (7.2) pass, and the Reader's extracted text is identical to a single-language
    paragraph with the same text.
  • A run without Language writes the bytes it writes today (golden test).
  • A language tag that is empty or not BCP 47 is handled as Paragraph.Language handles it today (the brief states
    what that is; this issue adds no new refusal).
  • The test fails on origin/main 1c61fa6, proven by mutation.

Relates to

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/conformancearea/layoutenhancementtype/feature

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions