Skip to content

Conversion of points to another length #1573

Open

Description

@SparkoUK

The problem seems to be there are two Measurements with the pt value DtpPoint and PrinterPoint so when a point measurement like 10pt is parsed it fails as the code thinks it matches two items.

string value="10pt";

IQuantity quantity = Quantity.From(0, LengthUnit.Centimeter);

if (Quantity.TryParse(typeof(Length), value, out quantity) == false)
{
	Console.WriteLine ("Failed");
}

Activity

  1. SparkoUK commented on Jul 22, 2025

    @SparkoUK
    Author

    Why are there two version of point as they both have the same value is there a way to work around this problem?

  2. angularsen commented on Jul 26, 2025

    @angularsen
    Owner

    Hi, the problem is that there there seems to be no well defined unit abbreviations for these that help differentiate them.

    A quick google does not reveal any conventions, so I guess we could do what we do for imperial gallons gallon (imp.) vs US gallons gallon (U.S.).

    ChatGPT summary of DTP Point and Printer’s Point

    Type Inches per Point Millimeters Approx. Common Usage
    DTP Point 1/72 inch (≈ 0.01389) ≈ 0.3528 mm Digital publishing (e.g., Adobe, CSS, PDFs)
    Printer’s Point 1/72.27 inch (≈ 0.01384) ≈ 0.3515 mm Traditional typography (e.g., TeX, hot metal typesetting)

    Key Differences:

    • DTP point is slightly larger than the traditional printer's point.
    • DTP (Desktop Publishing) point is the modern standard, defined as 1/72 inch.
    • Printer’s point (also known as TeX or PostScript point) originates from traditional print and is 1/72.27 inch.
    • While the size difference is minor (~0.004 mm), it can be relevant in precise typesetting or layout rendering.

    My suggestion

    Change the unit abbreviations from pt to:

    • DtpPoint: pt (DTP), or DTP, or keep it pt as it seems the most widely used today
    • PrinterPoint: pt (printer) or printer point

    This would be a breaking change, but we can add it in #1200 that is currently in pre-release.
    What would work best of the above suggestions do you think?

  3. SparkoUK commented on Jul 26, 2025

    @SparkoUK
    Author
  4. angularsen commented on Aug 9, 2025

    @angularsen
    Owner

    pt vs Pt sounds very confusing to me.

    Reading this wiki, there are actually many historic definitions:
    https://en.wikipedia.org/wiki/Point_(typography)#Varying_standards

    It seems PrinterPoint should maybe instead have been named TeXPoint, as there are many definitions of print typography points.

    DTP is also known as PostScript, but I think DTP is better to use.

    So my revised suggestion would be:

    • pt for DTP, since it seems the modern standard and what you find when googling
    • pt (TeX) for PrinterPoint
    • Rename PrinterPoint to TeXPoint to more clear
  5. angularsen commented on Aug 9, 2025

    @angularsen
    Owner

    Actually, reading a bit more, it seems TeX and American points are practically idential. We'd either choose one or add both, I guess.

  6. github-actions commented on Sep 9, 2025

    @github-actions
    Contributor

    This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

  7. github-actions commented on Sep 17, 2025

    @github-actions
    Contributor

    This issue was automatically closed due to inactivity.

  8. lipchev commented on Nov 22, 2026

    @lipchev
    Collaborator

    I’m not familiar with printer’s points, so I asked AI to independently check the definitions, the discussion here, and UnitsNet’s parser. Here’s its recommendation.

    Give plain pt to DtpPoint in v6 and use pt (TeX) for the existing PrinterPoint. CSS defines pt as 1/72 inch, and the current PrinterPoint conversion matches the TeX definition of 1/72.27 inch. Keep both public enum names and conversion factors. A case-only distinction like pt versus Pt is fragile because the parser also matches case-insensitively. CSS absolute lengths · TeX length units · UnitsNet parser matching

    The pica collision can follow the same rule: pica for DtpPica and pica (TeX) for PrinterPica. Keep pc for parsecs in the general length parser. I asked AI to test those spellings with temporary abbreviation overrides. Plain 10pt, the qualified TeX forms, and both pica forms parsed and round-tripped in invariant, en-US, and fr-CA, and 1 pc still parsed as a parsec.

    I’d call out the change in the v6 release notes because old formatted text such as 10 pt may have meant printer’s points and will parse as DTP points after this change. Once the spelling fix lands, the validator can drop the resolved pt and pica exceptions while keeping a separate test for genuinely ambiguous input. Current unit definitions · Unit-definition validator

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions