Replace Hard Hyphens with normal hyphen so the PDF search for hyphens will work properly
Support using regular hyphens as hard-hyphens
This commit is contained in:
parent
638fea272e
commit
59bc89e4f2
@ -637,11 +637,27 @@ namespace Volian.Svg.Library
|
||||
return Element.ALIGN_LEFT;
|
||||
}
|
||||
}
|
||||
public class VlnSplitCharacter : ISplitCharacter
|
||||
{
|
||||
public bool IsSplitCharacter(int start, int current, int end, char[] cc, PdfChunk[] ck)
|
||||
{
|
||||
return (cc[current] == ' ');
|
||||
}
|
||||
public bool IsSplitCharacter(char c)
|
||||
{
|
||||
return (c == ' ');
|
||||
}
|
||||
}
|
||||
public static VlnSplitCharacter mySplitter = new VlnSplitCharacter();
|
||||
// Draw's using PdfContentByte are for drawing PageList items.
|
||||
public override void Draw(PdfContentByte cb, SvgScale scale, Svg mySvg, SvgPartInheritance myParent)
|
||||
{
|
||||
string text = mySvg.OnProcessText(Text, this, scale);
|
||||
if (text == string.Empty) return;
|
||||
// Replace hard hyphen with hyphen when printing pagelist items
|
||||
// this will enable the hyphens to be found in a PDF search
|
||||
if(text.Contains("\\u8209?"))
|
||||
text = text.Replace("\\u8209?", "-");
|
||||
SetupInheritance(myParent.MyInheritedSettings);
|
||||
float yScale = (myParent is SvgGroup && (myParent as SvgGroup).Description.ToUpper() == "ABSOLUTE") ? scale.AbsY(cb, Y): scale.Y(cb, Y);
|
||||
cb.SaveState();
|
||||
@ -667,7 +683,11 @@ namespace Volian.Svg.Library
|
||||
float x = (myParent is SvgGroup && (myParent as SvgGroup).Description.ToUpper() == "ABSOLUTE") ? scale.AbsX(X): scale.X(X);
|
||||
float w = 0; // chk.GetWidthPoint();
|
||||
foreach (Chunk chk in ph.Chunks)
|
||||
{
|
||||
w += chk.GetWidthPoint();
|
||||
// Change the chunks to only split on spaces rather than spaces and hyphens
|
||||
chk.SetSplitCharacter(mySplitter);
|
||||
}
|
||||
switch (Justify)
|
||||
{
|
||||
//case SvgJustify.Left:
|
||||
|
Loading…
x
Reference in New Issue
Block a user