PdfCharElement: Width attribute
This commit is contained in:
@@ -250,8 +250,7 @@ namespace VAR.PdfTools.Workbench
|
|||||||
(int)(textElementPageY * Scale),
|
(int)(textElementPageY * Scale),
|
||||||
(int)(textElementWidth * Scale),
|
(int)(textElementWidth * Scale),
|
||||||
(int)(textElementHeight * Scale),
|
(int)(textElementHeight * Scale),
|
||||||
Scale);
|
5);
|
||||||
|
|
||||||
|
|
||||||
using (Font font = new Font("Arial", (int)(textElementHeight * Scale), GraphicsUnit.Pixel))
|
using (Font font = new Font("Arial", (int)(textElementHeight * Scale), GraphicsUnit.Pixel))
|
||||||
{
|
{
|
||||||
@@ -266,6 +265,10 @@ namespace VAR.PdfTools.Workbench
|
|||||||
(int)((textElementPageX + c.Displacement) * Scale),
|
(int)((textElementPageX + c.Displacement) * Scale),
|
||||||
(int)(textElementPageY * Scale),
|
(int)(textElementPageY * Scale),
|
||||||
2, 2);
|
2, 2);
|
||||||
|
gc.FillRectangle(Brushes.Green,
|
||||||
|
(int)((textElementPageX + c.Displacement + c.Width) * Scale),
|
||||||
|
(int)(textElementPageY * Scale),
|
||||||
|
2, 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ namespace VAR.PdfTools
|
|||||||
{
|
{
|
||||||
public string Char;
|
public string Char;
|
||||||
public double Displacement;
|
public double Displacement;
|
||||||
|
public double Width;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class PdfTextElement
|
public class PdfTextElement
|
||||||
@@ -135,6 +136,7 @@ namespace VAR.PdfTools
|
|||||||
{
|
{
|
||||||
Char = c.Char,
|
Char = c.Char,
|
||||||
Displacement = (c.Displacement * textElem.Matrix.Matrix[0, 0]),
|
Displacement = (c.Displacement * textElem.Matrix.Matrix[0, 0]),
|
||||||
|
Width = (c.Width * textElem.Matrix.Matrix[0, 0]),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
textElem.Childs = new List<PdfTextElement>();
|
textElem.Childs = new List<PdfTextElement>();
|
||||||
@@ -321,8 +323,8 @@ namespace VAR.PdfTools
|
|||||||
{
|
{
|
||||||
string realChar = _font.ToUnicode(c);
|
string realChar = _font.ToUnicode(c);
|
||||||
if (realChar == "\0") { continue; }
|
if (realChar == "\0") { continue; }
|
||||||
_listCharacters.Add(new PdfCharElement { Char = _font.ToUnicode(c), Displacement = _textWidth, });
|
|
||||||
double charWidth = _font.GetCharWidth(c) * _fontSize;
|
double charWidth = _font.GetCharWidth(c) * _fontSize;
|
||||||
|
_listCharacters.Add(new PdfCharElement { Char = _font.ToUnicode(c), Displacement = _textWidth, Width = charWidth });
|
||||||
_textWidth += charWidth;
|
_textWidth += charWidth;
|
||||||
_textWidth += ((c == 0x20) ? _wordSpacing : _charSpacing);
|
_textWidth += ((c == 0x20) ? _wordSpacing : _charSpacing);
|
||||||
}
|
}
|
||||||
@@ -620,6 +622,7 @@ namespace VAR.PdfTools
|
|||||||
{
|
{
|
||||||
Char = c.Char,
|
Char = c.Char,
|
||||||
Displacement = (c.Displacement + neighbourXMin) - blockXMin,
|
Displacement = (c.Displacement + neighbourXMin) - blockXMin,
|
||||||
|
Width = c.Width,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user