mirror of
https://github.com/dmolony/DiskBrowser.git
synced 2025-01-03 13:31:44 +00:00
more fonty stuff
This commit is contained in:
parent
895dc892a5
commit
ca5253a56c
@ -4,6 +4,7 @@ import java.awt.AlphaComposite;
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.awt.image.DataBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@ -73,13 +74,39 @@ abstract class CharacterList extends AbstractFile
|
||||
return border * 2 + chars * (size + gap) - gap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText ()
|
||||
{
|
||||
StringBuilder text = new StringBuilder ("Name : " + name + "\n\n");
|
||||
|
||||
for (Character character : characters)
|
||||
{
|
||||
text.append (character);
|
||||
text.append ("\n");
|
||||
}
|
||||
|
||||
return text.toString ();
|
||||
}
|
||||
|
||||
class Character
|
||||
{
|
||||
BufferedImage image;
|
||||
BufferedImage image = new BufferedImage (sizeX, sizeY, BufferedImage.TYPE_BYTE_GRAY);
|
||||
|
||||
public Character (byte[] buffer, int ptr)
|
||||
@Override
|
||||
public String toString ()
|
||||
{
|
||||
image = new BufferedImage (sizeX, sizeY, BufferedImage.TYPE_BYTE_GRAY);
|
||||
StringBuilder text = new StringBuilder ();
|
||||
DataBuffer dataBuffer = image.getRaster ().getDataBuffer ();
|
||||
int element = 0;
|
||||
|
||||
for (int i = 0; i < sizeY; i++)
|
||||
{
|
||||
for (int j = 0; j < sizeX; j++)
|
||||
text.append (dataBuffer.getElem (element++) == 0 ? "." : "X");
|
||||
text.append ("\n");
|
||||
}
|
||||
|
||||
return text.toString ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -34,29 +34,6 @@ public class CharacterRom extends CharacterList
|
||||
&& buffer[2] == (byte) 0x53 && buffer[3] == (byte) 0x10;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText ()
|
||||
{
|
||||
StringBuilder text = new StringBuilder (description + "\n\n");
|
||||
|
||||
for (int i = 256; i < buffer.length; i += sizeY)
|
||||
{
|
||||
for (int line = 0; line < sizeY; line++)
|
||||
{
|
||||
int value = buffer[i + line] & 0xFF;
|
||||
for (int bit = 0; bit < sizeX; bit++)
|
||||
{
|
||||
text.append ((value & 0x80) == 0 ? "." : "X");
|
||||
value <<= 1;
|
||||
}
|
||||
text.append ("\n");
|
||||
}
|
||||
text.append ("\n");
|
||||
}
|
||||
|
||||
return text.toString ();
|
||||
}
|
||||
|
||||
@Override
|
||||
Character createCharacter (byte[] buffer, int ptr)
|
||||
{
|
||||
@ -67,8 +44,6 @@ public class CharacterRom extends CharacterList
|
||||
{
|
||||
public CharacterRomCharacter (byte[] buffer, int ptr)
|
||||
{
|
||||
super (buffer, ptr);
|
||||
|
||||
DataBuffer dataBuffer = image.getRaster ().getDataBuffer ();
|
||||
int element = 0;
|
||||
|
||||
|
@ -17,29 +17,6 @@ public class Charset extends CharacterList
|
||||
super (name, buffer, charsX, charsY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText ()
|
||||
{
|
||||
StringBuilder text = new StringBuilder ();
|
||||
|
||||
for (int i = 0; i < buffer.length; i += sizeY)
|
||||
{
|
||||
for (int line = sizeY - 1; line >= 0; line--)
|
||||
{
|
||||
int value = buffer[line + i] & 0xFF;
|
||||
for (int bit = 0; bit < sizeX; bit++)
|
||||
{
|
||||
text.append ((value & 0x01) == 0 ? "." : "X");
|
||||
value >>>= 1;
|
||||
}
|
||||
text.append ("\n");
|
||||
}
|
||||
text.append ("\n");
|
||||
}
|
||||
|
||||
return text.toString ();
|
||||
}
|
||||
|
||||
@Override
|
||||
Character createCharacter (byte[] buffer, int ptr)
|
||||
{
|
||||
@ -50,8 +27,6 @@ public class Charset extends CharacterList
|
||||
{
|
||||
public CharsetCharacter (byte[] buffer, int ptr)
|
||||
{
|
||||
super (buffer, ptr);
|
||||
|
||||
DataBuffer dataBuffer = image.getRaster ().getDataBuffer ();
|
||||
int element = 0;
|
||||
|
||||
|
@ -28,29 +28,6 @@ public class FontFile extends CharacterList
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText ()
|
||||
{
|
||||
StringBuilder text = new StringBuilder ("Name : " + name + "\n\n");
|
||||
|
||||
for (int i = 0; i < buffer.length; i += sizeY)
|
||||
{
|
||||
for (int line = 0; line < sizeY; line++)
|
||||
{
|
||||
int value = buffer[i + line] & 0xFF;
|
||||
for (int bit = 0; bit < sizeX; bit++)
|
||||
{
|
||||
text.append ((value & 0x01) == 0 ? "." : "X");
|
||||
value >>>= 1;
|
||||
}
|
||||
text.append ("\n");
|
||||
}
|
||||
text.append ("\n");
|
||||
}
|
||||
|
||||
return text.toString ();
|
||||
}
|
||||
|
||||
@Override
|
||||
Character createCharacter (byte[] buffer, int ptr)
|
||||
{
|
||||
@ -61,8 +38,6 @@ public class FontFile extends CharacterList
|
||||
{
|
||||
public FontFileCharacter (byte[] buffer, int ptr)
|
||||
{
|
||||
super (buffer, ptr);
|
||||
|
||||
DataBuffer dataBuffer = image.getRaster ().getDataBuffer ();
|
||||
int element = 0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user