mirror of
https://github.com/UglyToad/PdfPig.git
synced 2025-10-14 19:05:01 +08:00
finish adobe font metrics parser
This commit is contained in:
@@ -57,7 +57,7 @@ StdHW 51
|
||||
|
||||
StdVW 51
|
||||
|
||||
StartCharMetrics 315
|
||||
StartCharMetrics 6
|
||||
|
||||
C 32 ; WX 600 ; N space ; B 0 0 0 0 ;
|
||||
|
||||
@@ -69,7 +69,9 @@ C 35 ; WX 600 ; N numbersign ; B 93 -32 507 639 ;
|
||||
|
||||
C 36 ; WX 600 ; N dollar ; B 105 -126 496 662 ;
|
||||
|
||||
C 37 ; WX 600 ; N percent ; B 81 -15 518 622 ;";
|
||||
C 37 ; WX 600 ; N percent ; B 81 -15 518 622 ;
|
||||
|
||||
EndCharMetrics";
|
||||
|
||||
private readonly AdobeFontMetricsParser parser = new AdobeFontMetricsParser();
|
||||
|
||||
|
19
src/UglyToad.Pdf/Fonts/CharacterWidth.cs
Normal file
19
src/UglyToad.Pdf/Fonts/CharacterWidth.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
namespace UglyToad.Pdf.Fonts
|
||||
{
|
||||
/// <summary>
|
||||
/// The x and y components of the width vector of the font's characters.
|
||||
/// Presence implies that IsFixedPitch is true.
|
||||
/// </summary>
|
||||
internal class CharacterWidth
|
||||
{
|
||||
public decimal X { get; }
|
||||
|
||||
public decimal Y { get; }
|
||||
|
||||
public CharacterWidth(decimal x, decimal y)
|
||||
{
|
||||
X = x;
|
||||
Y = y;
|
||||
}
|
||||
}
|
||||
}
|
@@ -3,170 +3,97 @@
|
||||
using System.Collections.Generic;
|
||||
using Geometry;
|
||||
|
||||
class FontMetrics
|
||||
{
|
||||
}
|
||||
|
||||
internal class FontMetricsBuilder
|
||||
internal class FontMetrics
|
||||
{
|
||||
public decimal AfmVersion { get; }
|
||||
|
||||
public List<string> Comments { get; }
|
||||
public IReadOnlyList<string> Comments { get; }
|
||||
|
||||
public List<IndividualCharacterMetric> CharacterMetrics { get; } = new List<IndividualCharacterMetric>();
|
||||
public int MetricSets { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Name of the font as seen by PostScript.
|
||||
/// </summary>
|
||||
public string FontName { get; set; }
|
||||
public string FontName { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The full text name of the font.
|
||||
/// </summary>
|
||||
public string FullName { get; set; }
|
||||
public string FullName { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The name of the typeface family for the font.
|
||||
/// </summary>
|
||||
public string FamilyName { get; set; }
|
||||
public string FamilyName { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The weight of the font.
|
||||
/// </summary>
|
||||
public string Weight { get; set; }
|
||||
public string Weight { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Angle in degrees counter-clockwise from vertical of vertical strokes of the font.
|
||||
/// </summary>
|
||||
public decimal ItalicAngle { get; set; }
|
||||
public PdfRectangle BoundingBox { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether the font is monospaced or not.
|
||||
/// </summary>
|
||||
public bool IsFixedPitch { get; set; }
|
||||
public string Version { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The dimensions of the font bounding box.
|
||||
/// </summary>
|
||||
public PdfRectangle PdfBoundingBox { get; private set; }
|
||||
public string Notice { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Distance from the baseline for underlining.
|
||||
/// </summary>
|
||||
public decimal UnderlinePosition { get; set; }
|
||||
public string EncodingScheme { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The stroke width for underlining.
|
||||
/// </summary>
|
||||
public decimal UnderlineThickness { get; set; }
|
||||
public int MappingScheme { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Version identifier for the font program.
|
||||
/// </summary>
|
||||
public string Version { get; set; }
|
||||
public int EscapeCharacter { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Font name trademark or copyright notice.
|
||||
/// </summary>
|
||||
public string Notice { get; set; }
|
||||
public string CharacterSet { get; }
|
||||
|
||||
public string EncodingScheme { get; set; }
|
||||
public int Characters { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Code describing mapping scheme for a non base font.
|
||||
/// </summary>
|
||||
public int MappingScheme { get; set; }
|
||||
public bool IsBaseFont { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The character set of this font.
|
||||
/// </summary>
|
||||
public string CharacterSet { get; set; }
|
||||
public PdfVector VVector { get; }
|
||||
|
||||
public bool IsBaseFont { get; set; } = true;
|
||||
public bool IsFixedV { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The y-value of the top of a capital H.
|
||||
/// </summary>
|
||||
public decimal CapHeight { get; set; }
|
||||
public decimal CapHeight { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The y-value of the top of lowercase x.
|
||||
/// </summary>
|
||||
public decimal XHeight { get; set; }
|
||||
public decimal XHeight { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Generally the y-value of the top of lowercase d.
|
||||
/// </summary>
|
||||
public decimal Ascender { get; set; }
|
||||
public decimal Ascender { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The y-value of the bottom of lowercase p.
|
||||
/// </summary>
|
||||
public decimal Descender { get; set; }
|
||||
public decimal Descender { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Width of horizontal stems.
|
||||
/// </summary>
|
||||
public decimal StdHw { get; set; }
|
||||
public decimal UnderlinePosition { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Width of vertical stems.
|
||||
/// </summary>
|
||||
public decimal StdVw { get; set; }
|
||||
public decimal UnderlineThickness { get; }
|
||||
|
||||
public CharacterWidth CharacterWidth { get; private set; }
|
||||
public decimal ItalicAngle { get; }
|
||||
|
||||
public FontMetricsBuilder(decimal afmVersion)
|
||||
public CharacterWidth CharacterWidth { get; }
|
||||
|
||||
public decimal HorizontalStemWidth { get; }
|
||||
|
||||
public decimal VerticalStemWidth { get; }
|
||||
|
||||
public IReadOnlyDictionary<string, IndividualCharacterMetric> CharacterMetrics { get; }
|
||||
|
||||
public FontMetrics(decimal afmVersion, IReadOnlyList<string> comments, int metricSets, string fontName, string fullName, string familyName, string weight, PdfRectangle boundingBox, string version, string notice, string encodingScheme, int mappingScheme, int escapeCharacter, string characterSet, int characters, bool isBaseFont, PdfVector vVector, bool isFixedV, decimal capHeight, decimal xHeight, decimal ascender, decimal descender, decimal underlinePosition, decimal underlineThickness, decimal italicAngle, CharacterWidth characterWidth, decimal horizontalStemWidth, decimal verticalStemWidth, IReadOnlyDictionary<string, IndividualCharacterMetric> characterMetrics)
|
||||
{
|
||||
AfmVersion = afmVersion;
|
||||
Comments = new List<string>();
|
||||
Comments = comments;
|
||||
MetricSets = metricSets;
|
||||
FontName = fontName;
|
||||
FullName = fullName;
|
||||
FamilyName = familyName;
|
||||
Weight = weight;
|
||||
BoundingBox = boundingBox;
|
||||
Version = version;
|
||||
Notice = notice;
|
||||
EncodingScheme = encodingScheme;
|
||||
MappingScheme = mappingScheme;
|
||||
EscapeCharacter = escapeCharacter;
|
||||
CharacterSet = characterSet;
|
||||
Characters = characters;
|
||||
IsBaseFont = isBaseFont;
|
||||
VVector = vVector;
|
||||
IsFixedV = isFixedV;
|
||||
CapHeight = capHeight;
|
||||
XHeight = xHeight;
|
||||
Ascender = ascender;
|
||||
Descender = descender;
|
||||
UnderlinePosition = underlinePosition;
|
||||
UnderlineThickness = underlineThickness;
|
||||
ItalicAngle = italicAngle;
|
||||
CharacterWidth = characterWidth;
|
||||
HorizontalStemWidth = horizontalStemWidth;
|
||||
VerticalStemWidth = verticalStemWidth;
|
||||
CharacterMetrics = characterMetrics;
|
||||
}
|
||||
|
||||
public void SetBoundingBox(decimal x1, decimal y1, decimal x2, decimal y2)
|
||||
{
|
||||
PdfBoundingBox = new PdfRectangle(x1, y1, x2, y2);
|
||||
}
|
||||
|
||||
public void SetCharacterWidth(decimal x, decimal y)
|
||||
{
|
||||
CharacterWidth = new CharacterWidth(x, y);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The x and y components of the width vector of the font's characters.
|
||||
/// Presence implies that IsFixedPitch is true.
|
||||
/// </summary>
|
||||
internal class CharacterWidth
|
||||
{
|
||||
public decimal X { get; }
|
||||
|
||||
public decimal Y { get; }
|
||||
|
||||
public CharacterWidth(decimal x, decimal y)
|
||||
{
|
||||
X = x;
|
||||
Y = y;
|
||||
}
|
||||
}
|
||||
|
||||
internal class IndividualCharacterMetric
|
||||
{
|
||||
public int CharacterCode { get; set; }
|
||||
|
||||
public decimal WidthX { get; set; }
|
||||
public decimal WidthY { get; set; }
|
||||
|
||||
public decimal WidthXDirection0 { get; set; }
|
||||
public decimal WidthYDirection0 { get; set; }
|
||||
|
||||
public decimal WidthXDirection1 { get; set; }
|
||||
public decimal WidthYDirection1 { get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
|
||||
public PdfVector VVector { get; set; }
|
||||
|
||||
public PdfRectangle BoundingBox { get; set; }
|
||||
}
|
||||
}
|
||||
|
156
src/UglyToad.Pdf/Fonts/FontMetricsBuilder.cs
Normal file
156
src/UglyToad.Pdf/Fonts/FontMetricsBuilder.cs
Normal file
@@ -0,0 +1,156 @@
|
||||
namespace UglyToad.Pdf.Fonts
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Geometry;
|
||||
|
||||
internal class FontMetricsBuilder
|
||||
{
|
||||
public decimal AfmVersion { get; }
|
||||
|
||||
public List<string> Comments { get; }
|
||||
|
||||
public List<IndividualCharacterMetric> CharacterMetrics { get; } = new List<IndividualCharacterMetric>();
|
||||
|
||||
/// <summary>
|
||||
/// Name of the font as seen by PostScript.
|
||||
/// </summary>
|
||||
public string FontName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The full text name of the font.
|
||||
/// </summary>
|
||||
public string FullName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The name of the typeface family for the font.
|
||||
/// </summary>
|
||||
public string FamilyName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The weight of the font.
|
||||
/// </summary>
|
||||
public string Weight { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Angle in degrees counter-clockwise from vertical of vertical strokes of the font.
|
||||
/// </summary>
|
||||
public decimal ItalicAngle { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether the font is monospaced or not.
|
||||
/// </summary>
|
||||
public bool IsFixedPitch { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The dimensions of the font bounding box.
|
||||
/// </summary>
|
||||
public PdfRectangle PdfBoundingBox { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Distance from the baseline for underlining.
|
||||
/// </summary>
|
||||
public decimal UnderlinePosition { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The stroke width for underlining.
|
||||
/// </summary>
|
||||
public decimal UnderlineThickness { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Version identifier for the font program.
|
||||
/// </summary>
|
||||
public string Version { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Font name trademark or copyright notice.
|
||||
/// </summary>
|
||||
public string Notice { get; set; }
|
||||
|
||||
public string EncodingScheme { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Code describing mapping scheme for a non base font.
|
||||
/// </summary>
|
||||
public int MappingScheme { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The character set of this font.
|
||||
/// </summary>
|
||||
public string CharacterSet { get; set; }
|
||||
|
||||
public bool IsBaseFont { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// The y-value of the top of a capital H.
|
||||
/// </summary>
|
||||
public decimal CapHeight { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The y-value of the top of lowercase x.
|
||||
/// </summary>
|
||||
public decimal XHeight { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Generally the y-value of the top of lowercase d.
|
||||
/// </summary>
|
||||
public decimal Ascender { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The y-value of the bottom of lowercase p.
|
||||
/// </summary>
|
||||
public decimal Descender { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Width of horizontal stems.
|
||||
/// </summary>
|
||||
public decimal StdHw { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Width of vertical stems.
|
||||
/// </summary>
|
||||
public decimal StdVw { get; set; }
|
||||
|
||||
public int EscapeCharacter { get; set; }
|
||||
|
||||
public CharacterWidth CharacterWidth { get; private set; }
|
||||
|
||||
public int Characters { get; set; }
|
||||
|
||||
public PdfVector VVector { get; private set; }
|
||||
|
||||
public bool IsFixedV { get; set; }
|
||||
|
||||
public FontMetricsBuilder(decimal afmVersion)
|
||||
{
|
||||
AfmVersion = afmVersion;
|
||||
Comments = new List<string>();
|
||||
}
|
||||
|
||||
public void SetBoundingBox(decimal x1, decimal y1, decimal x2, decimal y2)
|
||||
{
|
||||
PdfBoundingBox = new PdfRectangle(x1, y1, x2, y2);
|
||||
}
|
||||
|
||||
public void SetCharacterWidth(decimal x, decimal y)
|
||||
{
|
||||
CharacterWidth = new CharacterWidth(x, y);
|
||||
}
|
||||
|
||||
public void SetVVector(decimal x, decimal y)
|
||||
{
|
||||
VVector = new PdfVector(x, y);
|
||||
}
|
||||
|
||||
public FontMetrics Build()
|
||||
{
|
||||
var dictionary = CharacterMetrics.ToDictionary(x => x.Name);
|
||||
|
||||
return new FontMetrics(AfmVersion, Comments, 0, FontName, FullName,
|
||||
FamilyName, Weight, PdfBoundingBox, Version, Notice, EncodingScheme,
|
||||
MappingScheme, EscapeCharacter, CharacterSet, Characters, IsBaseFont, VVector,
|
||||
IsFixedV, CapHeight, XHeight, Ascender, Descender, UnderlinePosition, UnderlineThickness,
|
||||
ItalicAngle, CharacterWidth, StdHw, StdVw, dictionary);
|
||||
}
|
||||
}
|
||||
}
|
27
src/UglyToad.Pdf/Fonts/IndividualCharacterMetric.cs
Normal file
27
src/UglyToad.Pdf/Fonts/IndividualCharacterMetric.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
namespace UglyToad.Pdf.Fonts
|
||||
{
|
||||
using Geometry;
|
||||
using Parser;
|
||||
|
||||
internal class IndividualCharacterMetric
|
||||
{
|
||||
public int CharacterCode { get; set; }
|
||||
|
||||
public decimal WidthX { get; set; }
|
||||
public decimal WidthY { get; set; }
|
||||
|
||||
public decimal WidthXDirection0 { get; set; }
|
||||
public decimal WidthYDirection0 { get; set; }
|
||||
|
||||
public decimal WidthXDirection1 { get; set; }
|
||||
public decimal WidthYDirection1 { get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
|
||||
public PdfVector VVector { get; set; }
|
||||
|
||||
public PdfRectangle BoundingBox { get; set; }
|
||||
|
||||
public Ligature Ligature { get; set; }
|
||||
}
|
||||
}
|
@@ -1,8 +1,10 @@
|
||||
namespace UglyToad.Pdf.Fonts.Parser
|
||||
{
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
using Exceptions;
|
||||
using Geometry;
|
||||
using IO;
|
||||
using Pdf.Parser.Parts;
|
||||
|
||||
@@ -373,11 +375,17 @@
|
||||
builder.EncodingScheme = ReadLine(bytes);
|
||||
break;
|
||||
case MappingScheme:
|
||||
builder.MappingScheme = (int) ReadDecimal(bytes);
|
||||
builder.MappingScheme = (int)ReadDecimal(bytes);
|
||||
break;
|
||||
case CharacterSet:
|
||||
builder.CharacterSet = ReadLine(bytes);
|
||||
break;
|
||||
case EscChar:
|
||||
builder.EscapeCharacter = (int) ReadDecimal(bytes);
|
||||
break;
|
||||
case Characters:
|
||||
builder.Characters = (int) ReadDecimal(bytes);
|
||||
break;
|
||||
case IsBaseFont:
|
||||
builder.IsBaseFont = ReadBool(bytes);
|
||||
break;
|
||||
@@ -402,6 +410,12 @@
|
||||
case CharWidth:
|
||||
builder.SetCharacterWidth(ReadDecimal(bytes), ReadDecimal(bytes));
|
||||
break;
|
||||
case VVector:
|
||||
builder.SetVVector(ReadDecimal(bytes), ReadDecimal(bytes));
|
||||
break;
|
||||
case IsFixedV:
|
||||
builder.IsFixedV = ReadBool(bytes);
|
||||
break;
|
||||
case StartCharMetrics:
|
||||
var count = (int)ReadDecimal(bytes);
|
||||
for (int i = 0; i < count; i++)
|
||||
@@ -409,13 +423,20 @@
|
||||
var metric = ReadCharacterMetric(bytes);
|
||||
builder.CharacterMetrics.Add(metric);
|
||||
}
|
||||
var end = ReadString(bytes);
|
||||
|
||||
var end = ReadString(bytes);
|
||||
if (end != EndCharMetrics)
|
||||
{
|
||||
throw new InvalidFontFormatException($"The character metrics section did not end with {EndCharMetrics} instead it was {end}.");
|
||||
}
|
||||
|
||||
break;
|
||||
case StartKernData:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return new FontMetrics();
|
||||
return builder.Build();
|
||||
}
|
||||
|
||||
private static decimal ReadDecimal(IInputBytes input)
|
||||
@@ -487,7 +508,123 @@
|
||||
{
|
||||
var line = ReadLine(bytes);
|
||||
|
||||
return new IndividualCharacterMetric();
|
||||
var split = line.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
var metric = new IndividualCharacterMetric();
|
||||
|
||||
foreach (var s in split)
|
||||
{
|
||||
var parts = s.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
switch (parts[0])
|
||||
{
|
||||
case CharmetricsC:
|
||||
{
|
||||
var code = int.Parse(parts[1]);
|
||||
metric.CharacterCode = code;
|
||||
break;
|
||||
}
|
||||
case CharmetricsCh:
|
||||
{
|
||||
var code = int.Parse(parts[1], NumberStyles.HexNumber);
|
||||
metric.CharacterCode = code;
|
||||
break;
|
||||
}
|
||||
case CharmetricsWx:
|
||||
{
|
||||
metric.WidthX = decimal.Parse(parts[1]);
|
||||
break;
|
||||
}
|
||||
case CharmetricsW0X:
|
||||
{
|
||||
metric.WidthXDirection0 = decimal.Parse(parts[1]);
|
||||
break;
|
||||
}
|
||||
case CharmetricsW1X:
|
||||
{
|
||||
metric.WidthXDirection1 = decimal.Parse(parts[1]);
|
||||
break;
|
||||
}
|
||||
case CharmetricsWy:
|
||||
{
|
||||
metric.WidthY = decimal.Parse(parts[1]);
|
||||
break;
|
||||
}
|
||||
case CharmetricsW0Y:
|
||||
{
|
||||
metric.WidthYDirection0 = decimal.Parse(parts[1]);
|
||||
break;
|
||||
}
|
||||
case CharmetricsW1Y:
|
||||
{
|
||||
metric.WidthYDirection1 = decimal.Parse(parts[1]);
|
||||
break;
|
||||
}
|
||||
case CharmetricsW:
|
||||
{
|
||||
metric.WidthX = decimal.Parse(parts[1]);
|
||||
metric.WidthY = decimal.Parse(parts[2]);
|
||||
break;
|
||||
}
|
||||
case CharmetricsW0:
|
||||
{
|
||||
metric.WidthXDirection0 = decimal.Parse(parts[1]);
|
||||
metric.WidthYDirection0 = decimal.Parse(parts[2]);
|
||||
break;
|
||||
}
|
||||
case CharmetricsW1:
|
||||
{
|
||||
metric.WidthXDirection1 = decimal.Parse(parts[1]);
|
||||
metric.WidthYDirection1 = decimal.Parse(parts[2]);
|
||||
break;
|
||||
}
|
||||
case CharmetricsVv:
|
||||
{
|
||||
metric.VVector = new PdfVector(decimal.Parse(parts[1]), decimal.Parse(parts[2]));
|
||||
break;
|
||||
}
|
||||
case CharmetricsN:
|
||||
{
|
||||
metric.Name = parts[1];
|
||||
break;
|
||||
}
|
||||
case CharmetricsB:
|
||||
{
|
||||
metric.BoundingBox = new PdfRectangle(decimal.Parse(parts[1]),
|
||||
decimal.Parse(parts[2]),
|
||||
decimal.Parse(parts[3]),
|
||||
decimal.Parse(parts[4]));
|
||||
break;
|
||||
}
|
||||
case CharmetricsL:
|
||||
{
|
||||
metric.Ligature = new Ligature(parts[1], parts[2]);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
throw new InvalidFontFormatException($"Unknown CharMetrics command '{parts[0]}'.");
|
||||
}
|
||||
}
|
||||
|
||||
return metric;
|
||||
}
|
||||
}
|
||||
|
||||
internal class Ligature
|
||||
{
|
||||
public string Successor { get; }
|
||||
|
||||
public string Value { get; }
|
||||
|
||||
public Ligature(string successor, string value)
|
||||
{
|
||||
Successor = successor;
|
||||
Value = value;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"Ligature: {Value} -> Successor: {Successor}";
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -4,6 +4,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using IO;
|
||||
using Parser;
|
||||
using Util.JetBrains.Annotations;
|
||||
|
||||
/// <summary>
|
||||
@@ -31,6 +32,7 @@
|
||||
/// </remarks>
|
||||
internal static class Standard14
|
||||
{
|
||||
private static readonly AdobeFontMetricsParser Parser = new AdobeFontMetricsParser();
|
||||
private static readonly HashSet<string> Standard14Names = new HashSet<string>();
|
||||
private static readonly Dictionary<string, string> Standard14Mapping = new Dictionary<string, string>(34);
|
||||
private static readonly Dictionary<string, FontMetrics> Standard14AfmMap = new Dictionary<string, FontMetrics>(34);
|
||||
@@ -106,7 +108,7 @@
|
||||
bytes = new ByteArrayInputBytes(memory.ToArray());
|
||||
}
|
||||
|
||||
Standard14AfmMap[fontName] = new FontMetrics();
|
||||
Standard14AfmMap[fontName] = Parser.Parse(bytes, true);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
Reference in New Issue
Block a user