Fonteditor/Export.cs
/// <summary>
/// Save a font in a given size into a c header for use in Arduino projects
/// </summary>
/// <param name="document"></param>
Save a font in a given size into a c header for use in Arduino projects
Save a font in a given size into a c header for use in Arduino projects
public static void ExportFontInSizeToFile( SizeInfo sizeInfo,bool rotate90cc, bool addGreeble)
        {
            if (sizeInfo == null) return;
            Dictionary<string, string> tmplates = new Dictionary<string, string>();
            string name = sizeInfo.Name.Replace(" ", "");
            tmplates.Add("NAME_PALETTE_ARRAY", name + "_Palette");
            tmplates.Add("COLOR_ENTRIES",getCOLOR_ENTRIES());
            tmplates.Add("NAME_BITMAP_ARRAY", name + "_BitmapData");
            tmplates.Add("BITMAP_ARRAY", getBITMAP_ARRAY(sizeInfo, rotate90cc, addGreeble));
            tmplates.Add("NAME_GLYPH_ENTRIES_LENGTH", name + "_GlyphDataLength");
            tmplates.Add("GLYPH_ENTRIES_LENGTH", sizeInfo.characters.Count().ToString());
            tmplates.Add("NAME_GLYPH_ARRAY", name + "_GlyphData");
            tmplates.Add("GLYPH_ENTRIES", getGLYPH_ENTRIES(sizeInfo));
            tmplates.Add("FONT_NAME", sizeInfo.Name);
            tmplates.Add("NAME_PALETTE_ARRAY_REF", name + "_Palette,");
            tmplates.Add("PALETTE_SIZE", Constants.colors.Count().ToString() + ",");
            tmplates.Add("NAME_BITMAP_ARRAY_REF", name + "_BitmapData,".PadRight(45, ' '));
            tmplates.Add("YADVANCE", sizeInfo.Width.ToString() + ",");
            tmplates.Add("NAME_GLYPH_ARRAY_REF", name + "_GlyphData,".PadRight(45, ' '));
            string document = LoadTemplate();
            foreach (KeyValuePair<string, string> kv in tmplates)
            {
                document = document.Replace("{{{" + kv.Key + "}}}", kv.Value);
            }
            SaveHeader(document);
        }
public static void ExportFontInSizeToFile ( SizeInfo sizeInfo , bool rotate90cc , bool addGreeble ) { if ( sizeInfo == null ) return ; Dictionary < string , string > tmplates = new Dictionary < string , string > ( ) ; string name = sizeInfo . Name . Replace ( " " , " " ) ; tmplates . Add ( " " , name + " " ) ; tmplates . Add ( " " , getCOLOR_ENTRIES ( ) ) ; tmplates . Add ( " " , name + " " ) ; tmplates . Add ( " " , getBITMAP_ARRAY ( sizeInfo , rotate90cc , addGreeble ) ) ; tmplates . Add ( " " , name + " " ) ; tmplates . Add ( " " , sizeInfo . characters . Count ( ) . ToString ( ) ) ; tmplates . Add ( " " , name + " " ) ; tmplates . Add ( " " , getGLYPH_ENTRIES ( sizeInfo ) ) ; tmplates . Add ( " " , sizeInfo . Name ) ; tmplates . Add ( " " , name + " " ) ; tmplates . Add ( " " , Constants . colors . Count ( ) . ToString ( ) + " " ) ; tmplates . Add ( " " , name + " " . PadRight ( 45 , ' ' ) ) ; tmplates . Add ( " " , sizeInfo . Width . ToString ( ) + " " ) ; tmplates . Add ( " " , name + " " . PadRight ( 45 , ' ' ) ) ; string document = LoadTemplate ( ) ; foreach ( KeyValuePair < string , string > kv in tmplates ) { document = document . Replace ( " " + kv . Key + " " , kv . Value ) ; } SaveHeader ( document ) ; }
Save a font in a given size into a c header for use in Arduino projects
Save a font in a given size into a c header for use in Arduino projects
sizeInfo
SizeInfo
rotate90cc
bool
addGreeble
bool
document
None