mirror of
https://github.com/UglyToad/PdfPig.git
synced 2025-10-15 19:54:52 +08:00
implement missing methods for various compact font format charsets and fix bug with constructors
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
{
|
{
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
internal abstract class CompactFontFormatCharset : ICompactFontFormatCharset
|
internal abstract class CompactFontFormatCharset : ICompactFontFormatCharset
|
||||||
{
|
{
|
||||||
@@ -36,7 +37,7 @@
|
|||||||
|
|
||||||
public virtual string GetNameByStringId(int stringId)
|
public virtual string GetNameByStringId(int stringId)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
return GlyphIdToStringIdAndName.Single(x => x.Value.stringId == stringId).Value.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual int GetStringIdByGlyphId(int glyphId)
|
public virtual int GetStringIdByGlyphId(int glyphId)
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
namespace UglyToad.PdfPig.Fonts.CompactFontFormat.Charsets
|
namespace UglyToad.PdfPig.Fonts.CompactFontFormat.Charsets
|
||||||
{
|
{
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A predefined Charset for a Compact Font Format font with Charset Id of 1.
|
/// A predefined Charset for a Compact Font Format font with Charset Id of 1.
|
||||||
@@ -189,7 +190,7 @@
|
|||||||
var i = 0;
|
var i = 0;
|
||||||
foreach (var pair in StringIdToName)
|
foreach (var pair in StringIdToName)
|
||||||
{
|
{
|
||||||
furtherMap[i] = pair;
|
furtherMap[i++] = pair;
|
||||||
}
|
}
|
||||||
|
|
||||||
characterIdToStringIdAndName = furtherMap;
|
characterIdToStringIdAndName = furtherMap;
|
||||||
@@ -202,12 +203,12 @@
|
|||||||
|
|
||||||
public string GetNameByStringId(int stringId)
|
public string GetNameByStringId(int stringId)
|
||||||
{
|
{
|
||||||
throw new System.NotImplementedException();
|
return characterIdToStringIdAndName.Single(x => x.Value.Key == stringId).Value.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int GetStringIdByGlyphId(int glyphId)
|
public int GetStringIdByGlyphId(int glyphId)
|
||||||
{
|
{
|
||||||
throw new System.NotImplementedException();
|
return characterIdToStringIdAndName[glyphId].Key;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -1,6 +1,7 @@
|
|||||||
namespace UglyToad.PdfPig.Fonts.CompactFontFormat.Charsets
|
namespace UglyToad.PdfPig.Fonts.CompactFontFormat.Charsets
|
||||||
{
|
{
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A predefined Charset for a Compact Font Format font with Charset Id of 2.
|
/// A predefined Charset for a Compact Font Format font with Charset Id of 2.
|
||||||
@@ -110,7 +111,7 @@
|
|||||||
var i = 0;
|
var i = 0;
|
||||||
foreach (var pair in StringIdToName)
|
foreach (var pair in StringIdToName)
|
||||||
{
|
{
|
||||||
furtherMap[i] = pair;
|
furtherMap[i++] = pair;
|
||||||
}
|
}
|
||||||
|
|
||||||
characterIdToStringIdAndName = furtherMap;
|
characterIdToStringIdAndName = furtherMap;
|
||||||
@@ -123,12 +124,12 @@
|
|||||||
|
|
||||||
public string GetNameByStringId(int stringId)
|
public string GetNameByStringId(int stringId)
|
||||||
{
|
{
|
||||||
throw new System.NotImplementedException();
|
return characterIdToStringIdAndName.Single(x => x.Value.Key == stringId).Value.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int GetStringIdByGlyphId(int glyphId)
|
public int GetStringIdByGlyphId(int glyphId)
|
||||||
{
|
{
|
||||||
throw new System.NotImplementedException();
|
return characterIdToStringIdAndName[glyphId].Key;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -1,6 +1,7 @@
|
|||||||
namespace UglyToad.PdfPig.Fonts.CompactFontFormat.Charsets
|
namespace UglyToad.PdfPig.Fonts.CompactFontFormat.Charsets
|
||||||
{
|
{
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A predefined Charset for a Compact Font Format font with Charset Id of 0.
|
/// A predefined Charset for a Compact Font Format font with Charset Id of 0.
|
||||||
@@ -252,7 +253,7 @@
|
|||||||
var i = 0;
|
var i = 0;
|
||||||
foreach (var pair in StringIdToName)
|
foreach (var pair in StringIdToName)
|
||||||
{
|
{
|
||||||
furtherMap[i] = pair;
|
furtherMap[i++] = pair;
|
||||||
}
|
}
|
||||||
|
|
||||||
characterIdToStringIdAndName = furtherMap;
|
characterIdToStringIdAndName = furtherMap;
|
||||||
@@ -265,12 +266,12 @@
|
|||||||
|
|
||||||
public string GetNameByStringId(int stringId)
|
public string GetNameByStringId(int stringId)
|
||||||
{
|
{
|
||||||
throw new System.NotImplementedException();
|
return characterIdToStringIdAndName.Single(x => x.Value.Key == stringId).Value.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int GetStringIdByGlyphId(int glyphId)
|
public int GetStringIdByGlyphId(int glyphId)
|
||||||
{
|
{
|
||||||
throw new System.NotImplementedException();
|
return characterIdToStringIdAndName[glyphId].Key;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user