コード例 #1
0
ファイル: PdfResources.cs プロジェクト: mwilian/demos
        internal TPdfResources(string aFallbackFontList, bool aCompress, TFontEvents FontEvents)
        {
            Fonts = new TPdfFontList();
			EmbeddedFontList = new TPdfEmbeddedFontList();
            Images = new List<TPdfImage>();
			HatchPatterns = new List<TPdfHatch>();
			ImageTexturePatterns = new List<TPdfImageTexture>();
			GradientPatterns = new List<TPdfGradient>();
            Functions = new List<TPdfFunction>();
            GStates = new List<TPdfTransparency>();

			FCompress = aCompress;
			FFontEvents = FontEvents;
			if (aFallbackFontList != null) FFallbackFontList = aFallbackFontList.Split(';');
		}
コード例 #2
0
        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));
            }
        }