Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- byte[] widths = new byte[this.end - this.start + 1];
- for (int i: widths) {
- BufferedImage sheet = this.sheets.get(i / 128);
- for (int j = 0; j < 128; j++) {
- // for each individual glyph...
- int width = 0;
- boolean[] isWhite = new boolean[128];
- for (int k = 0; k < 128; k++) {
- // for each individual pixel...
- int x = (j % 128) / 8 + (k / 8);
- int y = (j / 128) * 8 + (k % 8);
- isWhite[k] = sheet.getRGB(x, y) == (new Color(0xff, 0xff, 0xff)).getRGB(); // I don't trust any of this
- }
- for (int h = 127; h >= 0; h--) {
- // for each individual pixel in reverse
- if (isWhite[h]) {
- int index = 127 - h;
- width = index % 8;
- }
- }
- widths[i] = (byte) width;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement