@@ -70,74 +70,52 @@ int Translator::sfl() {
7070 {
7171 // write macros to file
7272 std::vector<std::string> definedMacros;
73- definedMacros.reserve (5 );
73+ definedMacros.reserve (6 );
7474
75- line = " ____" + std::regex_replace (line, std::regex (" -" ), " _" );
75+ // line = "____" + std::regex_replace(line, std::regex("-"), "_");
76+ line = " ____" + fontType + " _" + std::to_string (font_width) + " x"
77+ + std::to_string (font_height) + " _" ;
7678 std::transform (line.begin (), line.end (), line.begin (), ::toupper);
7779
7880 definedMacros.push_back (line);
7981
80-
81- Translator::outputFile << " #ifndef " << line << " \n " ;
82- Translator::outputFile << " #define " << line << " \n\n\n " ;
83-
84- line = " type_" + fontType + " _" +
85- std::to_string (font_width) + " x" + std::to_string (font_height);
86-
87- std::transform (
88- line.begin (), line.end (),
89- line.begin (), ::toupper
90- );
82+ line = " TYPE_PSF1_8X18" ;
9183 definedMacros.push_back (line);
92- Translator::outputFile << " #define " << line <<
93- " " ;
94-
95- if (!Prefs.isCPU ()) {
96- Translator::outputFile << 5 ;
97- }
98- else {
99- Translator::outputFile << 0 ;
100- }
101-
102- Translator::outputFile << " \n\n " ;
103-
104- line = " font_" + fontType + " _" +
105- std::to_string (font_width) + " x" +
106- std::to_string (font_height);
107- tmp = line + " _width" ;
108- line.append (" _height" );
109-
110- std::transform (
111- line.begin (), line.end (),
112- line.begin (), ::toupper
113- );
114- std::transform (
115- tmp.begin (), tmp.end (),
116- tmp.begin (), ::toupper
117- );
11884
85+ line = " PSF1_SIGNATURE" ;
11986 definedMacros.push_back (line);
120- definedMacros.push_back (tmp);
12187
122- Translator::outputFile << " #define " << line <<
123- " " << font_height << " \n\n " ;
124- Translator::outputFile << " #define " << tmp <<
125- " " << font_width << " \n\n\n " ;
88+ line = fontType + " _ " + std::to_string (font_width) + " x "
89+ + std::to_string ( font_height) + " _height " ;
90+ std::transform (line. begin (), line. end (), line. begin (), ::toupper);
91+ definedMacros. push_back (line) ;
12692
93+ line = fontType + " _" + std::to_string (font_width) + " x"
94+ + std::to_string (font_height) + " _width" ;
95+ std::transform (line.begin (), line.end (), line.begin (), ::toupper);
96+ definedMacros.push_back (line);
12797
128- line = " decl_" + fontType + " _" +
129- std::to_string (font_width) + " x" +
130- std::to_string (font_height);
131- std::transform (
132- line.begin (), line.end (),
133- line.begin (), ::toupper
134- );
98+ line = " decl_" + fontType + " _" + std::to_string (font_width)
99+ + " x" + std::to_string (font_height);
100+ std::transform (line.begin (), line.end (), line.begin (), ::toupper);
135101 definedMacros.push_back (line);
136102
137- Translator::outputFile << " #define " << line <<
138- " \\\n {\\\n\t " ;
103+
104+ if (fontType == " psf1" ) {
105+ line = " 0x3604" ;
106+ } else {
107+ line = " " ;
108+ }
139109
140110
111+ Translator::outputFile << " #ifndef " << definedMacros[0 ]
112+ << " \n #define " << definedMacros[0 ]
113+ << " \n\n\n #define " << definedMacros[1 ] << " 0"
114+ << " \n\n #define " << definedMacros[2 ] << line
115+ << " \n\n #define " << definedMacros[3 ] << " " << std::to_string (font_height)
116+ << " \n\n #define " << definedMacros[4 ] << " " << std::to_string (font_width)
117+ << " \n\n #define " << definedMacros[5 ]
118+ << " \\\n {\\\n\t " ;
141119
142120
143121 if (!Prefs.isLogSuppressed ()) {
0 commit comments