Exemplo n.º 1
0
        public TextRecognizer(List<FontFamily> families, List<FontStyle> styles, int size_start, int size_end, int spacing)
        {
            fonts = new List<FontCharCollection>();
            matcher = new FontCharMatcher();

            foreach (FontFamily family in families)
            {
                for (int size = size_start; size <= size_end; size += spacing)
                {
                    foreach (FontStyle style in styles)
                    {
                        if (family.IsStyleAvailable(style))
                        {
                            Font font = new Font(family, size, style, GraphicsUnit.Pixel);
                            //Console.WriteLine("Processing font: {0} [{1}, {2}]", family.GetName(0), size, style);

                            FontCharCollection fcc = new FontCharCollection(font);
                            for (int i = 33; i <= 128; i++)
                                fcc.Add(new FontChar(fcc, (char)i));
                            fcc.Add(new FontChar(fcc, '€')); // Add € symbol.

                            fcc.SortBySize();

                            fonts.Add(fcc);

                            matcher.Add(fcc);
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
 public void Add(FontCharCollection chars)
 {
     foreach (FontChar c in chars)
     {
         Add(c);
     }
 }