Ejemplo n.º 1
0
        // private HashTable charecterMetrics;

        public PdfFont(string fontName, FontTypes subType, InstalledFonts baseFont)
        {
            nameObj     = new PdfName(fontName);
            subTypeObj  = new PdfName(subType.ToString());
            baseFontObj = new PdfName(baseFont.ToString());
            this.Add(type, new PdfName("Font"));
            this.Add(this.name, nameObj);
            this.Add(this.subType, subTypeObj);
            this.Add(this.baseFont, baseFontObj);
            // this.Add(new PdfName("Encoding"), new PdfName("MacRomanEncoding"));
        }
Ejemplo n.º 2
0
// ---------------------------------------------------------------------------
        public void Write(Stream stream)
        {
            using (ZipFile zip = new ZipFile()) {
                FontTypes f   = new FontTypes();
                byte[]    pdf = Utility.PdfBytes(f);
                zip.AddEntry(Utility.ResultFileName(f.ToString() + ".pdf"), pdf);
                IEnumerable <String> set1 = from m
                                            in new ListUsedFonts().ListFonts(pdf)
                                            orderby m select m;
                StringBuilder sb = new StringBuilder();

/*
 * i don't have c:/windows/fonts/ARBLI__.TTF on my system;
 * if you compare to Java example __THIS__ result file will have
 * one __LESS__ font listed!
 */
                foreach (String fontname in set1)
                {
                    sb.AppendLine(fontname);
                }
                zip.AddEntry(RESULT, sb.ToString());
                zip.Save(stream);
            }
        }
Ejemplo n.º 3
0
        public static void LoadFonts(ObservableCollection <KeyName> target, FontTypes type, TappedEventHandler tapped, Action callback)
        {
            var fonts = FontHelper.FontList.Where(x => type == FontTypes.All ? true : x.Type == type.ToString());

            if (!FontHelper.IsLoaded)
            {
                ThreadPoolTimer.CreatePeriodicTimer((s) =>
                {
                    if (FontHelper.IsLoaded)
                    {
                        s.Cancel();
                        int i = 0;
                        foreach (var font in fonts)
                        {
                            DispatcherHelper.CheckBeginInvokeOnUI(() =>
                            {
                                font.ItemTapped = tapped;
                                target.Add(font);

                                if (callback != null && ++i == fonts.Count())
                                {
                                    callback();
                                }
                            });
                        }
                    }
                }, TimeSpan.FromMilliseconds(300));
            }
            else
            {
                foreach (var font in fonts)
                {
                    font.ItemTapped = tapped;
                    target.Add(font);
                    //System.Diagnostics.Debug.WriteLine($"{type} 폰트 로드 : {font.Key}");
                }

                callback?.Invoke();
            }
        }