mirror of
https://github.com/UglyToad/PdfPig.git
synced 2025-10-15 19:54:52 +08:00
always use cidtogid map over truetype cmap where available
This commit is contained in:
@@ -8,9 +8,9 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
internal interface ICidFontProgram
|
internal interface ICidFontProgram
|
||||||
{
|
{
|
||||||
bool TryGetBoundingBox(int characterCode, out PdfRectangle boundingBox);
|
bool TryGetBoundingBox(int characterIdentifier, out PdfRectangle boundingBox);
|
||||||
|
|
||||||
bool TryGetBoundingBox(int characterCode, Func<int, int> characterIdentifierToGlyphIndex, out PdfRectangle boundingBox);
|
bool TryGetBoundingBox(int characterIdentifier, Func<int, int> characterIdentifierToGlyphIndex, out PdfRectangle boundingBox);
|
||||||
|
|
||||||
bool TryGetBoundingAdvancedWidth(int characterCode, out decimal width);
|
bool TryGetBoundingAdvancedWidth(int characterCode, out decimal width);
|
||||||
|
|
||||||
|
@@ -89,9 +89,9 @@
|
|||||||
|
|
||||||
public PdfRectangle GetBoundingBoxInGlyphSpace(int characterCode)
|
public PdfRectangle GetBoundingBoxInGlyphSpace(int characterCode)
|
||||||
{
|
{
|
||||||
var cid = CMap.ConvertToCid(characterCode);
|
var characterIdentifier = CMap.ConvertToCid(characterCode);
|
||||||
|
|
||||||
return CidFont.GetBoundingBox(cid);
|
return CidFont.GetBoundingBox(characterIdentifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
public TransformationMatrix GetFontMatrix()
|
public TransformationMatrix GetFontMatrix()
|
||||||
|
@@ -28,12 +28,12 @@
|
|||||||
GlyphTable = tableRegister.GlyphDataTable;
|
GlyphTable = tableRegister.GlyphDataTable;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool TryGetBoundingBox(int characterCode, out PdfRectangle boundingBox) => TryGetBoundingBox(characterCode, null, out boundingBox);
|
public bool TryGetBoundingBox(int characterIdentifier, out PdfRectangle boundingBox) => TryGetBoundingBox(characterIdentifier, null, out boundingBox);
|
||||||
public bool TryGetBoundingBox(int characterCode, Func<int, int> characterIdentifierToGlyphIndex, out PdfRectangle boundingBox)
|
public bool TryGetBoundingBox(int characterIdentifier, Func<int, int> characterIdentifierToGlyphIndex, out PdfRectangle boundingBox)
|
||||||
{
|
{
|
||||||
boundingBox = default(PdfRectangle);
|
boundingBox = default(PdfRectangle);
|
||||||
|
|
||||||
if (!TryGetGlyphIndex(characterCode, characterIdentifierToGlyphIndex, out var index))
|
if (!TryGetGlyphIndex(characterIdentifier, characterIdentifierToGlyphIndex, out var index))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -85,16 +85,19 @@
|
|||||||
{
|
{
|
||||||
glyphIndex = 0;
|
glyphIndex = 0;
|
||||||
|
|
||||||
if (CMapTable == null)
|
if (characterIdentifierToGlyphIndex != null)
|
||||||
{
|
|
||||||
if (characterIdentifierToGlyphIndex == null)
|
|
||||||
{
|
{
|
||||||
return false;
|
glyphIndex = characterIdentifierToGlyphIndex(characterIdentifier);
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
glyphIndex = characterIdentifierToGlyphIndex(characterIdentifier);
|
if (CMapTable == null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
else if (!CMapTable.TryGetGlyphIndex(characterIdentifier, out glyphIndex))
|
|
||||||
|
if (!CMapTable.TryGetGlyphIndex(characterIdentifier, out glyphIndex))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user