Source Code Cross Referenced for ymage8BitFontGenerator.java in  » Search-Engine » yacy » de » anomic » ymage » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Search Engine » yacy » de.anomic.ymage 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        // ymage8BitFontGenerator.java
002:        // ---------------------------
003:        // by Marc Nause
004:        // created: 05.04.2007
005:        //
006:        // based on:
007:        // ymageFontGenerator.java
008:        // ---------------------------
009:        // (C) by Michael Peter Christen; mc@anomic.de
010:        // first published on http://www.anomic.de
011:        // Frankfurt, Germany, 2005
012:        // created: 31.10.2005
013:        //
014:        // This program is free software; you can redistribute it and/or modify
015:        // it under the terms of the GNU General Public License as published by
016:        // the Free Software Foundation; either version 2 of the License, or
017:        // (at your option) any later version.
018:        //
019:        // This program is distributed in the hope that it will be useful,
020:        // but WITHOUT ANY WARRANTY; without even the implied warranty of
021:        // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
022:        // GNU General Public License for more details.
023:        //
024:        // You should have received a copy of the GNU General Public License
025:        // along with this program; if not, write to the Free Software
026:        // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
027:        //
028:        // Using this software in any meaning (reading, learning, copying, compiling,
029:        // running) means that you agree that the Author(s) is (are) not responsible
030:        // for cost, loss of data or any harm that may be caused directly or indirectly
031:        // by usage of this softare or this documentation. The usage of this software
032:        // is on your own risk. The installation and usage (starting/running) of this
033:        // software may allow other people or application to access your computer and
034:        // any attached devices and is highly dependent on the configuration of the
035:        // software which must be done by the user of the software; the author(s) is
036:        // (are) also not responsible for proper configuration and usage of the
037:        // software, even if provoked by documentation provided together with
038:        // the software.
039:        //
040:        // Any changes to this file according to the GPL as documented in the file
041:        // gpl.txt aside this file in the shipment you received can be done to the
042:        // lines that follows this copyright notice here, but changes must not be
043:        // done inside the copyright notive above. A re-distribution must contain
044:        // the intact and unchanged copyright notice.
045:        // Contributions and changes to the program code must be marked as such.
046:
047:        package de.anomic.ymage;
048:
049:        public class ymage8BitFontGenerator {
050:
051:            //A valid ymage font has 96 characters:
052:
053:            /*
054:             0x20: !"#$%&'
055:             0x28:()*+,-./
056:             0x30:01234567
057:             0x38:89:;<=>?
058:             0x40:@ABCDEFG
059:             0x48:HIJKLMNO
060:             0x50:PQRSTUVW
061:             0x58:XYZ[\]^_
062:             0x60:`abcdefg
063:             0x68:hijklmno
064:             0x70:pqrstuvw
065:             0x78:xyz{|}~
066:             */
067:
068:            //Each character has the same height of m lines with n pixels each.
069:            //While m does not need to equal n both have to stay consistend through
070:            //the whole font.
071:            public static final String[][] font = {
072:                    {
073:                            "........", //0x20
074:                            "........", "........", "........", "........",
075:                            "........", "........", "........" },
076:                    { "...X....", "...X....", "...X....", "...X....",
077:                            "...X....", "........", "...X....", "........" },
078:                    { "..X.X...", "..X.X...", "........", "........",
079:                            "........", "........", "........", "........" },
080:                    { "..X.X...", "..X.X...", "XXXXXXX.", "..X.X...",
081:                            "XXXXXXX.", "..X.X...", "..X.X...", "........" },
082:                    { "...XX...", ".XXXXXX.", "X..XX...", ".XXXXX..",
083:                            "...XX.X.", "XXXXXX..", "...X....", "........" },
084:                    { ".XX...X.", ".XX..X..", "....X...", "...X....",
085:                            "..X.....", ".X...XX.", "X....XX.", "........" },
086:                    { ".XX.....", "X..X....", ".XX.....", "..X...X.",
087:                            "X..X.X..", "X...X...", ".XXX..X.", "........" },
088:                    { "...X....", "...X....", "........", "........",
089:                            "........", "........", "........", "........" },
090:                    { "....X...", "...X....", "..X.....", "..X.....",
091:                            "..X.....", "...X....", "....X...", "........" },
092:                    { "...X....", "....X...", ".....X..", ".....X..",
093:                            ".....X..", "....X...", "...X....", "........" },
094:                    { "...X....", ".X.X.X..", "..XXX...", "XXXXXXX.",
095:                            "..XXX...", ".X..X.X.", "...X....", "........" },
096:                    { "........", "...X....", "...X....", ".XXXXX..",
097:                            "...X....", "...X....", "........", "........" },
098:                    { "........", "........", "........", "........",
099:                            "........", "...XX...", "...XX...", "....X..." },
100:                    { "........", "........", "........", ".XXXXX..",
101:                            "........", "........", "........", "........" },
102:                    { "........", "........", "........", "........",
103:                            "........", "...XX...", "...XX...", "........" },
104:                    { "......X.", ".....X..", "....X...", "...X....",
105:                            "..X.....", ".X......", "X.......", "........" },
106:                    { ".XXXXX..", "X....XX.", "X...X.X.", "X..X..X.",
107:                            "X.X...X.", "XX....X.", ".XXXXX..", "........" },
108:                    { "...X....", "..XX....", ".X.X....", "...X....",
109:                            "...X....", "...X....", ".XXXXX..", "........" },
110:                    { "..XXX...", ".X...X..", ".....X..", "....X...",
111:                            "...X....", "..X.....", ".XXXXX..", "........" },
112:                    { "..XXX...", ".X...X..", ".....X..", "...XX...",
113:                            ".....X..", ".X...X..", "..XXX...", "........" },
114:                    { ".....X..", "....XX..", "...X.X..", "..X..X..",
115:                            ".XXXXXX.", ".....X..", ".....X..", "........" },
116:                    { ".XXXXXX.", ".X......", ".X......", ".XXXXX..",
117:                            "......X.", "......X.", ".XXXXX..", "........" },
118:                    { "..XXX...", ".X...X..", ".X......", ".XXXX...",
119:                            ".X...X..", ".X...X..", "..XXX...", "........" },
120:                    { ".XXXXX..", ".....X..", ".....X..", "....X...",
121:                            "...X....", "...X....", "...X....", "........" },
122:                    { "..XXX...", ".X...X..", ".X...X..", "..XXX...",
123:                            ".X...X..", ".X...X..", "..XXX...", "........" },
124:                    { "..XXX...", ".X...X..", ".X...X..", "..XXXX..",
125:                            ".....X..", ".X...X..", "..XXX...", "........" },
126:                    { "........", "........", "...XX...", "...XX...",
127:                            "........", "...XX...", "...XX...", "........" },
128:                    { "........", "........", "...XX...", "...XX...",
129:                            "........", "...XX...", "...XX...", "....X..." },
130:                    { ".....XX.", "...XX...", ".XX.....", "X.......",
131:                            ".XX.....", "...XX...", ".....XX.", "........" },
132:                    { "........", "........", "..XXXX..", "........",
133:                            "..XXXX..", "........", "........", "........" },
134:                    { "XX......", "..XX....", "....XX..", "......X.",
135:                            "....XX..", "..XX....", "XX......", "........", },
136:                    { "..XXX...", ".X...X..", ".....X..", "....X...",
137:                            "...X....", "........", "...X....", "........" },
138:                    { ".XXXXX..", "X.....X.", "X...XXX.", "X..X..X.",
139:                            "X...XXX.", "X.......", ".XXXXXX.", "........" },
140:                    { ".XXXXX..", "X.....X.", "X.....X.", "XXXXXXX.",
141:                            "X.....X.", "X.....X.", "X.....X.", "........" },
142:                    { "XXXXXX..", "X.....X.", "X.....X.", "XXXXXX..",
143:                            "X.....X.", "X.....X.", "XXXXXX..", "........" },
144:                    { "..XXXX..", ".X....X.", "X.......", "X.......",
145:                            "X.......", ".X....X.", "..XXXX..", "........" },
146:                    { "XXXXX...", "X....X..", "X.....X.", "X.....X.",
147:                            "X.....X.", "X....X..", "XXXXX...", "........" },
148:                    { "XXXXXXX.", "X.......", "X.......", "XXXXXX..",
149:                            "X.......", "X.......", "XXXXXXX.", "........" },
150:                    { "XXXXXXX.", "X.......", "X.......", "XXXXXX..",
151:                            "X.......", "X.......", "X.......", "........" },
152:                    { ".XXXXX..", "X.......", "X.......", "X..XXXX.",
153:                            "X.....X.", "X.....X.", ".XXXXX..", "........" },
154:                    { "X.....X.", "X.....X.", "X.....X.", "XXXXXXX.",
155:                            "X.....X.", "X.....X.", "X.....X.", "........" },
156:                    { "..XXX...", "...X....", "...X....", "...X....",
157:                            "...X....", "...X....", "..XXX...", "........" },
158:                    { "...XXX..", "....X...", "....X...", "....X...",
159:                            "....X...", "X...X...", ".XXX....", "........" },
160:                    { "X....XX.", "X...XX..", "X..XX...", "XXX.....",
161:                            "X..XX...", "X...XX..", "X....XX.", "........" },
162:                    { "X.......", "X.......", "X.......", "X.......",
163:                            "X.......", "X.......", "XXXXXXX.", "........" },
164:                    { "X.....X.", "XX...XX.", "X.X.X.X.", "X..X..X.",
165:                            "X.....X.", "X.....X.", "X.....X.", "........" },
166:                    { "X.....X.", "XX....X.", "X.X...X.", "X..X..X.",
167:                            "X...X.X.", "X....XX.", "X.....X.", "........" },
168:                    { ".XXXXX..", "X.....X.", "X.....X.", "X.....X.",
169:                            "X.....X.", "X.....X.", ".XXXXX..", "........" },
170:                    { "XXXXXX..", "X.....X.", "X.....X.", "XXXXXX..",
171:                            "X.......", "X.......", "X.......", "........" },
172:                    { ".XXXXX..", "X.....X.", "X.....X.", "X.....X.",
173:                            "X.....X.", "X...X.X.", ".XXXXX..", "......X." },
174:                    { "XXXXXX..", "X.....X.", "X.....X.", "XXXXXX..",
175:                            "X...X...", "X....X..", "X.....X.", "........" },
176:                    { ".XXXXX..", "X.....X.", "X.......", ".XXXXX..",
177:                            "......X.", "X.....X.", ".XXXXX..", "........" },
178:                    { "XXXXXXX.", "...X....", "...X....", "...X....",
179:                            "...X....", "...X....", "...X....", "........" },
180:                    { "X.....X.", "X.....X.", "X.....X.", "X.....X.",
181:                            "X.....X.", "X.....X.", ".XXXXX..", "........" },
182:                    { "X.....X.", "X.....X.", "X.....X.", "X.....X.",
183:                            ".X...X..", "..X.X...", "...X....", "........" },
184:                    { "X.....X.", "X.....X.", "X.....X.", "X.....X.",
185:                            "X..X..X.", "X.X.X.X.", ".X...X..", "........" },
186:                    { "X.....X.", ".X...X..", "..X.X...", "...X....",
187:                            "..X.X...", ".X...X..", "X.....X.", "........" },
188:                    { "X.....X.", ".X...X..", "..X.X...", "...X....",
189:                            "...X....", "...X....", "...X....", "........" },
190:                    { "XXXXXXX.", ".....X..", "....X...", "...X....",
191:                            "..X.....", ".X......", "XXXXXXX.", "........" },
192:                    { "..XXXX..", "..X.....", "..X.....", "..X.....",
193:                            "..X.....", "..X.....", "..XXXX..", "........" },
194:                    { "X.......", ".X......", "..X.....", "...X....",
195:                            "....X...", ".....X..", "......X.", "........" },
196:                    { "..XXXX..", ".....X..", ".....X..", ".....X..",
197:                            ".....X..", ".....X..", "..XXXX..", "........" },
198:                    { "...X....", "..X.X...", ".X...X..", "........",
199:                            "........", "........", "........", "........" },
200:                    { "........", "........", "........", "........",
201:                            "........", "........", "XXXXXXX.", "........" },
202:                    { "...X....", "....X...", "........", "........",
203:                            "........", "........", "........", "........" },
204:                    { "........", "........", ".XXXX...", ".....X..",
205:                            ".XXXXX..", "X....X..", ".XXXX.X.", "........" },
206:                    { "X.......", "X.......", "X.......", "XXXXXX..",
207:                            "X.....X.", "X.....X.", "XXXXXX..", "........" },
208:                    { "........", "........", ".XXXXXX.", "X.......",
209:                            "X.......", "X.......", ".XXXXXX.", "........" },
210:                    { "......X.", "......X.", "......X.", ".XXXXXX.",
211:                            "X.....X.", "X.....X.", ".XXXXXX.", "........" },
212:                    { "........", "........", ".XXXXX..", "X.....X.",
213:                            "XXXXXXX.", "X.......", ".XXXXX..", "........" },
214:                    { "...XX...", "..X.....", "..X.....", ".XXX....",
215:                            "..X.....", "..X.....", "..X.....", "........" },
216:                    { "........", "........", ".XXXXX..", "X.....X.",
217:                            "X.....X.", ".XXXXXX.", "......X.", ".XXXXX.." },
218:                    { "X.......", "X.......", "X.......", "XXXXXX..",
219:                            "X.....X.", "X.....X.", "X.....X.", "........" },
220:                    { "........", "...X....", "........", "..XX....",
221:                            "...X....", "...X....", "..XXX...", "........" },
222:                    { "........", "....X...", "........", "...XX...",
223:                            "....X...", "....X...", "....X...", "..XX...." },
224:                    { "X.......", "X.......", "X....XX.", "X..XX...",
225:                            "XXX.....", "X..XX...", "X....XX.", "........" },
226:                    { "..XX....", "...X....", "...X....", "...X....",
227:                            "...X....", "...X....", "..XXX...", "........" },
228:                    { "........", "........", ".XX.XX..", "X..X..X.",
229:                            "X..X..X.", "X..X..X.", "X..X..X.", "........" },
230:                    { "........", "........", ".XXXXX..", "X.....X.",
231:                            "X.....X.", "X.....X.", "X.....X.", "........" },
232:                    { "........", "........", ".XXXXX..", "X.....X.",
233:                            "X.....X.", "X.....X.", ".XXXXX..", "........" },
234:                    { "........", "........", "XXXXXX..", "X.....X.",
235:                            "X.....X.", "XXXXXX..", "X.......", "X......." },
236:                    { "........", "........", ".XXXXXX.", "X.....X.",
237:                            "X.....X.", ".XXXXXX.", "......X.", "......X." },
238:                    { "........", "........", "X.XXXX..", "XX....X.",
239:                            "X.......", "X.......", "X.......", "........" },
240:                    { "........", "........", ".XXXXX..", "X.......",
241:                            ".XXXXX..", "......X.", ".XXXXX..", "........" },
242:                    { "...X....", "...X....", "...X....", ".XXXXX..",
243:                            "...X....", "...X....", "....XX..", "........" },
244:                    { "........", "........", "X.....X.", "X.....X.",
245:                            "X.....X.", "X.....X.", ".XXXXX..", "........" },
246:                    { "........", "........", "X.....X.", "X.....X.",
247:                            ".X...X..", "..X.X...", "...X....", "........" },
248:                    { "........", "........", "X.....X.", "X.....X.",
249:                            "X..X..X.", "X.X.X.X.", ".X...X..", "........" },
250:                    { "........", "........", "X.....X.", ".XX.XX..",
251:                            "...X....", ".XX.XX..", "X.....X.", "........" },
252:                    { "........", "........", "X.....X.", "X.....X.",
253:                            "X.....X.", ".XXXXXX.", "......X.", ".XXXXX.." },
254:                    { "........", "........", "XXXXXXX.", "....XX..",
255:                            "...X....", ".XX.....", "XXXXXXX.", "........" },
256:                    { "...XX...", "..X.....", "..X.....", "XX......",
257:                            "..X.....", "..X.....", "...XX...", "........" },
258:                    { "...X....", "...X....", "...X....", "...X....",
259:                            "...X....", "...X....", "...X....", "...X...." },
260:                    { "...XX...", ".....X..", ".....X..", "......XX",
261:                            ".....X..", ".....X..", "...XX...", "........" },
262:                    { "........", "........", "..X.....", ".X.XX.X.",
263:                            ".....X..", "........", "........", "........" },
264:                    { "XXXXXXX.", "X.....X.", "X.....X.", "X.....X.",
265:                            "X.....X.", "X.....X.", "XXXXXXX.", "........" },
266:
267:            };
268:
269:            public static void main(String[] args) {
270:                String[] letter;
271:                int b;
272:                int v;
273:                int c = 0;
274:                int n = -1;
275:                int m = -1;
276:                String s;
277:
278:                //check if font has correct number of letters
279:                if (font.length != 96) {
280:                    System.out.println("\nWARNING: Font has " + font.length
281:                            + " letters, should have 96 letters.");
282:                    System.out.println("         Font will be invalid!\n");
283:                }
284:
285:                for (int i = 0; i < font.length; i++) {
286:                    letter = font[i];
287:                    b = 0;
288:
289:                    //check if all letters have same numbers of lines
290:                    if ((letter.length != n) && (n == -1)) {
291:                        n = letter.length;
292:                    } else if (letter.length != n) {
293:                        System.out.println("\n\nWARNING: Letter number " + i
294:                                + " has different number of lines ("
295:                                + letter.length + ") than predecessors (" + n
296:                                + ").");
297:                        System.out.println("         Font will be invalid!\n");
298:                    }
299:
300:                    for (int j = 0; j < letter.length; j++) {
301:
302:                        b = b << letter[j].length();
303:                        v = 16;
304:
305:                        //check if all letters have same number of lines
306:                        if ((letter[j].length() != m) && (m == -1)) {
307:                            m = letter[j].length();
308:                        } else if (letter[j].length() != m) {
309:                            System.out.println("\n\nWARNING: Letter number "
310:                                    + i + " has a different number of bits ("
311:                                    + letter[j].length()
312:                                    + ") than predecessors (" + m
313:                                    + ") in line " + j + ".");
314:                            System.out
315:                                    .println("         Font will be invalid!\n");
316:                        }
317:
318:                        for (int col = 0; col < letter[j].length(); col++) {
319:
320:                            if (letter[j].charAt(col) == 'X')
321:                                b += v;
322:                            v = v >> 1;
323:                        }
324:                    }
325:                    s = Long.toHexString(b).toUpperCase();
326:                    while (s.length() < (letter.length * m / 8))
327:                        s = "0" + s;
328:                    System.out.print("0x" + s + ",");
329:                    c++;
330:                    if (c >= 8) {
331:                        System.out.println();
332:                        c = 0;
333:                    }
334:                }
335:            }
336:
337:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.