aboutsummaryrefslogtreecommitdiffstatsci
path: root/src/OpenGL/GLBackend/Font/glFont.cs
diff options
context:
space:
mode:
authorjpbruyere <jp.bruyere@hotmail.com>2015-10-21 22:00:20 +0200
committerjpbruyere <jp.bruyere@hotmail.com>2015-10-21 22:00:20 +0200
commit8099f1775b6d9083e04b2f39700c2e90a0724aca (patch)
treea145c7f1ec8aeb4aade2ffae4e2c50771ef9ec86 /src/OpenGL/GLBackend/Font/glFont.cs
parentf31ffd683210c50b777dce4e76d0d9912ca925a8 (diff)
glbackend tests, copy first try from hg reposglbackend
Diffstat (limited to 'src/OpenGL/GLBackend/Font/glFont.cs')
-rw-r--r--src/OpenGL/GLBackend/Font/glFont.cs90
1 files changed, 90 insertions, 0 deletions
diff --git a/src/OpenGL/GLBackend/Font/glFont.cs b/src/OpenGL/GLBackend/Font/glFont.cs
new file mode 100644
index 00000000..fdfb0012
--- /dev/null
+++ b/src/OpenGL/GLBackend/Font/glFont.cs
@@ -0,0 +1,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)
+ {
+
+ }
+
+ }
+}
+