public TPdfInternalFont(Font aFont, int aId, bool aUseKerning, TPdfResources aResources) : base(aFont, aId, aUseKerning, aResources) { //LOGFONT lf = new LOGFONT(); This does not work, and it is unmanaged also! string FontName = ";" + aFont.Name.Replace(" ", String.Empty).ToUpper(CultureInfo.InvariantCulture) + ";"; if (TPdfTokens.GetString(TPdfToken.StSymbolFonts).IndexOf(FontName) >= 0) { FFontName = TPdfTokens.GetString(TPdfToken.PsSymbol); FFontType = TFontType.Symbol; } else if (TPdfTokens.GetString(TPdfToken.StSerifFonts).IndexOf(FontName) >= 0) { FFontName = TPdfTokens.GetString(TPdfToken.PsTimes); FFontType = TFontType.Times; } else if (TPdfTokens.GetString(TPdfToken.StFixedFonts).IndexOf(FontName) >= 0) { FFontName = TPdfTokens.GetString(TPdfToken.PsCourier); FFontType = TFontType.Courier; } else { FFontName = TPdfTokens.GetString(TPdfToken.PsHelvetica); FFontType = TFontType.Helvetica; } Width = TInternalFontMetrics.Width(FFontType, FFontStyle); if (FUseKerning) { Kern = TInternalFontMetrics.Kern(FFontType, FFontStyle); } }
private static void Saven2(TPdfStream DataStream, TXRefSection XRef, TPdfVisibleSignature VSig, int n2Id) { string s = String.Format(CultureInfo.InvariantCulture, "{0} {1} {2} {3} {4} {5} cm ", VSig.Rect.Width, 0, 0, VSig.Rect.Height, 0, 0); string StreamContents = "q " + s + TPdfTokens.GetString(TPdfToken.ImgPrefix) + "0 Do Q"; XRef.SetObjectOffset(n2Id, DataStream); TIndirectRecord.SaveHeader(DataStream, n2Id); BeginDictionary(DataStream); WriteCommonXObject(DataStream, VSig.Rect, StreamContents); TPdfResources Resources = new TPdfResources(null, false, null); using (MemoryStream ImgStream = new MemoryStream(VSig.ImageData)) { Resources.AddImage(null, ImgStream, FlxConsts.NoTransparentColor, false); } SaveProcSet(DataStream, XRef, true); SaveResourcesImgXObject(DataStream, XRef, Resources); EndDictionary(DataStream); WriteStream(DataStream, StreamContents); TIndirectRecord.SaveTrailer(DataStream); Resources.SaveObjects(DataStream, XRef); }
protected TPdfFont(Font aFont, int aId, bool aUseKerning, TPdfResources aResources) { FFontName = aFont.Name; FUseKerning = aUseKerning; FFontStyle = aFont.Style & ~FontStyle.Underline; Resources = aResources; Id = aId; UsedInDoc = false; }
internal TPageTreeRecord(int aId, string aFallbackFontList, bool aCompress, TFontEvents FontEvents) { FList = new List <TPageInfo>(); Resources = new TPdfResources(aFallbackFontList, aCompress, FontEvents); Id = aId; }
public TPdfUnicodeTrueTypeFont(Font aFont, int aId, TFontSubset aSubset, bool aCompress, bool aUseKerning, TPdfEmbeddedFont aEmbeddedData, FontStyle aAdditionalStyle, TPdfResources aResources) : base(aFont, aId, aCompress, aUseKerning, aEmbeddedData, aAdditionalStyle, aResources) { UsedChars = new TUsedCharList(); ToUnicodeData = new TToUnicode(); Subset = aSubset == TFontSubset.Subset; }
public TPdfWinAnsiTrueTypeFont(Font aFont, int aId, bool aEmbed, TFontSubset aSubset, bool aCompress, bool aUseKerning, TPdfEmbeddedFont aEmbeddedData, FontStyle aAdditionalStyle, TPdfResources aResources) : base(aFont, aId, aCompress, aUseKerning, aEmbeddedData, aAdditionalStyle, aResources) { Embed = aEmbed; Subset = aSubset == TFontSubset.Subset; FirstChar = -1; LastChar = 0; }
protected TPdfBaseTrueTypeFont(Font aFont, int aId, bool aCompress, bool aUseKerning, TPdfEmbeddedFont aEmbeddedData, FontStyle aAdditionalStyle, TPdfResources aResources) : base(aFont, aId, aUseKerning, aResources) { FCompress = aCompress; EmbeddedData = aEmbeddedData; FTrueTypeData = aEmbeddedData.TrueTypeData; AdditionalStyle = aAdditionalStyle; }
internal static TPdfFont CreateInstance(TFontMapping Mapping, Font aFont, bool aUnicode, int aId, TFontEmbed aEmbed, TFontSubset aSubset, bool aCompress, bool aUseKerning, TFontEvents FontEvents, TPdfEmbeddedFontList EmbeddedFontList, TPdfResources aResources) { if (!aUnicode && (Mapping == TFontMapping.ReplaceAllFonts || (Mapping == TFontMapping.ReplaceStandardFonts && IsStandardFont(aFont.Name))) ) { return(new TPdfInternalFont(aFont, aId, aUseKerning, aResources)); } FontStyle AdditionalStyle; TPdfEmbeddedFont EmbeddedData = EmbeddedFontList.Add(aFont, FontEvents, aSubset == TFontSubset.Subset, aUseKerning, out AdditionalStyle); if (AdditionalStyle != FontStyle.Regular) { if (FlexCelTrace.HasListeners) { FlexCelTrace.Write(new TPdfFauxBoldOrItalicsError(FlxMessages.GetString(FlxErr.ErrFauxBoldOrItalic, aFont.Name, GetAdditionalStyleName(AdditionalStyle)), aFont.Name, AdditionalStyle)); } } if (aUnicode) { return(new TPdfUnicodeTrueTypeFont(aFont, aId, aSubset, aCompress, aUseKerning, EmbeddedData, AdditionalStyle, aResources)); } else { bool DoEmbed = aEmbed == TFontEmbed.Embed || EmbeddedData.TrueTypeData.NeedsEmbed(aEmbed); if (FontEvents.OnFontEmbed != null) { FontEmbedEventArgs ae = new FontEmbedEventArgs(aFont, DoEmbed); FontEvents.OnFontEmbed(FontEvents.Sender, ae); DoEmbed = ae.Embed; } return(new TPdfWinAnsiTrueTypeFont(aFont, aId, DoEmbed, aSubset, aCompress, aUseKerning, EmbeddedData, AdditionalStyle, aResources)); } }
private static void SaveResourcesImgXObject(TPdfStream DataStream, TXRefSection XRef, TPdfResources Resources) { Resources.SaveResourceDesc(DataStream, XRef, false); EndDictionary(DataStream); }