我有一些特殊的字体:EAN-13
我需要在我的报告中插入一个条形码,所以我不知道如何使用嵌入字体。
我可以在运行时加载我的字体:
private static PrivateFontCollection Pfc;
private static async Task<FontFamily> EAN13()
{
if (Pfc == null)
{
Pfc = new PrivateFontCollection();
Stream fontStream = typeof(DefferedPurchase)
.Assembly
.GetManifestResourceStream("ActionsC.Resources.EAN-13.ttf");
byte[] fontdata = new byte[fontStream.Length];
await fontStream.ReadAsync(fontdata, 0, (int)fontStream.Length);
fontStream.Close();
unsafe
{
fixed (byte* pFontData = fontdata)
{
Pfc.AddMemoryFont((IntPtr)pFontData, fontdata.Length);
}
}
}
return Pfc.Families.FirstOrDefault();
}
但是我怎么能apply
到这个rdlc
xml 节点呢?
<Textbox Name="textbox19">
<CanGrow>true</CanGrow>
<ToggleImage>
<InitialState>true</InitialState>
</ToggleImage>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>=Parameters!BarCode.Value</Value>
<Style>
<FontFamily><!--
see here
--></FontFamily>
<FontSize>12pt</FontSize>
</Style>
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>textbox1</rd:DefaultName>
<Top>13.4995cm</Top>
<Left>21.53213cm</Left>
<Height>3.10467cm</Height>
<Width>5.6385cm</Width>
<ZIndex>30</ZIndex>
<Style>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
有任何想法吗?