blob: fdfb00123c36bdbb68858bf7d27319d484bd33b0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
using System;
using SharpFont;
using OpenTK.Graphics.OpenGL;
using System.Collections.Generic;
using System.IO;
using System.Diagnostics;
namespace go
{
public class glFont
{
Dictionary<int, glGlyph> glyphs = new Dictionary<int,glGlyph>();
public static void dumpFontsDirectories(string _path)
{
List<string> stylesList = new List<string> ();
List<string> namesList = new List<string> ();
List<string> attribsList = new List<string> ();
DirectoryInfo dir = new DirectoryInfo (_path);
try
{
using (Library lib = new Library())
{
Console.WriteLine("FreeType version: " + lib.Version + "\n");
foreach (FileInfo f in dir.GetFiles("*.ttf",SearchOption.AllDirectories)) {
try {
Face face = new Face(lib,f.FullName, 0);
Console.Write(System.IO.Path.GetFileNameWithoutExtension(f.Name) + " => ");
Console.WriteLine("{0} Faces:{1} Flags:{2}\nStyle:{3} StyleFlags:{4}\n",
face.FamilyName,
face.FaceCount,
face.FaceFlags,
face.StyleName,
face.StyleFlags);
string[] styles = face.StyleName.Split(' ');
foreach (string s in styles) {
if (stylesList.Contains(s))
continue;
stylesList.Add(s);
}
string[] names = face.FamilyName.Split(' ');
if (!namesList.Contains(names[0]))
namesList.Add(names[0]);
for (int i = 1; i < names.Length; i++) {
if (attribsList.Contains(names[i]))
continue;
attribsList.Add(names[i]);
}
face.Dispose();
}
catch (FreeTypeException ee)
{
Console.Write(ee.Error.ToString() + ": " + f.FullName);
}
}
}
}
catch (FreeTypeException e)
{
Console.Write(e.Error.ToString());
}
Console.Write ("Names => ");
foreach (string s in namesList) {
Console.Write (s + " ");
}
Console.Write ("\n\nAttrib => ");
foreach (string s in attribsList) {
Console.Write (s + " ");
}
Console.Write ("\n\nStyles => ");
foreach (string s in stylesList) {
Console.Write (s + " ");
}
}
public glFont (string _fontPath)
{
}
}
}
|