/// <summary> /// cTor: Accepts a FontOptimizer fully setup to serve bitmaps of the selected font and size /// </summary> /// <param name="fo">The initialized FontOptimizer</param> public FCBase(FontOptimizer fo) { m_fo = fo; // derive from font Name = m_fo.FontToUse.Name; FontNameCreated = Name; Width = ( int )(m_fo.FontToUse.SizeInPoints + 0.5F); // preliminary .. Height = ( int )(m_fo.FinalHeight); Monospace = true; // init }
/// <summary> /// Character Digitizer /// Creates the Byte stream for this character /// </summary> /// <param name="c">Character to digitize</param> /// <param name="fo">The FontOptimzer serving the bitmaps</param> /// <param name="target">Width target setting</param> /// <returns>The size of the created character</returns> public override Size CreateChar(Char c, FontOptimizer fo, FontOptimizer.WidthTarget target) { m_c = c; Bitmap fontImage = fo.GetMapForChar(c, target); // GET and ADD BITS... // from Top to bottom - then from left to right m_bytesPerCol = (fontImage.Height + 7) / 8; // get height in bytes for (int b = 0; b < m_bytesPerCol; b++) { // per byte row for (int x = 0; x < fontImage.Width; x++) { // left -> right Byte col = 0; Byte bit = 1; // paint bit moves from LSB to MSB in the y -loop for (int y = b * 8; y < (b + 1) * 8; y++) { if (y < fontImage.Height) { // top -> down ?? Color pix = fontImage.GetPixel(x, y); if (pix.R > FontOptimizer.BLANKTX) // red on black painting { col |= bit; } bit <<= 1; } else { // catch overrun - but shift in (supposed bug in original must be retained...) col <<= 1; // shift in } } // for y this.Add(col); } // for x } // for b Size nS = fontImage.Size; fontImage.Dispose( ); return(nS); }
/// <summary> /// Returns a new instance of this implementation /// - must be implemented and hide this one /// </summary> /// <returns>A new specific FontCreator instance</returns> static public FCBase GetInstance(FontOptimizer fo) { return(null); }
/// <summary> /// Returns a new instance of this implementation /// </summary> /// <returns>A new specific FontCreator instance</returns> static public new FCBase GetInstance(FontOptimizer fo) { return(new FC_Template(fo)); }
}// class Letter #endregion /// <summary> /// cTor: Accepts a FontOptimizer fully setup to serve bitmaps of the selected font and size /// </summary> /// <param name="fo">The initialized FontOptimizer</param> public FC_Template(FontOptimizer fo) : base(fo) { }
/// <summary> /// Returns a new instance of this implementation /// </summary> /// <returns>A new specific FontCreator instance</returns> static public new FCBase GetInstance(FontOptimizer fo) { return(new GLCD_FC2_Compatible(fo)); }
}// class Letter #endregion /// <summary> /// cTor: Accepts a FontOptimizer fully setup to serve bitmaps of the selected font and size /// </summary> /// <param name="fo">The initialized FontOptimizer</param> public GLCD_FC2_Compatible(FontOptimizer fo) : base(fo) { }