/// <summary> /// Initializes a new instance of the <see cref="FileFontLoader"/> class. /// </summary> /// <param name="factory">The factory.</param> /// <param name="fontFilePath">The relative path and file name.</param> public FileFontLoader(Factory factory, string fontFilePath) { this.factory = factory; var fontBytes = Utilities.ReadStream(CCFileUtils.GetFileStream(fontFilePath)); var stream = new DataStream(fontBytes.Length, true, true); stream.Write(fontBytes, 0, fontBytes.Length); stream.Position = 0; fontStreams.Add(new FileFontFileStream(stream)); // Build a Key storage that stores the index of the font keyStream = new DataStream(sizeof(int) * fontStreams.Count, true, true); for (int i = 0; i < fontStreams.Count; i++) { keyStream.Write((int)i); } keyStream.Position = 0; // Register the factory.RegisterFontFileLoader(this); factory.RegisterFontCollectionLoader(this); }