Files
PdfPig/src/UglyToad.PdfPig/PdfFonts/CidFonts/ICidFont.cs
BobLd b2f4ca8839
Some checks failed
Build, test and publish draft / build (push) Has been cancelled
Build and test [MacOS] / build (push) Has been cancelled
Run Common Crawl Tests / build (0000-0001) (push) Has been cancelled
Run Common Crawl Tests / build (0002-0003) (push) Has been cancelled
Run Common Crawl Tests / build (0004-0005) (push) Has been cancelled
Run Common Crawl Tests / build (0006-0007) (push) Has been cancelled
Run Integration Tests / build (push) Has been cancelled
Nightly Release / Check if this commit has already been published (push) Has been cancelled
Nightly Release / tests (push) Has been cancelled
Nightly Release / build_and_publish_nightly (push) Has been cancelled
Add GetDescent() and GetAscent() methods to IFont, improve font matrix for TrueTypeSimpleFont and TrueTypeStandard14FallbackSimpleFont and add loose bounding box to Letter
2025-09-21 15:07:52 +01:00

94 lines
3.6 KiB
C#

namespace UglyToad.PdfPig.PdfFonts.CidFonts
{
using System;
using System.Diagnostics.CodeAnalysis;
using System.Collections.Generic;
using Core;
using Geometry;
using Tokens;
/// <summary>
/// A CID font contains glyph descriptions accessed by
/// CID (character identifier) as character selectors.
/// </summary>
/// <remarks>
/// A CID font contains information about a CIDFont program but is
/// not itself a font. It can only be a descendant of a Type 0 font.
/// </remarks>
internal interface ICidFont
{
/// <summary>
/// <see cref="NameToken.Font"/>
/// </summary>
NameToken Type { get; }
/// <summary>
/// Either Type0 (Adobe Type 1 font) or Type2 (TrueType font).
/// </summary>
NameToken SubType { get; }
/// <summary>
/// The PostScript name of the CIDFont.
/// </summary>
NameToken BaseFont { get; }
/// <summary>
/// The definition of the character collection for the font.
/// </summary>
CharacterIdentifierSystemInfo SystemInfo { get; }
FontDetails Details { get; }
TransformationMatrix FontMatrix { get; }
CidFontType CidFontType { get; }
FontDescriptor Descriptor { get; }
double GetWidthFromDictionary(int cid);
double GetWidthFromFont(int characterIdentifier);
PdfRectangle GetBoundingBox(int characterIdentifier);
PdfVector GetPositionVector(int characterIdentifier);
PdfVector GetDisplacementVector(int characterIdentifier);
TransformationMatrix GetFontMatrix(int characterIdentifier);
double GetDescent();
double GetAscent();
/// <summary>
/// Returns the glyph path for the given character code.
/// </summary>
/// <param name="characterCode">Character code in a PDF. Not to be confused with unicode.</param>
/// <param name="path">The glyph path for the given character code.</param>
bool TryGetPath(int characterCode, [NotNullWhen(true)] out IReadOnlyList<PdfSubpath>? path);
/// <summary>
/// Returns the glyph path for the given character code.
/// </summary>
/// <param name="characterCode">Character code in a PDF. Not to be confused with unicode.</param>
/// <param name="characterCodeToGlyphId"></param>
/// <param name="path">The glyph path for the given character code.</param>
bool TryGetPath(int characterCode, Func<int, int?> characterCodeToGlyphId, [NotNullWhen(true)] out IReadOnlyList<PdfSubpath>? path);
/// <summary>
/// Returns the normalised glyph path for the given character code in a PDF.
/// </summary>
/// <param name="characterCode">Character code in a PDF. Not to be confused with unicode.</param>
/// <param name="path">The normalized glyph path for the given character code.</param>
bool TryGetNormalisedPath(int characterCode, [NotNullWhen(true)] out IReadOnlyList<PdfSubpath>? path);
/// <summary>
/// Returns the normalised glyph path for the given character code in a PDF.
/// </summary>
/// <param name="characterCode">Character code in a PDF. Not to be confused with unicode.</param>
/// <param name="characterCodeToGlyphId"></param>
/// <param name="path">The normalized glyph path for the given character code.</param>
bool TryGetNormalisedPath(int characterCode, Func<int, int?> characterCodeToGlyphId, [NotNullWhen(true)] out IReadOnlyList<PdfSubpath>? path);
}
}